2016-04-18 06:55:52 +00:00
|
|
|
#ifndef MENU_H
|
|
|
|
#define MENU_H
|
|
|
|
|
|
|
|
#include <QWidget>
|
2016-04-18 07:11:09 +00:00
|
|
|
#include "flatbutton.h"
|
|
|
|
|
|
|
|
class MenuItem : public FlatButton
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit MenuItem(QWidget *parent = 0);
|
|
|
|
explicit MenuItem(const QString &text, QWidget *parent = 0);
|
|
|
|
~MenuItem();
|
2016-04-24 22:19:13 +00:00
|
|
|
|
|
|
|
QSize sizeHint() const;
|
2016-04-18 07:11:09 +00:00
|
|
|
};
|
2016-04-18 06:55:52 +00:00
|
|
|
|
|
|
|
class Menu : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit Menu(QWidget *parent = 0);
|
|
|
|
~Menu();
|
2016-04-18 07:11:09 +00:00
|
|
|
|
2016-04-18 07:36:40 +00:00
|
|
|
void addMenuItem(MenuItem *item);
|
|
|
|
void addMenuItem(const QString &text);
|
|
|
|
|
2016-04-24 11:38:58 +00:00
|
|
|
inline int itemCount() const { return _items.count(); }
|
|
|
|
|
2016-04-18 07:11:09 +00:00
|
|
|
protected:
|
|
|
|
void paintEvent(QPaintEvent *event);
|
2016-04-24 11:38:58 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
QList<MenuItem *> _items;
|
2016-04-18 06:55:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MENU_H
|