0

I'm currently starting a little program in python and pyqt. I have little to no experience on GUI programming but I need a table to present some items (like one in this website HERE ). I was wondering if there was any way to do this in pyqt (qtquick would be better) .

I know there is qtableview in pyqt but I need to make it look like an html table. Can Qtableview be made to look like a CSS style HTML table?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Dinesh Khadka
  • 67
  • 1
  • 3
  • 10
  • How do you mean you want it to look like a HTML table? With the right CSS an HTML table can look like anything. –  Jun 16 '14 at 05:03

1 Answers1

1

Since QTableViews inherit from QWidgets you can just use the setStyleSheet method to override any default styles for the table.

Depending on how you want to style the table specifically, you'll definitely want to review the Qt Style Syntax.

As per the comment, if you just want to disable sorting call yourTable.setSortingEnabled(False), and call yourTable.verticalHeader().setMovable(False) (or horizontalHeader) to disable moving the headers, when creating the table.

  • If I could remove the sorting and moving ability from it, that might just do the trick. Is it possible? – Dinesh Khadka Jun 16 '14 at 05:27
  • I think that'll do it. Thanks, I missed to notice them in the docs. Thanks again – Dinesh Khadka Jun 16 '14 at 05:53
  • Thats perfectly fine, the PyQt docs can be sparse at times, and I find it is a bit counter intuitive that disabling moving of rows/columns is on the headers, and not the table itself. –  Jun 16 '14 at 05:54