6
6
// (C) Copyright 1999-2010 Werner Schweer (ws@seh.de)
8
8
// PopupMenu sub-class of QMenu created by Tim.
9
// (C) Copyright 2010-2011 Tim E. Real (terminator356 A T sourceforge D O T net)
11
// This program is free software; you can redistribute it and/or
12
// modify it under the terms of the GNU General Public License
13
// as published by the Free Software Foundation; version 2 of
14
// the License, or (at your option) any later version.
16
// This program is distributed in the hope that it will be useful,
17
// but WITHOUT ANY WARRANTY; without even the implied warranty of
18
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
// GNU General Public License for more details.
21
// You should have received a copy of the GNU General Public License
22
// along with this program; if not, write to the Free Software
23
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
9
25
//=========================================================
11
27
#ifndef __POPUPMENU_H__
12
28
#define __POPUPMENU_H__
30
// Just in case Qt ever adds these features natively, we would need to turn our features off!
31
//#define POPUP_MENU_DISABLE_STAY_OPEN
32
//#define POPUP_MENU_DISABLE_AUTO_SCROLL
35
#ifndef POPUP_MENU_DISABLE_AUTO_SCROLL
15
39
//#include <QMouseEvent>
16
40
//#include <QColumnView>
22
48
//class QStandardItemModel;
24
52
class PopupMenu : public QMenu
57
#ifndef POPUP_MENU_DISABLE_AUTO_SCROLL
64
#ifndef POPUP_MENU_DISABLE_AUTO_SCROLL
65
void popHovered(QAction*);
29
70
void mouseReleaseEvent(QMouseEvent *);
32
PopupMenu(QWidget* parent=0);
75
PopupMenu(bool stayOpen);
76
PopupMenu(QWidget* parent=0, bool stayOpen = false);
77
PopupMenu(const QString& title, QWidget* parent = 0, bool stayOpen = false);
35
QAction* findActionFromData(QVariant);
80
QAction* findActionFromData(const QVariant&) const;
81
bool stayOpen() const { return _stayOpen; }
82
void clearAllChecks() const;