Jump to content

RichardF

Members
  • Content count

    3
  • Joined

  • Last visited

Community Reputation

0 Neutral

About RichardF

  • Rank
    Peon

Personal Information

  • Name
    Richard Frangenberg
  • Location
    Germany
  1. PySide set Color of cells in QTableView

    QTableWidget might work, but i'm using multiple QTableViews already and i would have to rewrite a lot of code in order to switch to QTableWidget. Parenting the window has many advantages, which i don't want to miss, but I found a workaround which worked in my case: I want to have a colored cell without any text in it. I can't set the background color of the cells, but setting the foreground color (color of the text in the cell) is no problem. So i set the text of the cell to ascii char 219 ( █ ), increased the font size and set the foreground color. Now it looks like a cell with a colored background. That works fine in my case. Thanks for your reply.
  2. PySide set Color of cells in QTableView

    Yes i tried it, but it seems that it is only possible to set the stylesheet of all items or the selected item, but not of some specific items. In my case i want to color the first column of my QTableView, but i haven´t found a solution for that with qss.
  3. Hello everyone, i´m writing a tool in Pyside and i can´t figure out how to set the color of the individual cells in a QTableView. Here is an example, which demonstrates the problem: from PySide import QtCore, QtGui import hou class cellColor(QtGui.QDialog): def __init__(self): QtGui.QDialog.__init__(self) self.resize(297, 174) self.verticalLayout = QtGui.QVBoxLayout(self) self.tableview = QtGui.QTableView(self) self.verticalLayout.addWidget(self.tableview) # without parenting the ui to houdini, i can set the cell colors self.setParent(hou.ui.mainQtWindow(), QtCore.Qt.Window) model = QtGui.QStandardItemModel() item1 = QtGui.QStandardItem("Color Red") item1.setBackground(QtGui.QColor(240,10,10)) item2 = QtGui.QStandardItem("Color Green") item2.setBackground(QtGui.QColor(10,240,10)) model.appendRow([item1,item2]) self.tableview.setModel(model) testwindow = cellColor() testwindow.show() testwindow = cellColor() testwindow.show() Is there a way to set the color of the cells, when the window is parented to Houdini? Thanks for all replies
×