View Full Version : Flat Icon in a QToolBar
schall_l
22nd June 2009, 16:43
I am using a QToolbar in a frame where I would like to display the icons in a flat mode. I did not found what I have to set for getting the flat representation.
If someone has an idea...
Lykurg
22nd June 2009, 17:03
Set the QToolButtons flat.
EDIT: Too fast, only QPushButton can be set flat. So you could set css "border:0;" to the QToolButton with the same effect.
shentian
22nd June 2009, 18:16
Set QToolButton::autoRise to true. It causes the ToolButton to be flat and only raise when the mouse hovers over it.
schall_l
23rd June 2009, 08:42
What I am currently doing is:
- create the action
- add the action to the toolBar by using the addAction method
Is there a way to access the QToolButton that is created automatically when the action is added to the toolbar with QToolBar::addAction() ?
Or should I:
- create the action
- create the toolButton
- set the default action of the toolButton
- add the toolButton to the toolBar
nish
23rd June 2009, 08:48
u can use
QAction * QToolBar::addWidget ( QWidget * widget )
to set a pushbutton..(for setFlat())
is there a way to access the QToolButton that is created automatically when the action is added to the toolbar with QToolBar::addAction() ?
QWidget * widgetForAction ( QAction * action ) const
schall_l
23rd June 2009, 09:10
The following code did not change the way it is presented.
void
TitleFrame::addAction ( QAction * action ){
if (m_useToolbar) {
m_toolbar->addAction(action);
QToolButton* toolButton = (QToolButton*)m_toolbar->widgetForAction(action);
toolButton->setAutoRaise(true);
}
}
So I guess what I am seeing could be just the border for the entire QToolBar widget ?
nish
23rd June 2009, 09:15
So I guess what I am seeing could be just the border for the entire QToolBar widget ?
test it by adding few more widgets like combobox
schall_l
23rd June 2009, 09:19
Mmmm. Ok it is is the border of the entire QToolBar I was seeing.
Now I am looking how to remove this one.
schall_l
23rd June 2009, 09:31
Ok, I was able to remove the border with the following CSS rule:
QToolBar {
border: 0px;
}
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.