1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-21 12:39:41 +00:00

added push mode and icon-less push button constructor

This commit is contained in:
Marc Zinnschlag 2014-07-10 11:44:01 +02:00
parent 8b239df1b1
commit 44b95bbd7b
3 changed files with 14 additions and 4 deletions

View file

@ -29,10 +29,16 @@ void CSVWidget::PushButton::mouseReleaseEvent (QMouseEvent *event)
QPushButton::mouseReleaseEvent (event);
}
CSVWidget::PushButton::PushButton (const QIcon& icon, QWidget *parent)
CSVWidget::PushButton::PushButton (const QIcon& icon, bool push, QWidget *parent)
: QPushButton (icon, "", parent), mKeepOpen (false)
{
setCheckable (true);
setCheckable (!push);
}
CSVWidget::PushButton::PushButton (bool push, QWidget *parent)
: QPushButton (parent), mKeepOpen (false)
{
setCheckable (!push);
}
bool CSVWidget::PushButton::hasKeepOpen() const

View file

@ -21,7 +21,11 @@ namespace CSVWidget
public:
PushButton (const QIcon& icon, QWidget *parent = 0);
/// \param push Do not maintain a toggle state
PushButton (const QIcon& icon, bool push = false, QWidget *parent = 0);
/// \param push Do not maintain a toggle state
PushButton (bool push = false, QWidget *parent = 0);
bool hasKeepOpen() const;
};

View file

@ -28,7 +28,7 @@ void CSVWidget::SceneToolMode::showPanel (const QPoint& position)
void CSVWidget::SceneToolMode::addButton (const std::string& icon, const std::string& id)
{
PushButton *button = new PushButton (QIcon (QPixmap (icon.c_str())), mPanel);
PushButton *button = new PushButton (QIcon (QPixmap (icon.c_str())), false, mPanel);
button->setSizePolicy (QSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed));
button->setIconSize (QSize (mIconSize, mIconSize));
button->setFixedSize (mButtonSize, mButtonSize);