qcheckbox

Python3 PyQt4 Creating a simple QCheckBox and changing a Boolean variable

痴心易碎 提交于 2019-12-30 11:29:07
问题 So I have been trying to write a GUI using Python 3.3 and PyQt4. I have been through a few tutorials and I still can't figure out how to have a Checkbox checking and unchecking trigger change in a global variable. I can't get it to trigger anything for that matter because all the tutorials use methods that wont work for me. The program is too big to copy here as a whole so I have put together the basic structure of the program surrounding the Checkboxes import sys from PyQt4 import QtGui,

Increase Checkbox size not its text in QT?

元气小坏坏 提交于 2019-12-19 05:22:06
问题 how to Increase Checkbox size not its text in QT ? Thanks. 回答1: Jérôme has given you good advice. I will just give further examples. QCheckBox::indicator { width: 40px; height: 40px; } QCheckBox::indicator:checked { image: url(../Checkbox_checked_normal.png); } QCheckBox::indicator:unchecked { image: url(../Checkbox_unchecked_normal.png); } QCheckBox::indicator:checked:hover { image: url(../Checkbox_checked_hovered.png); } QCheckBox::indicator:unchecked:hover { image: url(../Checkbox

QCombobox of Checkboxes

那年仲夏 提交于 2019-12-12 01:24:55
问题 I have a problem and I hope that you can help me. I want to create a Combobox of Checkboxes on Qt Creator. This is my code mod = new QStandardItemModel(1,0); QStandardItem *item; item = new QStandardItem("First"); item->setCheckable(true); mod->setItem(0,item); item = new QStandardItem("Second"); item->setCheckable(true); mod->setItem(1,item); ui->comboBox->setModel(mod); I built this code but in combobox are no checkboxees. Someone on the web told me that I have to use the event. Can you

PyQt QAbstractTableModel checkbox not checkable

孤街浪徒 提交于 2019-12-11 18:57:12
问题 I am using own table model with QAbstractTableModel, where I have first col with checkbox (checkable cause flags Qt.ItemIsUserCheckable | Qt.ItemIsSelectable | Qt.ItemIsEnabled ). I have trouble when I am trying use checkboxes, cause they are not checkable (can not make check or uncheck in them) in showed table. What am I doing wrong? I am using this methods in own table model class: def data(self, index, role): row = index.row() col = index.column() if role == Qt.DisplayRole: return '{0}'

Qt Command Log using QListWidget

拈花ヽ惹草 提交于 2019-12-11 15:23:41
问题 I am trying to build a command log on a user interface. Meaning, when the user click a button, check a box, upload some images etc, basically every time the user interacts with the user interface the action is recorded inside a QListWidget Command Log shown below. Basically this is how the ui looks as soon as the user run it: And this is what I am try to achieve everytime the user interacts with the ui: Below snippets of code from the constructor: mainwindow.h private: QListWidget

Python PyQt - Checkbox to uncheck all other checkboxes

旧街凉风 提交于 2019-12-10 21:50:14
问题 I'm trying to put in some validation such that: When either "Select A" or "Select B" is checked, "None Selected" is automatically unchecked When "None Selected" is checked, both "Select A" and "Select B" are automatically unchecked But when I run this code, clicking any checkbox will uncheck all the 3 checkboxes. i.e. The window initializes with "None Selected" checked. But when I click "Select A" , it unchecks "None Selected" , which is intended, but "Select A" doesn't get checked. What am I

PyQt4 Qtreewidget - get hierarchy text if child checkbox is checked

被刻印的时光 ゝ 提交于 2019-12-10 11:29:17
问题 What I am currently trying to do is take a populated tree (qtreewidget) that has checkboxes at the bottom child level, and return the text of the path to the child if the box is checked. The reason I want to do this, is if a child is checked, it will then change a value in a key in a dictionary. (The "raw" dictionary the tree was created from). Here's a visual example of what I mean: From user input and server directory crawling, we have populated a tree that looks something like this: (Only

QCheckbox/QRadioButton line wrap Qt4.6.0

一世执手 提交于 2019-12-10 03:30:31
问题 I'm trying to have a multi-line checkbox/radiobutton with Qt using standard QCheckbox/QRadioButton. I didn't find the direct solution since QRadioButton{wrap:true;} has no effect. The only thing possible would be to access to the QRadioButton->label->setLineWrap(true) but I'd like to do that from the designer not having to rewrite a widget Any idea beside putting a QRadioButton and a QLabel next to each others? Thx, Boris. 回答1: That indeed is really annoying and cannot be solved without

How to make QCheckBox readonly, but not grayed-out

夙愿已清 提交于 2019-12-09 14:50:20
问题 Any good way to make a checkbox readonly, but also not grayed-out (hardly visible). I have used setEnabled(bool) which works, but the checkbox then is grayed-out and hardly readable I can react on a toggle signal and reset the state. But I would need a kind of flag to determine if the box is read-only and then reset the check state, means I need to create my own CheckBox class. setCheckable does not work either, it does not allow me to set a checked state at all: cb = this->ui->cb_RealWorld-

Disable user to click over QTableWidget

ε祈祈猫儿з 提交于 2019-12-07 23:29:08
问题 I have QTableWidget with CheckBoxes in some cells. I want to disable user to perform mouse click over the table cells (so he can't change checkBox state) for some time while I am using data from the table. I've tried table.setDisabled(1) but that disables whole table and I need scroll to be enabled. Any help would be appreciated. EDIT To be more precise: there could be up to 15x3000 cells in table, filled with text(editable), checkbox(checkable), svg graphic(opens other window when double