mirror of
https://github.com/OpenMW/openmw.git
synced 2025-05-11 22:11:26 +00:00
enhanced SceneToolBar tool handling (remove and insert at specific point)
This commit is contained in:
parent
29c9b6bd01
commit
bf40a3bb5d
2 changed files with 18 additions and 3 deletions
|
@ -31,9 +31,20 @@ CSVWidget::SceneToolbar::SceneToolbar (int buttonSize, QWidget *parent)
|
||||||
connect (focusScene, SIGNAL (activated()), this, SIGNAL (focusSceneRequest()));
|
connect (focusScene, SIGNAL (activated()), this, SIGNAL (focusSceneRequest()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWidget::SceneToolbar::addTool (SceneTool *tool)
|
void CSVWidget::SceneToolbar::addTool (SceneTool *tool, SceneTool *insertPoint)
|
||||||
{
|
{
|
||||||
|
if (!insertPoint)
|
||||||
mLayout->addWidget (tool, 0, Qt::AlignTop);
|
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
|
int CSVWidget::SceneToolbar::getButtonSize() const
|
||||||
|
|
|
@ -25,7 +25,11 @@ namespace CSVWidget
|
||||||
|
|
||||||
SceneToolbar (int buttonSize, QWidget *parent = 0);
|
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;
|
int getButtonSize() const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue