1 /********* 2 * 3 * In the name of the Father, and of the Son, and of the Holy Spirit. 4 * 5 * This file is part of BibleTime's source code, http://www.bibletime.info/. 6 * 7 * Copyright 1999-2016 by the BibleTime developers. 8 * The BibleTime source code is licensed under the GNU General Public License version 2.0. 9 * 10 **********/ 11 12 #ifndef BT_TOOLBAR_POPUP_ACTION_H 13 #define BT_TOOLBAR_POPUP_ACTION_H 14 15 #include <QWidgetAction> 16 17 18 class QIcon; 19 class QMenu; 20 class QString; 21 class QToolButton; 22 23 // This class manages the toolbar display for going forward and backward in history. 24 class BtToolBarPopupAction : public QWidgetAction { 25 Q_OBJECT 26 public: 27 28 BtToolBarPopupAction(const QIcon& icon, const QString& text, QObject* parent); 29 ~BtToolBarPopupAction(); 30 31 // return the QMenu object so a popup menu can be constructed 32 QMenu* popupMenu() const; 33 34 bool event(QEvent* e) override; 35 36 protected: 37 QWidget* createWidget(QWidget* parent) override; 38 39 private slots: 40 41 // Slot to emit a triggered signal when the toolbar button is pressed 42 void buttonPressed(); 43 44 private: 45 QMenu* m_menu; 46 QToolButton* m_button; 47 QIcon m_icon; 48 QString m_text; 49 }; 50 51 #endif 52