make buttons in mode panel act like radiobuttons

This commit is contained in:
Marc Zinnschlag 2014-07-10 11:23:48 +02:00
parent dd0aa20390
commit 50ee815dd8
2 changed files with 8 additions and 0 deletions

View file

@ -21,6 +21,7 @@ void CSVWidget::PushButton::mouseReleaseEvent (QMouseEvent *event)
CSVWidget::PushButton::PushButton (const QIcon& icon, const QString& text, QWidget *parent)
: QPushButton (icon, text, parent), mKeepOpen (false)
{
setCheckable (true);
}
bool CSVWidget::PushButton::hasKeepOpen() const

View file

@ -40,7 +40,10 @@ void CSVWidget::SceneToolMode::addButton (const std::string& icon, const std::st
connect (button, SIGNAL (clicked()), this, SLOT (selected()));
if (mButtons.size()==1)
{
setIcon (button->icon());
button->setChecked (true);
}
}
void CSVWidget::SceneToolMode::selected()
@ -53,6 +56,10 @@ void CSVWidget::SceneToolMode::selected()
if (!iter->first->hasKeepOpen())
mPanel->hide();
for (std::map<PushButton *, std::string>::const_iterator iter2 = mButtons.begin();
iter2!=mButtons.end(); ++iter2)
iter2->first->setChecked (iter2==iter);
setIcon (iter->first->icon());
emit modeChanged (iter->second);
}