Commit 3c593714 by Sebastian Eichelbaum

[CHANGE] - removed the dummyButton crap. Set minimum width and height of the…

[CHANGE] - removed the dummyButton crap. Set minimum width and height of the toolbars to reserve space even if they are empty
parent 3b9f3532
......@@ -46,6 +46,9 @@ WQtCombinerToolbar::WQtCombinerToolbar( WMainWindow* parent, const WQtCombinerAc
setAllowedAreas( Qt::AllToolBarAreas );
setObjectName( QString( "Compatible Modules" ) );
setMinimumWidth( 50 );
setMinimumHeight( 30 );
// this sets the toolbar style
int compToolBarStyle = parent->getToolbarStyle(); // this defaults to the global toolbar style
WPreferences::getPreference( "qt4gui.compatiblesToolBarStyle", &compToolBarStyle );
......@@ -59,7 +62,6 @@ WQtCombinerToolbar::WQtCombinerToolbar( WMainWindow* parent, const WQtCombinerAc
// create the list of actions possible
addActions( compatibles );
insertDummyButton();
}
WQtCombinerToolbar::WQtCombinerToolbar( WMainWindow* parent )
......@@ -79,9 +81,6 @@ WQtCombinerToolbar::WQtCombinerToolbar( WMainWindow* parent )
// cast and set
setToolButtonStyle( static_cast< Qt::ToolButtonStyle >( compToolBarStyle ) );
// reserve size
insertDummyButton();
}
WQtCombinerToolbar::~WQtCombinerToolbar()
......@@ -91,23 +90,11 @@ WQtCombinerToolbar::~WQtCombinerToolbar()
void WQtCombinerToolbar::makeEmpty()
{
clear();
insertDummyButton();
}
void WQtCombinerToolbar::updateButtons( const WQtCombinerActionList& compatibles )
{
clear();
addActions( compatibles );
insertDummyButton();
}
void WQtCombinerToolbar::insertDummyButton()
{
// this is needed to ensure a constant height or width (if toolbar is in vertical mode). We use a label as an empty label has no graphical
// representation. The width and height are set both because we do not know a priori how the toolbar is oriented as it might change after
// creation.
QLabel* dummy = new QLabel;
dummy->setFixedWidth( 50 );
dummy->setFixedHeight( 30 );
addWidget( dummy );
}
......@@ -73,13 +73,7 @@ public:
void makeEmpty();
protected:
private:
/**
* Insert dummy button so that the toolbar is not hidden.
*/
void insertDummyButton();
WMainWindow* m_parent; //!< The widget managing this widget.
};
......
......@@ -35,10 +35,8 @@ WQtToolBar::WQtToolBar( const QString & title, QWidget* parent )
this->setAllowedAreas( Qt::AllToolBarAreas );
// The following makes the bar having button size from the beginning.
QPushButton* dummyButton = new QPushButton;
dummyButton->setFixedWidth( 0 );
addWidget( dummyButton );
setMinimumWidth( 50 );
setMinimumHeight( 30 );
}
WQtToolBar::~WQtToolBar()
......@@ -79,9 +77,5 @@ void WQtToolBar::clearButtons()
// clear the lists
m_widgets.clear();
// The following prevents the bar from changing size when it has no real buttons.
QPushButton* dummyButton = new QPushButton;
dummyButton->setFixedWidth( 0 );
addWidget( dummyButton );
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment