removed the (partial broken) return/enter shortcut for custom push buttons, since there is already a space shortcut)

pull/200/head
Marc Zinnschlag 11 years ago
parent 1e6d557089
commit 3f6a7e36d0

@ -4,9 +4,9 @@
#include <QMouseEvent> #include <QMouseEvent>
#include <QKeyEvent> #include <QKeyEvent>
void CSVWidget::PushButton::setExtendedToolTip (const QString& text) void CSVWidget::PushButton::setExtendedToolTip()
{ {
QString tooltip = text; QString tooltip = mToolTip;
if (tooltip.isEmpty()) if (tooltip.isEmpty())
tooltip = "(Tool tip not implemented yet)"; tooltip = "(Tool tip not implemented yet)";
@ -50,15 +50,9 @@ void CSVWidget::PushButton::keyPressEvent (QKeyEvent *event)
void CSVWidget::PushButton::keyReleaseEvent (QKeyEvent *event) void CSVWidget::PushButton::keyReleaseEvent (QKeyEvent *event)
{ {
if (event->key()==Qt::Key_Return || event->key()==Qt::Key_Enter) if (event->key()==Qt::Key_Space)
{
mKeepOpen = event->modifiers() & Qt::ShiftModifier; mKeepOpen = event->modifiers() & Qt::ShiftModifier;
setChecked (!isChecked());
emit clicked();
}
QPushButton::keyReleaseEvent (event); QPushButton::keyReleaseEvent (event);
} }
@ -73,14 +67,14 @@ CSVWidget::PushButton::PushButton (const QIcon& icon, Type type, const QString&
: QPushButton (icon, "", parent), mKeepOpen (false), mType (type), mToolTip (tooltip) : QPushButton (icon, "", parent), mKeepOpen (false), mType (type), mToolTip (tooltip)
{ {
setCheckable (type==Type_Mode || type==Type_Toggle); setCheckable (type==Type_Mode || type==Type_Toggle);
setExtendedToolTip (tooltip); setExtendedToolTip();
} }
CSVWidget::PushButton::PushButton (Type type, const QString& tooltip, QWidget *parent) CSVWidget::PushButton::PushButton (Type type, const QString& tooltip, QWidget *parent)
: QPushButton (parent), mKeepOpen (false), mType (type), mToolTip (tooltip) : QPushButton (parent), mKeepOpen (false), mType (type), mToolTip (tooltip)
{ {
setCheckable (type==Type_Mode || type==Type_Toggle); setCheckable (type==Type_Mode || type==Type_Toggle);
setExtendedToolTip (tooltip); setExtendedToolTip();
} }
bool CSVWidget::PushButton::hasKeepOpen() const bool CSVWidget::PushButton::hasKeepOpen() const

@ -26,7 +26,7 @@ namespace CSVWidget
private: private:
void setExtendedToolTip (const QString& text); void setExtendedToolTip();
protected: protected:

Loading…
Cancel
Save