forked from teamnwah/openmw-tes3coop
make buttons in mode panel act like radiobuttons
This commit is contained in:
parent
dd0aa20390
commit
50ee815dd8
2 changed files with 8 additions and 0 deletions
|
@ -21,6 +21,7 @@ void CSVWidget::PushButton::mouseReleaseEvent (QMouseEvent *event)
|
||||||
CSVWidget::PushButton::PushButton (const QIcon& icon, const QString& text, QWidget *parent)
|
CSVWidget::PushButton::PushButton (const QIcon& icon, const QString& text, QWidget *parent)
|
||||||
: QPushButton (icon, text, parent), mKeepOpen (false)
|
: QPushButton (icon, text, parent), mKeepOpen (false)
|
||||||
{
|
{
|
||||||
|
setCheckable (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSVWidget::PushButton::hasKeepOpen() const
|
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()));
|
connect (button, SIGNAL (clicked()), this, SLOT (selected()));
|
||||||
|
|
||||||
if (mButtons.size()==1)
|
if (mButtons.size()==1)
|
||||||
|
{
|
||||||
setIcon (button->icon());
|
setIcon (button->icon());
|
||||||
|
button->setChecked (true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWidget::SceneToolMode::selected()
|
void CSVWidget::SceneToolMode::selected()
|
||||||
|
@ -53,6 +56,10 @@ void CSVWidget::SceneToolMode::selected()
|
||||||
if (!iter->first->hasKeepOpen())
|
if (!iter->first->hasKeepOpen())
|
||||||
mPanel->hide();
|
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());
|
setIcon (iter->first->icon());
|
||||||
emit modeChanged (iter->second);
|
emit modeChanged (iter->second);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue