qtablewidget

how to increase the row height of the header labels and font size of the row items in QTableWidget in pyqt4

南楼画角 提交于 2020-01-05 23:48:13
问题 Here i want to increase the row height of the headerlabel and font size of the cell items. In my code I am using self.table.setRowHeight() method, but its not working. So please tell me is their any method to increase the row height of the header labels and font size of cell items. given bellow is my code: import sys from PyQt4 import QtGui, QtCore ROUNDED_STYLE_SHEET1 = """QPushButton { background-color: green; color: white; border-style: outset; border-width: 4px; border-radius: 15px;

Retrieving data from columns qtablewidget

Deadly 提交于 2020-01-03 02:53:18
问题 I want to have a tablewidget that will color some of the rows based on certain conditions and threshold. For example, if the data in one column reaches over 20, it will color the row where that 20 was. What i have only searches through the Qtablewidgetitem and it does not do what I want it to do. def setmydata(self): for n, key in enumerate(self.data): for m, item in enumerate(self.data[key]): newitem = QtGui.QTableWidgetItem(item) c = newitem.column() + 2 print c for items in item: if

How to catch mouse over event of QTableWidget item in pyqt?

流过昼夜 提交于 2020-01-01 07:20:52
问题 what I want to do is to change the color of a QTableWidget item, when I hover with the mouse over the item of my QTableWidget. 回答1: Firstly, the table widget needs to have mouse-tracking switched on to get the hover events. Secondly, we need to find some signals that tell us when the mouse enters and leaves the table cells, so that the background colours can be changed at the right times. The QTableWidget class has the cellEntered / itemEntered signals, but there is nothing for when the mouse

Python PyQt - QTableWidget, JSON, and emitSignal causing blank cells

为君一笑 提交于 2020-01-01 03:37:09
问题 I am using PyQt for a simple application that reads from a log file with JSON formatted strings, and outputs them nicely in a table. Everything is working as expected except when I try to emit a signal from a 'load' function. This signal is picked up by the main window, in a slot designed to resort the table with new information. Without the signal emitted, the table populates fully and properly: By uncommenting the self.emit so that the signal IS emitted, the table ends up being incomplete:

QtDesigner & PySide: QTableWidget don't get accessible

二次信任 提交于 2019-12-30 10:10:49
问题 I made a form in QtDesigner. This form gets loaded from PySide with help of the function widget = loader.load(file, parent) However, the QTableWidget (with objectNname buffer_table) don't get accessible with widget.buffer_table If I use a QPushButton instead it works. How can I get this working. I'd like to fill up the table in Python. This is the ui-file i'd like to use: http://pastebin.com/6PZFrvmr EDIT: When I create a new table and try to load it, it seems to work. However, if I put it in

How validate a cell in QTableWidget?

跟風遠走 提交于 2019-12-29 08:11:39
问题 I work eith pyqt4 in python3.4 I want to validate if the text in the cell is a float number when it is introduced. How I do that? 回答1: You have two options. You can create a QItemDelegate and override the createEditor , setEditorData and setModelData to control the widget they're presented with to edit the data. You can create a QLineEdit with a validator if you'd like, but if they can only enter a number, you should probably just use a QSpinBox or QDoubleSpinBox , which only allow integers

How to highlight the entire row on mouse hover in QTableWidget: Qt5

假装没事ソ 提交于 2019-12-29 07:44:13
问题 I want to highlight the row on mouse hover in my QTableWidget . When I hover the mouse, only single cell highlighted. I have tried this approach : bool MyTabWidget::eventFilter(QObject *target, QEvent *event) { if( target == ui->MyTableWidget ) { //Just to print the event type qDebug() <<"EventType : "<<event->type(); } } Output : EventType : 13 . `(13 = QEvent::Move)` I have done lost of googling. but not get any proper solution. Is there any other approach to fulfill my requirment (to

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

Dynamically reading values from QTableWidget and store it

安稳与你 提交于 2019-12-25 18:36:14
问题 I have a QTablewidget , it can add rows and columns. Values can be inserted by user. I know how to get a single value of a cell by using current.item() method. But think and look at below image. User can insert different values and texts. I like to read a row values by its own. because I need to use values later. but I do not know how and where could values be read dynamically and still have a method to tell for exampel if a value under C is valid or not. Visualization: Here sees values at

Filling some QTableWidgetItems with QString from file

99封情书 提交于 2019-12-25 17:34:15
问题 I'm trying to fill a QTableWidget from a file that was exported by my program, but when I try to set text to the table cells they just ignore me, nothing happens. void MainWindow::on_actionOpen_Project_triggered() { QString line, fileName; fileName = QFileDialog::getOpenFileName(this,tr("Open Project"), "", tr("Project Files (*.project)")); if(!fileName.isEmpty()){ QFile file(fileName); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) return; QTextStream in(&file); for(int i=0;i<ui-