make buttons in mode panel act like radiobuttons

pull/182/head
Marc Zinnschlag 11 years ago
parent dd0aa20390
commit 50ee815dd8

@ -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

@ -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);
}

Loading…
Cancel
Save