StelShortcut::StelShortcut(const QString &id,
                           StelShortcutGroup* group,
                           const QString &text,
                           const QString &primaryKey,
                           const QString &altKey,
                           bool checkable,
                           bool autoRepeat,
                           bool global,
                           QGraphicsWidget *parent) :
    m_id(id), m_temporary(false)
{
	if (parent == NULL)
	{
		parent = StelMainGraphicsView::getInstance().getStelAppGraphicsWidget();
	}
	m_action = new QAction(parent);
	m_action->setObjectName(id);
	m_group = group;

	setText(text);
	setPrimaryKey(primaryKey);
	setAltKey(altKey);
	setCheckable(checkable);
	setAutoRepeat(autoRepeat);
	setGlobal(global);

	parent->addAction(m_action);
}
Exemple #2
0
/*!
    Constructs a tool button as an arrow button. The Qt::ArrowType \a
    type defines the arrow direction. Possible values are
    Qt::LeftArrow, Qt::RightArrow, Qt::UpArrow, and Qt::DownArrow.

    An arrow button has auto-repeat turned on by default.

    The \a parent and \a name arguments are sent to the QWidget
    constructor.
*/
QToolButton::QToolButton(Qt::ArrowType type, QWidget *parent, const char *name)
    : QAbstractButton(*new QToolButtonPrivate, parent)
{
    Q_D(QToolButton);
    setObjectName(QString::fromAscii(name));
    d->init();
    setAutoRepeat(true);
    d->arrowType = type;
}
QToolButtonExt::QToolButtonExt(QWidget *parent, int ms )
    : QToolButton( parent ),
      shortClick( false ),
      longClick( false )
{
    setAutoRepeat( true );
    /* default to twice the doubleclick delay */
    setAutoRepeatDelay( ( ms > 0 )? ms : 2 * QApplication::doubleClickInterval() );
    setAutoRepeatInterval( 100 );
    connect( this, SIGNAL(released()), this, SLOT(releasedSlot()) );
    connect( this, SIGNAL(clicked()), this, SLOT(clickedSlot()) );
}
int QShortcut::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: activated(); break;
        case 1: activatedAmbiguously(); break;
        default: ;
        }
        _id -= 2;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QKeySequence*>(_v) = key(); break;
        case 1: *reinterpret_cast< QString*>(_v) = whatsThis(); break;
        case 2: *reinterpret_cast< bool*>(_v) = isEnabled(); break;
        case 3: *reinterpret_cast< bool*>(_v) = autoRepeat(); break;
        case 4: *reinterpret_cast< Qt::ShortcutContext*>(_v) = context(); break;
        }
        _id -= 5;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setKey(*reinterpret_cast< QKeySequence*>(_v)); break;
        case 1: setWhatsThis(*reinterpret_cast< QString*>(_v)); break;
        case 2: setEnabled(*reinterpret_cast< bool*>(_v)); break;
        case 3: setAutoRepeat(*reinterpret_cast< bool*>(_v)); break;
        case 4: setContext(*reinterpret_cast< Qt::ShortcutContext*>(_v)); break;
        }
        _id -= 5;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 5;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 5;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 5;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 5;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 5;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 5;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
