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); 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) : 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 bool CSVWidget::PushButton::hasKeepOpen() const

View File

@ -21,7 +21,11 @@ namespace CSVWidget
public: 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; 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) 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->setSizePolicy (QSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed));
button->setIconSize (QSize (mIconSize, mIconSize)); button->setIconSize (QSize (mIconSize, mIconSize));
button->setFixedSize (mButtonSize, mButtonSize); button->setFixedSize (mButtonSize, mButtonSize);