2014-07-10 09:03:55 +00:00
|
|
|
|
|
|
|
#include "pushbutton.hpp"
|
|
|
|
|
|
|
|
#include <QMouseEvent>
|
|
|
|
#include <QKeyEvent>
|
|
|
|
|
|
|
|
void CSVWidget::PushButton::keyPressEvent (QKeyEvent *event)
|
|
|
|
{
|
|
|
|
if (event->key()!=Qt::Key_Shift)
|
|
|
|
mKeepOpen = false;
|
|
|
|
|
|
|
|
QPushButton::keyPressEvent (event);
|
|
|
|
}
|
|
|
|
|
2014-07-10 09:32:20 +00:00
|
|
|
void CSVWidget::PushButton::keyReleaseEvent (QKeyEvent *event)
|
|
|
|
{
|
|
|
|
if (event->key()==Qt::Key_Return || event->key()==Qt::Key_Enter)
|
|
|
|
{
|
|
|
|
mKeepOpen = event->modifiers() & Qt::ShiftModifier;
|
|
|
|
emit clicked();
|
|
|
|
}
|
|
|
|
|
|
|
|
QPushButton::keyReleaseEvent (event);
|
|
|
|
}
|
|
|
|
|
2014-07-10 09:03:55 +00:00
|
|
|
void CSVWidget::PushButton::mouseReleaseEvent (QMouseEvent *event)
|
|
|
|
{
|
|
|
|
mKeepOpen = event->button()==Qt::LeftButton && (event->modifiers() & Qt::ShiftModifier);
|
|
|
|
QPushButton::mouseReleaseEvent (event);
|
|
|
|
}
|
|
|
|
|
2014-07-10 09:34:09 +00:00
|
|
|
CSVWidget::PushButton::PushButton (const QIcon& icon, QWidget *parent)
|
|
|
|
: QPushButton (icon, "", parent), mKeepOpen (false)
|
2014-07-10 09:03:55 +00:00
|
|
|
{
|
2014-07-10 09:23:48 +00:00
|
|
|
setCheckable (true);
|
2014-07-10 09:03:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CSVWidget::PushButton::hasKeepOpen() const
|
|
|
|
{
|
|
|
|
return mKeepOpen;
|
|
|
|
}
|