qtableview

Change background of model index for QAbstractTableModel in PySide6

Change background of model index for QAbstractTableModel in PySide6 Question: I would like to change the background color of specific index on my table, but only after a specific task is completed. I know that I can use the Background role to change the color in my Table model, but I want to change the …

Total answers: 1

PyQt QTableView resizeRowsToContents not completely resize on initialisation

PyQt QTableView resizeRowsToContents not completely resize on initialisation Question: I have a minimum example here of a QTableView widget that displays a long string that I want word wrapped when I start the app. from PyQt6.QtWidgets import ( QMainWindow, QTableView, QHeaderView, QApplication, ) from PyQt6.QtCore import ( Qt, QEvent, QAbstractTableModel, QSize, QEvent ) import sys …

Total answers: 1

Unable remove row in proper order from qtableview

Unable remove row in proper order from qtableview Question: Press create button(Alt + C) and it will create a row(Port) in the table and delete button is to remove the corresponding row(Port) from table. When delete button is pressed deleteButtonPressed method is called. This method is suppose to remove the corresponding row from tableview but …

Total answers: 1

how to preserve selection when sorting QTableView

how to preserve selection when sorting QTableView Question: How can I preserve the selection of items when I sort the table? In the below example the selection is always fixed to the row index i.e. if I select first row, then after sorting always first row is selected, not the actual row that I had …

Total answers: 2

Make QTableView editable when model is pandas dataframe

Make QTableView editable when model is pandas dataframe Question: In my gui file I create a QTableView as follows (this is the part that is automatically generated by Qt Designer): self.pnl_results = QtGui.QTableView(self.tab_3) font = QtGui.QFont() font.setPointSize(7) self.pnl_results.setFont(font) self.pnl_results.setFrameShape(QtGui.QFrame.StyledPanel) self.pnl_results.setFrameShadow(QtGui.QFrame.Sunken) self.pnl_results.setEditTriggers(QtGui.QAbstractItemView.AllEditTriggers) self.pnl_results.setShowGrid(True) self.pnl_results.setSortingEnabled(True) self.pnl_results.setCornerButtonEnabled(True) self.pnl_results.setObjectName(“pnl_results”) I then define a model that enables me to link …

Total answers: 2

Copy/Paste multiple items from QTableView in pyqt4?

Copy/Paste multiple items from QTableView in pyqt4? Question: We can select multiple items(partial rows and partial columns) from QTableView using self.tableView.setSelectionMode(QAbstractItemView.ExtendedSelection), but after selecting some rows and columns(partial and partial) if I do CTRL+C and paste it in notepad it only pastes one item(one value from the tableView)? My Code: tab_table_view = QtGui.QWidget() self.Tab.insertTab(0, tab_table_view, …

Total answers: 5

How to create filters for QTableView in PyQt

How to create filters for QTableView in PyQt Question: I am using QTableView to display data retrieved from QtSql.QSqlQuery I want to know how can i create filters for it like in excel. In the above image i need to get the filters for All heders (Sh_Code,SH_Seq,Stage) The filters will have unique values in of …

Total answers: 4