qtableview

How to make QTableView refresh Background color after it loads data again

空扰寡人 提交于 2021-02-18 19:12:49
问题 i have the following doubt regarding QTableView , i have added some code that changes the row background depending on what string the dataframe contains on the last column. def data(self, index, role=Qt.DisplayRole): if index.isValid(): if role == Qt.BackgroundRole: if df.iloc[index.row(),5] == "Ready for QC": return QBrush(Qt.yellow) if df.iloc[index.row(),5] == "In Progress": return QBrush(Qt.green) if role == Qt.DisplayRole: return str(self._data.iloc[index.row(), index.column()]) return

How to make QTableView refresh Background color after it loads data again

只愿长相守 提交于 2021-02-18 19:09:12
问题 i have the following doubt regarding QTableView , i have added some code that changes the row background depending on what string the dataframe contains on the last column. def data(self, index, role=Qt.DisplayRole): if index.isValid(): if role == Qt.BackgroundRole: if df.iloc[index.row(),5] == "Ready for QC": return QBrush(Qt.yellow) if df.iloc[index.row(),5] == "In Progress": return QBrush(Qt.green) if role == Qt.DisplayRole: return str(self._data.iloc[index.row(), index.column()]) return

How to make QTableView refresh Background color after it loads data again

﹥>﹥吖頭↗ 提交于 2021-02-18 19:07:38
问题 i have the following doubt regarding QTableView , i have added some code that changes the row background depending on what string the dataframe contains on the last column. def data(self, index, role=Qt.DisplayRole): if index.isValid(): if role == Qt.BackgroundRole: if df.iloc[index.row(),5] == "Ready for QC": return QBrush(Qt.yellow) if df.iloc[index.row(),5] == "In Progress": return QBrush(Qt.green) if role == Qt.DisplayRole: return str(self._data.iloc[index.row(), index.column()]) return

QFileSystemModel QTableView Date Modified highlighting

て烟熏妆下的殇ゞ 提交于 2021-02-16 20:54:06
问题 I am trying to make a little file browser using QFileSystemModel and QTableView. I was wondering if it is possible to highlight rows with same value in "Date Modified" column, for instance if I have two or more files which been modified today row gets highlighted in green, those modified yesterday highlighted in green but lighter shade, etc. 回答1: To change the background color there are several options such as: override the data() method of the model so that the return value associated with

Can't select entire row of data from QTableWidget

╄→гoц情女王★ 提交于 2021-02-13 17:34:47
问题 Problem Statement I'm trying to select rows of data from my QtableWidget and print them out to my console just so I can test some things, with the end goal being able to plot the data. However I can never grab the whole row of data. Background I have made a GUI that can embed several QTableWidgets by importing a specifically formatted CSV file. The goal is to be able to pull data from multiple rows from the same or different tables and then plot them in a side by side fashion. Where each row

Can't select entire row of data from QTableWidget

。_饼干妹妹 提交于 2021-02-13 17:32:10
问题 Problem Statement I'm trying to select rows of data from my QtableWidget and print them out to my console just so I can test some things, with the end goal being able to plot the data. However I can never grab the whole row of data. Background I have made a GUI that can embed several QTableWidgets by importing a specifically formatted CSV file. The goal is to be able to pull data from multiple rows from the same or different tables and then plot them in a side by side fashion. Where each row

Can't select entire row of data from QTableWidget

喜欢而已 提交于 2021-02-13 17:32:00
问题 Problem Statement I'm trying to select rows of data from my QtableWidget and print them out to my console just so I can test some things, with the end goal being able to plot the data. However I can never grab the whole row of data. Background I have made a GUI that can embed several QTableWidgets by importing a specifically formatted CSV file. The goal is to be able to pull data from multiple rows from the same or different tables and then plot them in a side by side fashion. Where each row

How to update a QTableView cell with a QCombobox selection?

不羁的心 提交于 2021-02-08 04:36:39
问题 I want to add a delegate QComboBox delegate to specific cells in some of the QTableView rows. I've found several posts on how to add the delegate, but none with examples for updating a cell with the QComboBox selection. This is what I have so far: main.ui <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>Dialog</class> <widget class="QDialog" name="Dialog"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>350</width> <height>239</height> </rect> </property> <property

QTableView drag move rows

邮差的信 提交于 2021-02-07 06:58:09
问题 I'm using a QTableView with a QAbstractTableModel and a QSortFilterProxyModel so that I can sort the items by clicking on the table headers. I'd like to add the option for the user to sort the rows in the view manually, by dragging them. I don't need to be able to do drag and drop from/to any external application, just to change the order in the list. I also don't need to change the data in the model, I only want the order to be different in the view. I've been looking through the

Using QComboBox in QTableView properly - issues with data being set and clearing QComboBoxes

家住魔仙堡 提交于 2021-02-05 07:39:57
问题 In my application im using a QTableView, QStandardItemModel and a QSortFilterProxyModel in between for filtering. The content is updated via a method for columns 1 & 2, and I want there to be a 3rd column for user to select options. I would prefer to use a QComboBox. I've got everything pretty much working, except that when I select the item from the QComboBox in any of the cells in column 3, it doesn't populate. Does it have something to do with my setModelData() method? I also have a clear