qabstractitemview

Copy/Paste multiple items from QTableView in pyqt4?

谁说我不能喝 提交于 2020-01-27 08:33:14
问题 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, self.File_Name) self.tableView = QtGui.QTableView(tab_table_view) self.tableView.setGeometry(QtCore

Copy/Paste multiple items from QTableView in pyqt4?

一曲冷凌霜 提交于 2020-01-27 08:32:24
问题 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, self.File_Name) self.tableView = QtGui.QTableView(tab_table_view) self.tableView.setGeometry(QtCore

How to loop over QAbstractItemView indexes?

不问归期 提交于 2020-01-13 03:00:31
问题 I want to fire QAbstractItemView::doubleClicked slot programaticaly for an item that has specific text. I want to do this using QAbstractItemView class and not it's implementations if possible. This task boils down to looping over items and comparing strings. But I cannot find any method that would give me all QModelIndex es. The only method that gives any QModelIndex without parameters is QAbstractItemView::rootIndex . But when I look into QModelIndex docs, I again cannot see a way to access

QComboBox with checkboxes

给你一囗甜甜゛ 提交于 2019-12-29 07:52:07
问题 I'm creating QComboBox with checkboxes. How I can prevent collapsing of view on mouse clicking? I want to be able to set up checkboxes, but each time I click on item - drop-down of QComboBox is collapsed. Note: currently I'm debugging Qt sources and looking for workaround... 回答1: First of all you need to install an event filter to the combo box view, i.e.: combobox->view()->viewport()->installEventFilter(someobj); than you need to filter all mouse release events that happen on the combo box

How to get list of visible QModelIndex in QAbstractItemView

旧城冷巷雨未停 提交于 2019-12-23 09:43:12
问题 Is there any way to get a list of currently visible items in QAbstractItemView ? And, if it possible, to receive any notifications about changing of this list. Upd: I'm asking exactly about QAbstractItemView or QTreeView with non-plain structure, not QTableView . Upd2: I'm implementing tree view model with checkboxes. I want next behavior (same for checking/uncheking): If one of checkbox is checked - then all childs must be checked If all child checkboxes are checked - then parent check box

How to keep an item view scrolled to the bottom when items are added?

心不动则不痛 提交于 2019-12-12 21:16:29
问题 When appending items at the end of a model shown by a QAbstractItemView , I wish to keep the view at the bottom of the data, showing the most recent added items. The default behavior is to retain the most recently displayed item's position, but not to scroll if we were at the bottom. What would be the magic needed to keep the view at the bottom if the user has previously scrolled it all the way to the bottom? 回答1: QListView view; bool viewAtBottom = false; Before an item is added, check if

How to Copy - Paste Multiple Items form QTableView created by QStandardItemModel to a text/excel file?

你说的曾经没有我的故事 提交于 2019-11-30 09:44:38
问题 How can I copy and paste multiple items/values of a QTableView to a text/ excel file? My Code: tab_table_view = QtGui.QWidget() self.Tab.insertTab(0, tab_table_view, self.File_Name) self.tableView = QtGui.QTableView(tab_table_view) self.tableView.setGeometry(QtCore.QRect(0, 0, 721, 571)) self.model = QtGui.QStandardItemModel(self) self.tableView.setSelectionMode(QAbstractItemView.ExtendedSelection This line self.tableView.setSelectionMode(QAbstractItemView.ExtendedSelection helps with

How to Copy - Paste Multiple Items form QTableView created by QStandardItemModel to a text/excel file?

*爱你&永不变心* 提交于 2019-11-29 16:52:32
How can I copy and paste multiple items/values of a QTableView to a text/ excel file? My Code: tab_table_view = QtGui.QWidget() self.Tab.insertTab(0, tab_table_view, self.File_Name) self.tableView = QtGui.QTableView(tab_table_view) self.tableView.setGeometry(QtCore.QRect(0, 0, 721, 571)) self.model = QtGui.QStandardItemModel(self) self.tableView.setSelectionMode(QAbstractItemView.ExtendedSelection This line self.tableView.setSelectionMode(QAbstractItemView.ExtendedSelection helps with selecting multiple items in QTableView but when I do CTRL + C and paste it only pastes the last item or value

Copy/Paste multiple items from QTableView in pyqt4?

梦想与她 提交于 2019-11-29 12:47:01
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, self.File_Name) self.tableView = QtGui.QTableView(tab_table_view) self.tableView.setGeometry(QtCore.QRect(0, 0, 721, 571)) self.model = QtGui.QStandardItemModel(self) self.model.setSortRole(QtCore.Qt

QComboBox with checkboxes

与世无争的帅哥 提交于 2019-11-29 11:14:13
I'm creating QComboBox with checkboxes. How I can prevent collapsing of view on mouse clicking? I want to be able to set up checkboxes, but each time I click on item - drop-down of QComboBox is collapsed. Note: currently I'm debugging Qt sources and looking for workaround... First of all you need to install an event filter to the combo box view, i.e.: combobox->view()->viewport()->installEventFilter(someobj); than you need to filter all mouse release events that happen on the combo box view to prevent its closing when you click on it: bool SomeObject::eventFilter(QObject *obj, QEvent *event) {