qtableview

How to get cell value from selected row (QTableView)?

可紊 提交于 2020-08-24 07:18:51
问题 I have a QTableView and I need to the get value (string) from the first cell of the selected row (any cell on the row could be selected). But I need this value only if exactly one row was selected . I thought - I need to get index of the selected row and then get the value of the first сell on that line, but I couldn't find a way to do it. 回答1: myTableView->selectionModel()->currentIndex().row() Will give you the index of the currently selected row. From there you should have enough

Synchronize pandas DataFrame with PyQt5 QTableView

ⅰ亾dé卋堺 提交于 2020-07-23 06:51:05
问题 I have an editable QTableView which reads the values from a pandas DataFrame . What I'm looking for is that when I change the value of one cell, the pandas DataFrame synchronizes automatically. The aim is to continue operating with the updated DataFrame , for example, to update the values of the other rows of the DataFrame and refresh the QTableView . I've seen that there are similar questions in the forum, but since MVC is new to me and I'm not a professional programmer, I find it hard to

Synchronize pandas DataFrame with PyQt5 QTableView

这一生的挚爱 提交于 2020-07-23 06:50:16
问题 I have an editable QTableView which reads the values from a pandas DataFrame . What I'm looking for is that when I change the value of one cell, the pandas DataFrame synchronizes automatically. The aim is to continue operating with the updated DataFrame , for example, to update the values of the other rows of the DataFrame and refresh the QTableView . I've seen that there are similar questions in the forum, but since MVC is new to me and I'm not a professional programmer, I find it hard to

Synchronize pandas DataFrame with PyQt5 QTableView

别说谁变了你拦得住时间么 提交于 2020-07-23 06:49:22
问题 I have an editable QTableView which reads the values from a pandas DataFrame . What I'm looking for is that when I change the value of one cell, the pandas DataFrame synchronizes automatically. The aim is to continue operating with the updated DataFrame , for example, to update the values of the other rows of the DataFrame and refresh the QTableView . I've seen that there are similar questions in the forum, but since MVC is new to me and I'm not a professional programmer, I find it hard to

How to get QTableView right clicked index

感情迁移 提交于 2020-06-23 09:51:32
问题 The code below creates a single dialog with a QTableView view. On left-click the onLeftClick function gets an QModelIndex index . This QModelIndex is used later to print the row and column numbers of the left-clicked cell. How to get the QModelIndex index of the cell that was right-clicked? from PyQt5.QtGui import * from PyQt5.QtWidgets import * from PyQt5.QtCore import * app = QApplication([]) class Dialog(QDialog): def __init__(self, parent=None): super(Dialog, self).__init__(parent) self

How do I resize rows with setRowHeight and resizeRowToContents in PyQt4?

一个人想着一个人 提交于 2020-05-16 02:29:17
问题 I have a small issue with proper resizing of rows in my tableview. I have a vertical header and no horizontal header. I tried: self.Popup.table.setModel(notesTableModel(datainput)) self.Popup.table.horizontalHeader().setVisible(False) self.Popup.table.verticalHeader().setFixedWidth(200) for n in xrange(self.Popup.table.model().columnCount()): self.Popup.table.setColumnWidth(n,150) And this works fine, but when I try: for n in xrange(self.Popup.table.model().rowCount()): self.Popup.table