enhanced SceneToolBar tool handling (remove and insert at specific point)

loadfix
Marc Zinnschlag 10 years ago
parent 29c9b6bd01
commit bf40a3bb5d

@ -31,9 +31,20 @@ CSVWidget::SceneToolbar::SceneToolbar (int buttonSize, QWidget *parent)
connect (focusScene, SIGNAL (activated()), this, SIGNAL (focusSceneRequest()));
}
void CSVWidget::SceneToolbar::addTool (SceneTool *tool)
void CSVWidget::SceneToolbar::addTool (SceneTool *tool, SceneTool *insertPoint)
{
mLayout->addWidget (tool, 0, Qt::AlignTop);
if (!insertPoint)
mLayout->addWidget (tool, 0, Qt::AlignTop);
else
{
int index = mLayout->indexOf (insertPoint);
mLayout->insertWidget (index+1, tool, 0, Qt::AlignTop);
}
}
void CSVWidget::SceneToolbar::removeTool (SceneTool *tool)
{
mLayout->removeWidget (tool);
}
int CSVWidget::SceneToolbar::getButtonSize() const

@ -25,7 +25,11 @@ namespace CSVWidget
SceneToolbar (int buttonSize, QWidget *parent = 0);
void addTool (SceneTool *tool);
/// If insertPoint==0, insert \a tool at the end of the scrollbar. Otherwise
/// insert tool after \a insertPoint.
void addTool (SceneTool *tool, SceneTool *insertPoint = 0);
void removeTool (SceneTool *tool);
int getButtonSize() const;

Loading…
Cancel
Save