/*!
  \param num Number of arrows
  \param arrowType see Qt::ArowType in the Qt docs.
  \param parent Parent widget
*/
QwtArrowButton::QwtArrowButton(int num,
                               Qt::ArrowType arrowType, QWidget *parent):
    QPushButton(parent)
{
    d_data = new PrivateData;
    d_data->num = qwtLim(num, 1, MaxNum);
    d_data->arrowType = arrowType;

    setAutoRepeat(true);
    setAutoDefault(false);

    switch(d_data->arrowType) {
    case Qt::LeftArrow:
    case Qt::RightArrow:
        setSizePolicy(QSizePolicy::Expanding,
                      QSizePolicy::Fixed);
        break;
    default:
        setSizePolicy(QSizePolicy::Fixed,
                      QSizePolicy::Expanding);
    }
}
int QAbstractButton::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: pressed(); break;
        case 1: released(); break;
        case 2: clicked((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 3: clicked(); break;
        case 4: toggled((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 5: setIconSize((*reinterpret_cast< const QSize(*)>(_a[1]))); break;
        case 6: animateClick((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 7: animateClick(); break;
        case 8: click(); break;
        case 9: toggle(); break;
        case 10: setChecked((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 11: setOn((*reinterpret_cast< bool(*)>(_a[1]))); break;
        }
        _id -= 12;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QString*>(_v) = text(); break;
        case 1: *reinterpret_cast< QIcon*>(_v) = icon(); break;
        case 2: *reinterpret_cast< QSize*>(_v) = iconSize(); break;
        case 3: *reinterpret_cast< QKeySequence*>(_v) = shortcut(); break;
        case 4: *reinterpret_cast< bool*>(_v) = isCheckable(); break;
        case 5: *reinterpret_cast< bool*>(_v) = isChecked(); break;
        case 6: *reinterpret_cast< bool*>(_v) = autoRepeat(); break;
        case 7: *reinterpret_cast< bool*>(_v) = autoExclusive(); break;
        case 8: *reinterpret_cast< int*>(_v) = autoRepeatDelay(); break;
        case 9: *reinterpret_cast< int*>(_v) = autoRepeatInterval(); break;
        case 10: *reinterpret_cast< bool*>(_v) = isDown(); break;
        }
        _id -= 11;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setText(*reinterpret_cast< QString*>(_v)); break;
        case 1: setIcon(*reinterpret_cast< QIcon*>(_v)); break;
        case 2: setIconSize(*reinterpret_cast< QSize*>(_v)); break;
        case 3: setShortcut(*reinterpret_cast< QKeySequence*>(_v)); break;
        case 4: setCheckable(*reinterpret_cast< bool*>(_v)); break;
        case 5: setChecked(*reinterpret_cast< bool*>(_v)); break;
        case 6: setAutoRepeat(*reinterpret_cast< bool*>(_v)); break;
        case 7: setAutoExclusive(*reinterpret_cast< bool*>(_v)); break;
        case 8: setAutoRepeatDelay(*reinterpret_cast< int*>(_v)); break;
        case 9: setAutoRepeatInterval(*reinterpret_cast< int*>(_v)); break;
        case 10: setDown(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 11;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        bool *_b = reinterpret_cast<bool*>(_a[0]);
        switch (_id) {
        case 5: *_b = isCheckable(); break;
        }
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 11;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
int QAction::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 15)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 15;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< bool*>(_v) = isCheckable(); break;
        case 1: *reinterpret_cast< bool*>(_v) = isChecked(); break;
        case 2: *reinterpret_cast< bool*>(_v) = isEnabled(); break;
        case 3: *reinterpret_cast< QIcon*>(_v) = icon(); break;
        case 4: *reinterpret_cast< QString*>(_v) = text(); break;
        case 5: *reinterpret_cast< QString*>(_v) = iconText(); break;
        case 6: *reinterpret_cast< QString*>(_v) = toolTip(); break;
        case 7: *reinterpret_cast< QString*>(_v) = statusTip(); break;
        case 8: *reinterpret_cast< QString*>(_v) = whatsThis(); break;
        case 9: *reinterpret_cast< QFont*>(_v) = font(); break;
        case 10: *reinterpret_cast< QKeySequence*>(_v) = shortcut(); break;
        case 11: *reinterpret_cast< Qt::ShortcutContext*>(_v) = shortcutContext(); break;
        case 12: *reinterpret_cast< bool*>(_v) = autoRepeat(); break;
        case 13: *reinterpret_cast< bool*>(_v) = isVisible(); break;
        case 14: *reinterpret_cast< MenuRole*>(_v) = menuRole(); break;
        case 15: *reinterpret_cast< SoftKeyRole*>(_v) = softKeyRole(); break;
        case 16: *reinterpret_cast< bool*>(_v) = isIconVisibleInMenu(); break;
        case 17: *reinterpret_cast< Priority*>(_v) = priority(); break;
        }
        _id -= 18;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setCheckable(*reinterpret_cast< bool*>(_v)); break;
        case 1: setChecked(*reinterpret_cast< bool*>(_v)); break;
        case 2: setEnabled(*reinterpret_cast< bool*>(_v)); break;
        case 3: setIcon(*reinterpret_cast< QIcon*>(_v)); break;
        case 4: setText(*reinterpret_cast< QString*>(_v)); break;
        case 5: setIconText(*reinterpret_cast< QString*>(_v)); break;
        case 6: setToolTip(*reinterpret_cast< QString*>(_v)); break;
        case 7: setStatusTip(*reinterpret_cast< QString*>(_v)); break;
        case 8: setWhatsThis(*reinterpret_cast< QString*>(_v)); break;
        case 9: setFont(*reinterpret_cast< QFont*>(_v)); break;
        case 10: setShortcut(*reinterpret_cast< QKeySequence*>(_v)); break;
        case 11: setShortcutContext(*reinterpret_cast< Qt::ShortcutContext*>(_v)); break;
        case 12: setAutoRepeat(*reinterpret_cast< bool*>(_v)); break;
        case 13: setVisible(*reinterpret_cast< bool*>(_v)); break;
        case 14: setMenuRole(*reinterpret_cast< MenuRole*>(_v)); break;
        case 15: setSoftKeyRole(*reinterpret_cast< SoftKeyRole*>(_v)); break;
        case 16: setIconVisibleInMenu(*reinterpret_cast< bool*>(_v)); break;
        case 17: setPriority(*reinterpret_cast< Priority*>(_v)); break;
        }
        _id -= 18;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 18;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        bool *_b = reinterpret_cast<bool*>(_a[0]);
        switch (_id) {
        case 1: *_b = isCheckable(); break;
        }
        _id -= 18;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 18;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 18;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 18;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 18;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}