Qtableview select multiple rows

Have added a stupid workaround, but would rather fix this the correct way. With ui. But I have solved that by decrementing (and removing from the end of the table view, not from the beginning): I shouldn't increment over the list and remove the first items because table was shifting rows after I have removed one - and that was making issues. MildWolfie. columns respectively. edited Sep 12, 2017 at 6:58. g. I have a table created with QTableView and QAbstractTableModel, which allows to select and copy multiple cells (rows and columns too) setting the extended selection to the QTableView setSelectionMode(QAbstractItemView::ExtendedSelection); This is the function to copy to the clipboard the selected cells. edited Nov 2, 2017 at 22:02. To do so, loop through the entire model and determine which rows have NULL as the timestamp. Hi, I have a QTableView and i have merged some cells. record(self. from document : Whenever you want to modify the selected items use select () and provide either a QItemSelection, or a QModelIndex and a QItemSelectionModel::SelectionFlag. Sep 3, 2021 · The method definition from the documentation is shown below (converted to Python). connect(self. See also rowHeight(). qvw. Call plot for those values. Sep 10, 2017 · In my code I read a dataset to select and then select them via: idx = treeview->model()->index(search); selection->select(idx, QItemSelectionModel::Select); This selects a cell, not the row . Apr 1, 2014 · Adding the data as a new row would be as follows. selectRow(at: indexPath, animated: true, scrollPosition: . table-> setSelectionBehavior ( QAbstractItemView::SelectRows ); to make QTableView only select whole rows. rows. selectedIndexes() [0]. I want to be able to select rows with the ExtendedSelection behavior and columns with the SingleSelection behavior, but independently of eachother. QString copySelectedRowText_; Aug 9, 2017 · def initiateMultiPlot(self, tableV, rowV, PlotV): """. Feb 15, 2013 · The model starts out with a number of rows and displays the data properly. Jun 19, 2013 · If it is individual cells, then you should detect if a user clicks on a cell in a different column. Returns true if the given row is hidden; otherwise returns false. Once I remove the selection, it reverts back to what the model sets. I still don't know why you want to forbid certain columns to be "click-to-select". """. Your use case is a simpler than that, but should point you in the right direction. Here is the code:-. I need to select any row and get data from every column of table to separate TextField. Martin Fitzpatrick has been developing Python/Qt apps for 8 years. I could just able to print single selected row. Returns the row span of the table element at Jan 3, 2022 · I want to print visible rows in QTableView. Andy M. However, it shows: void QTableView:: rowResized ( int row, int oldHeight, int newHeight) [protected slot] This slot is called to change the height of the given row. However, when I attempt to implement this code, I am getting a different result. setText to paste the result to the clipboard. Step-3: Understand that it is possible to obtain a number of rows and columns via rowCount and columnCount. I need users to be able to select multiple rows or columns and paste those values in either excel or notepad. I am using the QTableView to display a QAbstractTableModel: #include <QtGui/QApplication> #include <QAbstractTableModel> #include <QTableView> class TestModel : public I have a QTableView containing data rows from a database. row May 3, 2018 · 1. none) But how can I select multiple rows, or set all rows at selected? I tried in cellForRowAt indexPath to use isSelected = true and isHighlighted = true before I return each cell but it didn't worked. void QTableView::selectRow(int row) To copy to clipboard, switch view to plain text mode. tableView. Or a more generic one: QList<int> QTableView::findRows(int col, QVariant data); of course it's trivial to implement them in a rough way like I did above. When i click on an item, i want to select all merge rows. Jul 24, 2016 at 12:56. There are several several ways to do it. This function returns -1 if the given coordinate is not valid (has no column). Iterate over the items in that row and set background for each item. tableView. you can use QItemSelectionModel class to manage the view selection and modify them. this->setSelectionBehavior(QAbstractItemView::SelectRows); this->setSelectionMode(QAbstractItemView::MultiSelection); QModelIndexList selectedRows = selectionModel()->selectedRows(); Sep 10, 2011 · 3. To accomplish this I connect QTableView 's clicked signal to a custom viewClicked() method which receives the clicked QModelIndex automatically: self. tableWidget->setEditTriggers(QAbstractItemView::AllEditTriggers); Oct 12, 2022 · 2. At other times I will be working with mulitiple rows using: self. Any ideas? GUI: Code: Aug 22, 2011 · To start viewing messages, select the forum that you want to visit from the selection below. Apr 9, 2016 · wrote on 9 Apr 2016, 01:49. I can loop through each row of the QTableWidget and check them whether it is selected or not. Each row represents a remote device that the app can "see. 6,035 7 52 96. row (); beginRemoveRows ( QModelIndex (), row, row); m_myData. I can selected multiple rows by using ctrl + mouse left click. This class is used to provide standard tables that were previously provided by the QTable class, but using the more flexible approach provided by Qt’s model/view architecture. For this I have used QSortFilterProxyModel, but as per requirement each column of the QTableView should have a drop-down list which shows unique values in that column. Try this instead: ui. selectedRanges() returns n*m selectionRanges if if select a nXm selection. If you want to get the complete rows of the selected elements then a possible solution is: Get the rows. I have QML TableView with QSqlQueryModel. Building desktop applications to make data-analysis tools more user-friendly, Python was the obvious choice. 3,028 1 23 51. How should I code it up so that users can copy paste multiple rows/columns at the same time together with the row index (for row) and headers (for columns)? I have put up a simple example below. This should allow you to set your custom delegate for individual rows. I would like to add a feature that the user can select multiple rows and by changing one of the values within this rows. It will paste all the cells that were highlighted, they don't need to be in the same row. If you are removing multiple rows you can run into some complications using the removeRow() call. Qt Centre is a community site devoted to programming in C++ using the Qt framework. Iterate over the columns of those rows. For example: QItemSelectionModel *selections = this->ui->tableWidget->selectionModel(); QModelIndexList selected = selections->selectedRows(3); qSort(selected); QModelIndex first = selected. selectedIndexes(). I have used QSqlTableModel with QTableView. Returns the height of the given row. . When we find a match look at that key's corresponding Table Object, and iterate. I add data to the database then click a button to add the data to the database, a record is created and I call a function to update the table view with the data from the database. I'm sure that they'll want to select some devices in the view, but exclude others, so I'm looking Mar 4, 2018 · 1. For this we need to implement a Qt. I only want to be able to select entire rows. By default, for a table constructed without row and column counts, this property contains a value of 0. For one click to edit, the code should be. and simply drag and drop the columns to the top right by clicking on the column header. Nov 14, 2015 · I have the data in Qtableview, where my task is, when ever I do multiple selection of rows I want the content of all selected rows. QtWidgets. selectionModel(). or at least I would like to know what are the row numbers I have selected. If you are using a view where the selection behaviour is to select rows, the simplest method would be this: def selected_rows(self, selection): indexes = [] for index in selection. Hot Network Questions "Could" at the beginning of a non-question sentence Copy and paste of single selection of multiple items can be done in c++ by overriding Keypressevent of QTableView. – 2. model. loc[new_row, col] = new_values[i] Since self. 1) You can use delegates to draw the row background You will need to set the row to highlight in the delegate and based on that, do the highlighting. Anonymous. QModelIndexList selectedColumns ( int row = 0 ) const. findItems method when called will return a list Jan 24, 2013 · Yea, I am using that one. 0. Once you've got them, you can access the table content, in your case the text in the column with index 1 (key column). io/qt-6 QItemSelectionModel * selection = view->selectionModel(); QModelIndexList indexes = selection->selectedIndexes(); Then loop through the index list calling model->data(index) on each index. Does anyone know how to disable row in QTableView so that is still shown but not Mar 17, 2020 · On copy, save the current selected items with QTableWidget. Step-2: After scrolling documentation understand that table is organized as rectangles of items. python. Search for "Star Delegate Example". MatchFlags) This tells us that the method accepts a str "text" to search, and a Qt. Aug 10, 2017 · 3. dataFrame. Using mouse events for this is ineffective, because: 1. Assuming ui->xvalue is a QTableWidget, your code will look like this: void Widget::on_pushButton_2_clicked() // Select all rows push button. To do that, I would probably try subclassing QTableView and reimplementing selectionChanged () or track mouse clicks by connecting to the clicked () signal. append(index) return indexes. QtGui. I use an ItemSelectionModel and an ItemSelectionRectangle but I cannot get it to behave the way I need it to. I want to consider rows with merged cells as a signle row. #1. The initialization of the QTableView is shown as follows May 19, 2021 · QTableView -> optimize performance. Over 90 percent of questions asked here gets answered. Jan 12, 2015 · To select one item use QItemSelectionModel:: select selectionModel()->select( index, QItemSelectionModel::ClearAndSelect ); Make sure that selection behavior set for single seleciton Feb 27, 2019 · For example, if you select 1, table2 I want the whole value of row 1 to be entered and the next row 5 to be added to the row 5. A reason could be that I did not create the the table with a fixed table size. Feb 1, 2011 · Hi Pritpal, a little question about QTableView When I need select an entire row (Behavior: QAbstractItemView_SelectRows), I use oTableView:selectedRow( nRow ). row()). While searching for clues on how i can delete multiple rows from QTableView i came across this function: remove selected rows from QTableView. Get the selectionModel() of the view and connect to the currentRowChanged signal. He would actually change this value in all rows. Aug 3, 2016 · No i haven't seen this topic. May 8, 2017 · But you can certainly do: ui->tableWidget->selectRow(0); That will highlight the row. Jul 28, 2018 · I have created a table in PyQt4 using QTableView. table->setCurrentIndex(next_index); Jan 6, 2018 · to select a new row you must set some item of that row as active through the setCurrentIndex() method of QTableView, in this example I calculate the last row and with that I get the QPersistentModelIndex of an item of the next row, after deleting I convert it to QModelIndex and I use it in the previous method. QTableView. h: Q_OBJECT. Imagine, c1 and b3 are selected. On paste, set a new QTableWidgetItem for each cell in the list, translating the indexes to the new highlighted index. The previous number of rows is specified by oldCount, and the new number of rows is specified by newCount. answered Dec 27, 2011 at 14:17. clicked. . Searching and filtering works fine. If you want columns for "select" & "delete" those should (IMHO) have buttons (or Jun 19, 2020 · int row = parent. QTableView class is one of the Model/View Classes and is part of Qt Aug 22, 2018 · The code I pasted above is allowing me to select an item with single click instead of double click. PySide2. If you are looking for information about Qt related issue — register and post your question. However, setting setAlternatingRowColors(true) only alternates row colors that has data - the rest of the table is just white, which is not the behaviour you'd expect (look in the bookmark list of any browser, for example - empty rows has alternating colors). Jul 31, 2020 · Calling deleteRowFromTable was useless, because you didn't select any table; note that you should not use that function anyway (from the docs:. View solution in original post. index and DataFrame. The PySide. ExtendedSelection) works well in QTableWidget. But is one or more span is/are in the table and i want to add more, QTableWidget. findItems( str, Qt. 1. So far as I know, that's what you'll need to do. The app I'm working on has a QTableView. Now I am getting [c1, b3], how ever what I need is a dict or a list of lists with: Jul 24, 2016 · but simple deselection on second click would be better, you need write some code to achieve it. This is how I did it in PyQt, don't know C++ but I imagine it is quite similar: rows = set() for index in If you need to get data you are doing it here based on QModelIndex row and column and retrieving it from some container, maybe std::vector<std::vector<MyData> > data; You have to define such mapping and use it in data() and setData() functions to handle interaction with underlying model data. the user could change the name of all persons in the table to alice when he selected the whole table. e. Jul 21, 2016 · It features a QTableView that displays all records, a QLineEdit to search for records, and some labels that display the details of the selected record: There is a QAbstractTableModel class that holds the data and a QSortFilterProxyModel class that helps filtering the rows in the QTableView. Apr 30, 2020 · facilitating multiple selections from a QTableView. ui - >tableView - >selectRow (0); In the sample code below (heavily influenced from here), I want the entire row of the clicked cell to be selected instead of the individual cell. Oct 29, 2012 · As you use som YourModel to show it in YourTableView (QTableView) should do like this: YourModel->insertRow(YourModel->rowCount(QModelIndex())); // paste some data to new row. In conclusion, I would like to make table1 show the selected row value in table2 . I assume we will need a subclass of QTableView and define a keyPressEvent for it. 2) Catch the signal of current row. Here you can find an example of you could do the same thing to a listview. QTableView pandas DataTable, with column and row headers. How can I change the code to incorporate that? How can I change the code to incorporate that? Jan 15, 2019 · I am designing a GUI with a QTableView in which one would have to select multiple rows when needed. Removes all row and column spans in the table view. For this I have written code which is giving 'Zero' every time even though I don't select any row. To access the model's data, you can use QSqlQueryModel::record() . My goal is to have a QTableWidget in which the user can drag/drop rows internally. at(0); int columnCount = 2; // there are 2 columns in a row. In order to retrieve data I am using following line of code: out = (self. row() for index in self. But there are some major issues: In order to get the first and last item in the selection range you can simply sort that list. I tried using flags Qt::ItemFlags (using flags method in custom model) for the row but no matter what i use the rows are still selectable. I recently switched from Qt5 to Qt6. Create a pivot table with all the dimensions you need. value("NAME")) print(out) It is giving me row value. I am using PyQt5. If you just need to ensure to allow the user to select multiple columns, you need to set up the proper selection mode as follows: tableView->setSelectionMode(QAbstractItemView::MultiSelection); If you would like to do this programatically, this is the way of doing it: QModelIndexList itemSelection = tableView->selectionModel Apr 4, 2023 · When I use QItemSelectionModel to select multiple rows at the same time, my application will become very lag until the selection status of the QTableView is cleared. 20 moving the columns is getting very, very slow. Notes: D'n'd changes inside QTableView should be reflected in my model; D'n'd supposed to be internal - movement should be performed only inside my view, no external MIME exports; I want to drag and drop whole row. ui. This function was introduced in Qt 4. The view doesn't actually get those events, but its viewport() (and, since they're normally accepted, they are not propagated to the parent, the view); 2. -1 otherwise. Jul 15, 2021 · QTableView used to display records from database. 6. tableWidget->selectRow(2); you try to select third row, not the second one. But could not do that. The simple way that is not so good :) (and depends on Qt implementations as everything :): in the table view its horizontal header sectionPressed (int) is connected to table selectColumn (int), so you can simply disconnect them : ( (the same sure for vertical header) You can ipmlement the table view Mar 16, 2021 · I am developing an app, where user can select multiple (<=5) rows to preview. If the number of rows is under 20, while the others are hidden, performance is reasonable. through that objects rows and select the rows specified by rowV. If you want to whole row background color is same when clicking, you should do this after creating a QTableView: self. It assumes the cell with the smallest index will be placed Clicking on this button will select all the cells in the table view. [QTableWidgetItem] = QTableWidget. For example if i selected 3 rows in a column, there are 3 selectionRanges. And on the console is written 3 times Jul 22, 2013 · The problem I'm having is when I select a row, it deselects any columns that were selected, and same for column/rows. Jan 29, 2013 · I have a customized qtablemodel and a qtableview. qt. I then want to select the new row. The issue is that when I select a row, the background color of the complete row becomes the standard orange and the text color becomes white. 3. I have a QTableView as follows: 1 a1 b1 c1 2 a2 b2 c2 3 a3 b3 c3 I know how to get the item's text of the selected ones as a list. Qtableview operations on filtered sets. The goal is illustrated in this figure: What I tried, and what happens. isRowHidden (row) ¶ Parameters: row – int. QModelIndexList selectedRows ( int column = 0 ) const. when the number of rows it is supposed to display Nov 8, 2016 · In the python plugin, I'm developing, I need to retrieve the number of selected rows in a QTableWidget. But this just deleted a single row. Jun 13, 2016 · Deleting the First item will shift the remaining rows up, making row 1 and row 2 as row 0 and row 1 respectively, thus when you next delete row 1, row 2 (previously) will be deleted as it is now row 1. rows = {index. You need handle mouse click on view and manually change selection. I was just afraid I didn't search well the Mar 13, 2014 · And this works. Return type: int. myTable. Returns the column in which the given x-coordinate, x, in contents coordinates is located. QTableView has a function void QAbstractItemView::setItemDelegateForRow(int row, QAbstractItemDelegate * delegate). A somewhat shorter (but not much faster) alternative to the above would be: QTableWidget inherits the selectAll function from QAbstractItemView, so it's actually quite simple. – Gluttton. I assume you are using a QTableView You can override the QTableView and then use mouseMoveEvent cleverly to ensure that user can't make multiple selections by dragging! If user enters into mouseMoveEvent with the left mouse button pressed, you can choose to eat the event without passing it to the QTableView that will remove the possibility Feb 15, 2016 · I subclassed QTableView because in my case the table will react to left click, double click, and right click. Match TableName values with the key values in our TableDB. tableView->selectionModel()->selection() ); QList<int> rows; foreach( const QModelIndex & index, selection. QTableWidget inherits from QAbstractItemView, which gives you access to this special model. I have a solution to this: Pass rows you want to delete for example from 5 rows delete [0,3] def setSel(selected: List[int], table_widget Oct 30, 2013 · QTableView select single cell. Then you can use QClipboard. void QTableView:: setRowHidden (int row, bool hide) If hide is true row will be hidden, otherwise it will be shown. tv_model is a reference to the actual data of the table, emitting the following signal will update the data, or 'commit' it to the model, so to speak. def Aug 23, 2011 · I was able to hide them using setRowHidden(row,true) but i would like still to see them but not be able to select them. Instead of copying and pasting all the I selected, it only copies the first cell of the selected row or rows respectively. From QModelIndex to col and row. indexes(): if index. If the number of rows to be displayed is greater than approx. Here's what I'm doing: Feb 24, 2015 · You'll need to determine which rows to select. Return type: bool. This slot is called whenever rows are added or deleted. Karlson. I have a Application in which QWidget ,in which which is split into two parts QtreeWidget at left and QtableView with QAbstractTablemodel on the right . Not applicable. To copy and paste multiple items from qtableview created by qstandarditemmodel without considering rectangular form and by selecting non-contiguous row or column in C++ is. eyllanesc. Welcome to Qt Centre. To make it look and behave like a row-interaction-only table, you need to set these properties: allColumnsShowFocus = true (so you don't see the focus frame around a specific (column) item) Aug 8, 2017 · How to select QTableView row with one click. However, if I use Ctrl + A to select all rows of the QTableView, the application's performance will not be affected at all. QModelIndex next_index = table->model()->index(row + 1, 0); Then you can set that modelindex as the current one using. Oct 10, 2020 · Programmatically select multiple rows in Qtableview was written by Martin Fitzpatrick. The . setSelectionMode(QtGui. Oct 5, 2010 · 101. first(); Jun 4, 2023 · I'm dealing with a problem. On selection of any of these values in the drop-down, only the rows having that particular value in Jul 13, 2020 · If you want to forbid that, you must deal with that at the mouse-click level, ignoring that if it's in your "non-clickable" column. The default drag'n'drop behavior lets you drag, move and reorder only rows. Qt - item model/view - multiple data in one cell of QTableView. How would I programmatically select multiple ro Dec 9, 2010 · I have a QTableView and need more than one row selected. DisplayRole handler in a custom headerData method. I have also tried "MultiSelection" but still not getting it? *** Same command (QAbstractItemView. tableview. There are 2 ways. (btw, this was trivial with Qt5) Refer to this snippet in the documentation: https://doc. int QTableView::findRow(int col, QVariant data); it would return the (first) row number where data is present into column col. explicit AbonentsSqlModel(QObject *parent = 0); void setQuery(const QString &query, const QSqlDatabase &db = QSqlDatabase()); Oct 9, 2012 · 1 Solution. MatchFlags "flags" object which is what determines how we search. You already have the current row index, so use something like the following to get the modelindex for the next row. Convert the data to a string if it isn't already and concatenate each string together. Apr 6, 2013 · I had two rows in my table. This led me to believe, that the underlying data structure doesn't necessarily cause the slow performance May 17, 2021 · 6. There's a clearSelection() in the document but it stated QTableView ([ parent=None]) Constructs a table view with a parent to represent the data. append( index. Here is abonentstable. This model can tell you the selected rows as a list of QModelIndex, which can then tell you the row. Author. I want to select a row (not manually) in a QTableweidget. The Qt Documentation for rowCount() says, This property holds the number of rows in the table. static const KEY_COLUMN = 1; QList Jul 13, 2017 · My aim is simple as well: allow to move/reorder rows via drag'n'drop. ui->xvalue->selectAll(); } answered Dec 15, 2015 at 15:55. Sample. Now I want to do the other way around, one click to edit the cell and double click to select the row. This operates on the row index, so you need to remove rows from the bottom up to keep the row indices from shifting as you remove them. But still I cannot see it selecting/highlighting the second row. table-> verticalHeader() -> hide(); to get the vertical header and hide it, and. 4. QModelIndexList selectedIndexes () const. This is a low-level method that operates directly on the database and should not be called directly. Dec 27, 2013 · I can think about 2 ways to force tablewidget to render multi-line text: Setup QStyledItemDelegate item delegate and render text yourself in the delegates paint method. I have a QAbstractTableModel, and a QML TableView. See also isRowHidden() and setColumnHidden(). Feb 12, 2014 · QItemSelectionModel *select = tableview->selectionModel(); QItemSelctionModel has following calls to retrieve the list of QModelIndex. Use. " Users have asked for the ability to do "mass" (their word) operations, like firmware updates. Qt Code: Switch view. update of model causes update of View. A PySide. Jul 20, 2012 · I ended up using a QTreeView, which supports multiple columns (like a table). Goal. Qt QTableVew selecting multiple rows. column() == 0: indexes. The old height is specified by oldHeight, and the new height by newHeight. That is, the user can drag and drop one entire row, moving it up or down in the table to a different location in between two other rows. Oct 7, 2014 · 15. "background:rgb(135, 206, 255)}") Jun 23, 2017 · I am using this code to select a specific row in a tableView. 2012-10-09 02:36 AM. self. I will take a look at it but i don't want the user to be able to select multiple rows. The problem is. Starting with Tk, later moving to wxWidgets and finally adopting PyQt. Aug 19, 2016 · With this I can select the row with only one click, and double click to edit the cell of table. QTableView implements a table view that displays items from a model. What I want to do is that when a user selects a row, its foreground 2. QItemSelection selection( ui. QItemSelectionModel *select = _table->selectionModel(); QModelIndexList selectedRow = select->selectedRows(); QModelIndex index = selectedRow. indexes() ) {. answered Jan 21, 2021 at 8:33. Instead, Is there a straightforward way to get the selected rows count of a QTableWidget in PyQt? Something like: QTableWidget. But, as others pointed out, it would help if you provided more information. I want my script to automatically select rows in the other tables (based on the common field) if I select a row in the third table. Feb 6, 2022 · When user click one cell, there is a default backgroud which I see in my computer is blue. Oct 10, 2020 · I brought in the tables from pandas using the very useful tutorial on the subject (Display tables in PyQt5, QTableView with conditional formatting, numpy and pandas). int QTableView:: rowSpan ( int row, int column) const. This means that the first click will select the row and the second click will unselect the row. I am working with a QTableView and trying to retrieve values from the selected row (s). view. viewClicked) 3. tableView5. 1. Separate items should not be dragged or dropped; Apr 19, 2015 · The Qt documentation has a good example. This property is true by default. QAbstractItemView. Hope, It will usefull to you guys. But I need the full row of those selected items. setStyleSheet("QTableView::item:selected{". tableview=QTableView() self. rowHeight (row) # Parameters: row – int. There is a selectall button ,When I selectall button , it should select all the rows in QtableView and emit relevant selection. Mar 13, 2012 · 19. selectedRowsCount() Jul 29, 2015 · I have set the selection behavior to select entire row. I have used "ExtendedSelection" as a Selection Mode to select the multiple cells in the TableView but I am not able to select the multiple cells. Feb 10, 2020 · An interesting extension here is to use the table header of the QTableView to display row and pandas column header values, which can be taken from DataFrame. void QTableView:: setRowHeight (int row, int height) Sets the height of the given row to be height. See also columnResized(). tv_model. So there are two specific questions that I have: How to convert a cell selection to a row selection? Jun 17, 2016 · Step-1: Open documentation for QTableWidget. {. selects one row olny, and. Jul 4, 2011 · I have to display a chunk of data in a QTableView and filter it column wise. Without subclassing, with the given signal slots if I implement QWidget::customContextMenuRequested and QAbstractItemView::clicked then if I right click it emits the click() signal as well. Sep 15, 2021 · I am displaying a dataframe in GUI using QTableView in Pyqt5. tableWidget->selectRow(1); Jan 17, 2015 · 15. The model also has a timer attached to it, which upon expiring, gets the number of rows and columns, constructs an index for it, and emits dataChanged signal, to update the dynamic contents of the table. Check attached. When one of the QTableView 's QModelIndex is clicked I want to select an entire row of the same-row-indexes. I am not sure if I am missing something. You may also want to specify the selection mode. Once I have populated a QTableWidget with Jan 14, 2010 · myTableView->selectionModel()->selectedRows(); You can then retrieve this informations through a signal like : void QItemSelectionModel::selectionChanged ( const QItemSelection & selected, const QItemSelection & deselected ) [signal] Hope it helps ! answered Jan 14, 2010 at 9:29. When i click on the merged cell, i get what i Oct 6, 2015 · 4. But when I drag the mouse over the multiple items, mouse cursor moves on last item without selecting multiple items. remove (row); endRemoveRows (); } I think what happen was that the currentIndex was not cleared after the first remove call, so when I called remove again, it removed the new row that took place of the index. MultiSelection) The code below works, but only when the first row is selected. 2. selectedIndexes()} output = [] Jan 21, 2021 · 0. yv kf kc wy wq gj gm ku mk ej