Hi everyone,
Is it possible to place icon and text on center ?
code:
Code:
setIcon(icon); setText(text); setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
If possible please help me.
Thanks
Bibhu.
Printable View
Hi everyone,
Is it possible to place icon and text on center ?
code:
Code:
setIcon(icon); setText(text); setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
If possible please help me.
Thanks
Bibhu.
You mean on top of each other?
Cheers,
_
Thanks for reply.
No, side by side but in the middle(center) like for only text or icon
I am afraid I don't understand.
The text is already centered on the other axis, no?
I.e. if you set the text beside the icon, its vertical center is the same as the icon's vertical center, right?
Maybe you can do a screenshot of what you get and indicate what you would like to get?
Cheers,
_
Ohhh. I am really sorry.
Center means both vertical and horizontal.
Now it is vertically in center but horizontally in left.(Qt::AlignHCente | Qt::AlignVCenter or Qt::AlignCenter )
Thanks.
If you center both items (icon and text) in both axis, then they are on top of each other.
Which I asked you about already and you said you didn't want to have.
So I am afraid words won't get us any further, we seem to have a different interpretation of what the center of an area is.
Cheers,
_
I want to put the combination of icon and text in the center but they should be placed side by side.
I was trying:
If in a widget some buttons are vertically present then it will appear in the center(If button background is transperent).
You can try doing the horizontal alignment using a stylesheet, but you probably have to implement a QStyle proxy and reimplement drawControl() for QStyle::CE_ToolButtonLabel
Or derive from QToolButton, overwrite paintEvent() and call the style for everything other than the label.
Cheers,
_