qtableview

How to display a Pandas data frame with PyQt5

早过忘川 提交于 2019-11-26 22:25:32
I have a problem with the line below self.tableView.set??????????(df) that supposed to display the data frame in PyQt5. I put ??? there where I am missing the code I need. def btn_clk(self): path = self.lineEdit.text() df = pd.read_csv(path) self.tableView.set??????????(df) The rest of the code works, because if I use print(df) in the above code, the data frame is printed in the IPython console. So, Pandas reads the CSV and prints it. But, I tried many things to get it displayed in PyQt5 and nothing works. I am not very familiar with PyQt, just started to play around with it and I am stuck

How to set stylesheet for the current item in QTableView

爷,独闯天下 提交于 2019-11-26 18:27:27
问题 When QTableView edit control is visible for the current item the shylesheet of the edit takes place. When there is no active edit control in the QTableView the current item is styled using the QTableView { selection-background-color: } How to set different style only for the current item? 回答1: Qt style sheets support sub-controls and pseudo states, you can use it to improve your customization. (see http://qt-project.org/doc/qt-5/stylesheet-reference.html#list-of-pseudo-states ) In this case

paintEvent in QTableView derived class: Paint device returned engine == 0, type: 1

偶尔善良 提交于 2019-11-26 14:48:36
问题 As a follow up of Qt load indicator by animated image (aka preloader) or alternative? I try to paint inside a QTableView . But when I initialize the QPainter I get the following warnings. QWidget::paintEngine: Should no longer be called QPainter::begin: Paint device returned engine == 0, type: 1 Here is the code (SO answer, with a button it seems to work): void CDerivedFromQTableView::paintEvent(QPaintEvent *event) { QTableView::paintEvent(event); // draw original content QPainter p(this); //