qcheckbox

Associate signal and slot to a qcheckbox create dynamically

一笑奈何 提交于 2019-12-07 18:54:25
I've got a very specific problem so I'm going to try to be as clear as possible. I've got a QTabWidget which contains QTableWidget , every line of my QTableWidget is create dynamically by reading a file. As you may see, when I create a line, I add a qCheckBox at the end. My goal now, is to send this line to the QTableWidget in the last tab of my QtableTab when I click on the qCheckBox ( and to delete this line when I uncheck the qCheckBox ). So every time I create a line dynamically, I try to associate to my qCheckBox a signal : QObject::connect(pCheckBox, SIGNAL(clicked()), this, SLOT

Disable user to click over QTableWidget

不打扰是莪最后的温柔 提交于 2019-12-06 06:34:05
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 click on it) or some custom widgets(which also have clickable or editable parts). I need to disable user

QCheckbox/QRadioButton line wrap Qt4.6.0

非 Y 不嫁゛ 提交于 2019-12-05 03:11:54
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. andref That indeed is really annoying and cannot be solved without reimplementation: the label uses Qt::PlainText if I'm not mistaken. In our projects, the UI team solved

Change checkbox position for a QCheckBox

强颜欢笑 提交于 2019-12-04 03:42:11
问题 I have a QCheckbox in a grid layout defined as such: self.isSubfactorCheckbox = QtGui.QCheckBox('Is &subfactor', self) By default the checkbox is to the left of the "Is subfactor" text. I wish to move it to the right of the text. I've tried playing around with subcontrol-position but to no avail. self.isSubfactorCheckbox.setStyleSheet('QCheckBox::indicator{subcontrol-origin: content; subcontrol-position: top right;}') This moves the checkbox to the right (it's still on the left of the text)

Set widget background color

*爱你&永不变心* 提交于 2019-12-04 03:34:18
I use QCheckBox in QTableWidgetCell QWidget *widget = new QWidget(); QCheckBox *checkBox = new QCheckBox(); QHBoxLayout *layout = new QHBoxLayout(widget); layout->addWidget(checkBox); layout->setAlignment(Qt::AlignCenter); layout->setContentsMargins(0, 0, 0, 0); widget->setLayout(layout); table->setCellWidget(0, 0, widget); How can I change cell background? The code: widget->setStyleSheet("background-color: red"); works fine but you need to set the style for every container widget you add to your table: So in order to see the change you need the following code: QWidget *widget = new QWidget();

How to make QCheckBox readonly, but not grayed-out

狂风中的少年 提交于 2019-12-04 01:02:31
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->isCheckable(); this->ui->cb_RealWorld->setCheckable(true); this->ui->cb_RealWorld->setChecked(someValue

Items disappears from combo box when I read them from model

纵然是瞬间 提交于 2019-12-02 09:28:40
问题 I have QComboBox and I set QStandardItemModel because I need multi-select check-boxes in it. Problem is that when I read text value and check state of items in comboBox, they disappear from combo. This is how I set model to comboBox: areas = ["Area one", "Area two", "Area three", "Area four"] model = QtGui.QStandardItemModel(4, 1)# 4 rows, 1 col for i,area in enumerate(areas): item = QtGui.QStandardItem(area) item.setFlags(QtCore.Qt.ItemIsUserCheckable | QtCore.Qt.ItemIsEnabled) item.setData

Python3 PyQt4 Creating a simple QCheckBox and changing a Boolean variable

点点圈 提交于 2019-12-01 10:51:50
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, QtCore ILCheck = False class SelectionWindow(QtGui.QWidget): def __init__(self, parent=None): super

checkbox and itemdelegate in a tableview

霸气de小男生 提交于 2019-11-30 15:14:09
I'm doing an implementation of a CheckBox that inherits from QitemDelegate, to put it into a QTableView. the problem is that I get when inserted flush left and I need it centered. As I understand the method that is responsible for the Paint. I have it written as follows: void CheckBoxDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { bool checkValue; QStyleOptionButton BtnStyle; BtnStyle.state = QStyle::State_Enabled; if(index.model()->data(index, Qt::DisplayRole).toBool() == true) { BtnStyle.state |= QStyle::State_On; checkValue = true;

checkbox and itemdelegate in a tableview

只谈情不闲聊 提交于 2019-11-29 21:56:35
问题 I'm doing an implementation of a CheckBox that inherits from QitemDelegate, to put it into a QTableView. the problem is that I get when inserted flush left and I need it centered. As I understand the method that is responsible for the Paint. I have it written as follows: void CheckBoxDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { bool checkValue; QStyleOptionButton BtnStyle; BtnStyle.state = QStyle::State_Enabled; if(index.model()-