Hello,
I struggle with painting QPushButton with inherited styleSheet in custom delegate.
Delegate parent is TreeView with styleSheet.
The way I paint it in my QStyledItemDelegate.
{
pb_Style.
state |
= QStyle::State_Raised |
QStyle::State_Enabled | option.
state;
QRect pbRect
= option.
rect;
...
pb_Style.rect = pbRect;
style
->drawControl
(QStyle::CE_PushButton,
&pb_Style, painter, qobject_cast<QWidget
*>
(this
->parent
()) );
}
void Delegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QStyleOptionButton pb_Style;
pb_Style.state |= QStyle::State_Raised | QStyle::State_Enabled | option.state;
QRect pbRect = option.rect;
...
pb_Style.rect = pbRect;
pb_Style.text = QString();
style->drawControl(QStyle::CE_PushButton, &pb_Style, painter, qobject_cast<QWidget *>(this->parent()) );
}
To copy to clipboard, switch view to plain text mode
In short I don't know how to paint QPushButton with inherited styleSheet from the view.
Any suggestions are more then welcome.
Bookmarks