> Sent: Thursday, December 07, 2017 at 1:10 AM > From: "André Somers" <an...@familiesomers.nl> > To: interest@qt-project.org > Subject: Re: [Interest] Change QCheckBox to QPushButton in a QTableView > ... > > > > But all I got out of it was a black pixel in the first cell. > > You're going to have to do a proper initialization of the > QStyleOptionButton. At the very least, set the rect it is supposed to be > drawn in. You can copy that information from the QStyleOptionViewItem. > You will need to set the checked state from there as well.
But the QStyleOptionButton() class only defines: * ButtonFeatures features * QIcon icon * QSize iconSize * QString text And Inherits: * Qt::LayoutDirection direction * QFontMetrics fontMetrics * QPalette palette * QRect rect * QStyle::State state * QObject *styleObject * int type * int version In addition QStyle::State does not have a check state - it's not that kind of state apparently. I added an assignment of QStypeOptionButton rect from options, and that now shows the text, but the rest of the button is not rendered (Attached). If I use a pushbutton to initialize options I've got to subclass it because initStypeOptions is protected (why?), won't I overwrite the supplied options and then have to merge them back in, how do I know what needs to be preserved from the original options? This whole system seems backwards. My delegate doesn't have a pointer to a widget does it? This whole setup seems backwards, which is unusual for me with Qt. I can get behind the idea of being passed a painter and rect to render into, but the rest of the API seems like it's making a main use-case extremely difficult. Which usually isn't the case with Qt, so it makes me think I'm doing something very wrong.
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest