qt4

How to make a column in QTableWidget read only?

最后都变了- 提交于 2019-12-28 01:52:35
问题 I would like to have one column in QTableWidget NOT editable. In forums I have read a lot about some flags but could not manage to implement. 回答1: Insert into the QTableWidget following kind of items: QTableWidgetItem *item = new QTableWidgetItem(); item->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled); Works fine! EDIT: QTableWidgetItem *item = new QTableWidgetItem(); item->setFlags(item->flags() ^ Qt::ItemIsEditable); This is a better solution. Thanks to @priomsrb. 回答2: The result of using

what is the correct way to implement a QThread… (example please…)

梦想与她 提交于 2019-12-27 10:32:49
问题 The Qt documentation for QThread says to create a class from QThread, and to implement the run method. Below is taken from the 4.7 Qthread documentation... To create your own threads, subclass QThread and reimplement run(). For example: class MyThread : public QThread { public: void run(); }; void MyThread::run() { QTcpSocket socket; // connect QTcpSocket's signals somewhere meaningful ... socket.connectToHost(hostName, portNumber); exec(); } So in every single thread I've created, I've done

How to custom stylesheet QToolTip

可紊 提交于 2019-12-25 16:38:11
问题 I'am using Qt4.8 to create a pushbutton,and then I using setStyleSheet function to set style for this button and tooltip. But this code only applied for button and tooltip is doesn't work. This is my code QPushButton *status_label; this-> cellGUI.status_label->setStyleSheet(QString::fromUtf8("QPushButton {color:#E6E6E6;font-weight:bolder;font-family:tahoma;font-size:6px;background-color:rgb(255, 153, 0)} QPushButton::QToolTip {color:#2E2E2E;background-color:#CCCCCC;border:none}")); Please

How to custom stylesheet QToolTip

陌路散爱 提交于 2019-12-25 16:37:57
问题 I'am using Qt4.8 to create a pushbutton,and then I using setStyleSheet function to set style for this button and tooltip. But this code only applied for button and tooltip is doesn't work. This is my code QPushButton *status_label; this-> cellGUI.status_label->setStyleSheet(QString::fromUtf8("QPushButton {color:#E6E6E6;font-weight:bolder;font-family:tahoma;font-size:6px;background-color:rgb(255, 153, 0)} QPushButton::QToolTip {color:#2E2E2E;background-color:#CCCCCC;border:none}")); Please

How to custom stylesheet QToolTip

本秂侑毒 提交于 2019-12-25 16:37:10
问题 I'am using Qt4.8 to create a pushbutton,and then I using setStyleSheet function to set style for this button and tooltip. But this code only applied for button and tooltip is doesn't work. This is my code QPushButton *status_label; this-> cellGUI.status_label->setStyleSheet(QString::fromUtf8("QPushButton {color:#E6E6E6;font-weight:bolder;font-family:tahoma;font-size:6px;background-color:rgb(255, 153, 0)} QPushButton::QToolTip {color:#2E2E2E;background-color:#CCCCCC;border:none}")); Please

pyqt4: less round-about way of removing item from QListWidget?

吃可爱长大的小学妹 提交于 2019-12-25 08:37:05
问题 I want to remove an item whose name I know. I came up with: item = lw.findItems(name, QtCore.Qt.MatchExactly)[0] lw.takeItem(lw.indexFromItem(item).row()) Is there any more direct way of doing this? Something closer to lw.removeItem(name) ? 回答1: This leaves a bit of ambiguity for multiple entries with the same text. I would lean more toward something like [ lw.takeItem( i ) for i in range( lw.count ) if lw.item( i ).text() == name ] This will remove all items matching name from the list. If

How to associate a horizontal scrollbar to multiple groupbox.?

ぃ、小莉子 提交于 2019-12-25 04:58:12
问题 I wanted to have a total of 8 groupbox in the Dialog box. I don't know how to associate the horizontal scrollbar so that I can scroll it down and access all the group box. In the code below I have added only 2 as an example. Any help is appreciated. class Ui_Dialog(object): def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(400, 300) self.buttonBox = QtGui.QDialogButtonBox(Dialog) self.buttonBox.setGeometry(QtCore.QRect(300, 20, 81, 71)) self.buttonBox.setOrientation

QProgressBar Error

风格不统一 提交于 2019-12-25 01:38:17
问题 I am trying to add QProgressBar in my code but having some troubles. I added progress bar via Designer and in the code, I pass the pointer to QprogressBar object to a separate thread to have it update QProgressBar as it's processing data, however, I get this message: ../../src/xcb_lock.c:77: _XGetXCBBuffer: Assertion `((int) ((xcb_req) - (dpy->request)) >= 0)' failed. I am running Qt-4.5.0 on Ubuntu 8.10(2.6.27-11). I also tried Qt-4.3.5 in RHEL5(2.6.18) and I get different error, something

Qt4 Interfacing with the UI thread

和自甴很熟 提交于 2019-12-24 23:17:14
问题 I have a CLI application that I'm expanding to have a user interface to aid in, well, usability, and am using Qt-4.8.3. The application connects to an IRC server, and each connection resides in its own thread receiving data. A parser, running in a different thread, then processes the data and reacts accordingly - creating a channel, adding a user, etc. I've been looking through the documentation and just can't decide (or really see) what would be the most useful method to update the UI in my