2011-08-16 23:52:25 +02:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright 2011 Viranch Mehta <viranch.mehta@gmail.com> *
|
2013-03-26 20:15:56 +01:00
|
|
|
* Copyright 2013 Sebastian Kügler <sebas@kde.org> *
|
2011-08-16 23:52:25 +02:00
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
* along with this program; if not, write to the *
|
|
|
|
* Free Software Foundation, Inc., *
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
|
|
|
|
***************************************************************************/
|
|
|
|
|
2011-10-28 18:57:34 +02:00
|
|
|
#ifndef QMENUITEM_H
|
|
|
|
#define QMENUITEM_H
|
2011-08-16 23:52:25 +02:00
|
|
|
|
|
|
|
#include <QAction>
|
2013-03-26 20:15:56 +01:00
|
|
|
#include <QQuickItem>
|
2011-08-16 23:52:25 +02:00
|
|
|
|
2013-03-26 20:15:56 +01:00
|
|
|
class QMenuItem : public QQuickItem
|
2011-08-16 23:52:25 +02:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2012-10-03 20:18:38 +02:00
|
|
|
/**
|
|
|
|
* The parent object
|
|
|
|
*/
|
2011-12-29 15:09:58 +01:00
|
|
|
Q_PROPERTY(QObject *parent READ parent WRITE setParent)
|
2012-10-03 20:18:38 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If true, the menu item will behave like a separator
|
|
|
|
*/
|
2013-03-26 20:15:56 +01:00
|
|
|
Q_PROPERTY(bool separator READ separator WRITE setSeparator NOTIFY separatorChanged)
|
|
|
|
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
|
2013-04-30 02:50:42 +02:00
|
|
|
Q_PROPERTY(QVariant icon READ icon WRITE setIcon NOTIFY iconChanged)
|
2013-03-26 20:15:56 +01:00
|
|
|
Q_PROPERTY(QAction* action READ action WRITE setAction NOTIFY actionChanged)
|
2011-08-16 23:52:25 +02:00
|
|
|
|
|
|
|
public:
|
2013-03-26 20:15:56 +01:00
|
|
|
QMenuItem(QQuickItem *parent = 0);
|
|
|
|
|
|
|
|
QAction* action() const;
|
|
|
|
void setAction(QAction* a);
|
2013-04-30 02:50:42 +02:00
|
|
|
QVariant icon() const;
|
|
|
|
void setIcon(const QVariant& i);
|
2013-03-26 20:15:56 +01:00
|
|
|
bool separator() const;
|
|
|
|
void setSeparator(bool s);
|
|
|
|
QString text() const;
|
|
|
|
void setText(const QString &t);
|
2011-10-28 18:57:34 +02:00
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
void clicked();
|
2013-03-26 20:15:56 +01:00
|
|
|
|
|
|
|
void actionChanged();
|
|
|
|
void iconChanged();
|
|
|
|
void separatorChanged();
|
|
|
|
void textChanged();
|
|
|
|
|
|
|
|
private:
|
|
|
|
QAction* m_action;
|
2013-04-30 02:50:42 +02:00
|
|
|
QVariant m_icon;
|
2011-08-16 23:52:25 +02:00
|
|
|
};
|
|
|
|
|
2011-10-28 18:57:34 +02:00
|
|
|
#endif // QMENUITEM_H
|
2011-08-16 23:52:25 +02:00
|
|
|
|