Hello,
I have a problem with painting pushbutton with icon in delegate. The problem is that when I pain Icon with pushbutton left margin/"left position value" is set to 0 = left side of the column in view, but when I don't paint Icon everything is good and I can set left margin to some other value i.e. 10 (with is equal to left value of the CE_PushButton).
The painting looks like this:
pb_Style.state = option.state;
pb_Style.rect = option.rect;
// pb_Style.icon = QIcon( ":/icon.png" );
// pb_Style.iconSize = QSize( 12, 12 );
/** when Icon is drawn delegate calculate wrong left pos with is equal to the row left */
QStyleOptionButton pb_Style;
pb_Style.state = option.state;
pb_Style.rect = option.rect;
// pb_Style.icon = QIcon( ":/icon.png" );
// pb_Style.iconSize = QSize( 12, 12 );
/** when Icon is drawn delegate calculate wrong left pos with is equal to the row left */
QApplication::style()->drawControl( QStyle::CE_PushButton, &pb_Style, painter );
To copy to clipboard, switch view to plain text mode
The result is this: deleg.JPG , icon is painted all the way to the left row pos, but what I want is to paint it to left pos of the pushbutton (CE_PushButton).
The problem is probably that I don't pas rect for the Icon properly but...
Thanks for any help
Bookmarks