Mercurial > hg > octave-nkf
annotate libgui/graphics/Menu.cc @ 19799:f3ac54ac2c6a
also skip startup message if session is not interactive
* octave.cc (octave_initialize_interpreter): If session is not
interactive or forced interactive, set inhibit_startup_message to
true.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 21 Jan 2015 12:36:25 -0500 |
parents | dbb207d10d7c |
children | 2f4406e9dad6 |
rev | line source |
---|---|
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1 /* |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
2 |
18568
49877d3be064
update copyright notices for new QtHandles code
John W. Eaton <jwe@octave.org>
parents:
18566
diff
changeset
|
3 Copyright (C) 2011-2014 Michael Goffioul |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
4 |
18568
49877d3be064
update copyright notices for new QtHandles code
John W. Eaton <jwe@octave.org>
parents:
18566
diff
changeset
|
5 This file is part of Octave. |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
6 |
18568
49877d3be064
update copyright notices for new QtHandles code
John W. Eaton <jwe@octave.org>
parents:
18566
diff
changeset
|
7 Octave is free software; you can redistribute it and/or modify it |
49877d3be064
update copyright notices for new QtHandles code
John W. Eaton <jwe@octave.org>
parents:
18566
diff
changeset
|
8 under the terms of the GNU General Public License as published by the |
49877d3be064
update copyright notices for new QtHandles code
John W. Eaton <jwe@octave.org>
parents:
18566
diff
changeset
|
9 Free Software Foundation; either version 3 of the License, or (at your |
49877d3be064
update copyright notices for new QtHandles code
John W. Eaton <jwe@octave.org>
parents:
18566
diff
changeset
|
10 option) any later version. |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
11 |
18568
49877d3be064
update copyright notices for new QtHandles code
John W. Eaton <jwe@octave.org>
parents:
18566
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
49877d3be064
update copyright notices for new QtHandles code
John W. Eaton <jwe@octave.org>
parents:
18566
diff
changeset
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
49877d3be064
update copyright notices for new QtHandles code
John W. Eaton <jwe@octave.org>
parents:
18566
diff
changeset
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
49877d3be064
update copyright notices for new QtHandles code
John W. Eaton <jwe@octave.org>
parents:
18566
diff
changeset
|
15 for more details. |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
16 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
17 You should have received a copy of the GNU General Public License |
18568
49877d3be064
update copyright notices for new QtHandles code
John W. Eaton <jwe@octave.org>
parents:
18566
diff
changeset
|
18 along with Octave; see the file COPYING. If not, see |
49877d3be064
update copyright notices for new QtHandles code
John W. Eaton <jwe@octave.org>
parents:
18566
diff
changeset
|
19 <http://www.gnu.org/licenses/>. |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
20 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
21 */ |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
22 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
23 #ifdef HAVE_CONFIG_H |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
24 #include <config.h> |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
25 #endif |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
26 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
27 #include <QAction> |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
28 #include <QMainWindow> |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
29 #include <QMenu> |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
30 #include <QMenuBar> |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
31 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
32 #include "Figure.h" |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
33 #include "Menu.h" |
18573
fb96b7f55242
rename file to avoid clash on case-insenstive filesystems (bug #41658)
John W. Eaton <jwe@octave.org>
parents:
18569
diff
changeset
|
34 #include "QtHandlesUtils.h" |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
35 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
36 namespace QtHandles |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
37 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
38 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
39 static QKeySequence accelSequence (const uimenu::properties& up) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
40 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
41 std::string s (up.get_accelerator ()); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
42 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
43 if (! s.empty ()) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
44 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
45 char c = s[0]; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
46 int keyMod = Qt::CTRL; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
47 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
48 if (c >= 'A' && c <= 'Z') |
18847
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
49 keyMod |= Qt::SHIFT; |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
50 if (c >= 'a' && c <= 'z') |
18847
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
51 c -= ('a' - 'A'); |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
52 if (c >= 'A' && c <= 'Z') |
18847
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
53 return QKeySequence (keyMod | static_cast<int> (c)); |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
54 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
55 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
56 return QKeySequence (); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
57 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
58 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
59 Menu* Menu::create (const graphics_object& go) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
60 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
61 Object* parent = Object::parentObject (go); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
62 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
63 if (parent) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
64 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
65 QObject* qObj = parent->qObject (); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
66 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
67 if (qObj) |
18847
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
68 return new Menu (go, new QAction (qObj), parent); |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
69 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
70 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
71 return 0; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
72 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
73 |
19121
dbb207d10d7c
eliminate some shadowed variable declaration warnings
John W. Eaton <jwe@octave.org>
parents:
18847
diff
changeset
|
74 Menu::Menu (const graphics_object& go, QAction* action, Object* xparent) |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
75 : Object (go, action), m_parent (0), m_separator (0) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
76 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
77 uimenu::properties& up = properties<uimenu> (); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
78 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
79 action->setText (Utils::fromStdString (up.get_label ())); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
80 if (up.is_checked ()) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
81 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
82 action->setCheckable (true); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
83 action->setChecked (up.is_checked ()); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
84 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
85 action->setEnabled (up.is_enable ()); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
86 action->setShortcut (accelSequence (up)); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
87 action->setVisible (up.is_visible ()); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
88 if (up.is_separator ()) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
89 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
90 m_separator = new QAction (action); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
91 m_separator->setSeparator (true); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
92 m_separator->setVisible (up.is_visible ()); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
93 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
94 |
19121
dbb207d10d7c
eliminate some shadowed variable declaration warnings
John W. Eaton <jwe@octave.org>
parents:
18847
diff
changeset
|
95 MenuContainer* menuContainer = dynamic_cast<MenuContainer*> (xparent); |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
96 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
97 if (menuContainer) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
98 m_parent = menuContainer->menu (); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
99 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
100 if (m_parent) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
101 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
102 int pos = static_cast<int> (up.get_position ()); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
103 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
104 if (pos <= 0) |
18847
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
105 { |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
106 if (m_separator) |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
107 m_parent->insertAction (0, m_separator); |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
108 m_parent->insertAction (0, action); |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
109 |
18847
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
110 int count = 0; |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
111 |
18847
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
112 foreach (QAction* a, m_parent->actions ()) |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
113 if (! a->isSeparator () && a->objectName () != "builtinMenu") |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
114 count++; |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
115 up.get_property ("position").set |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
116 (octave_value (static_cast<double> (count)), true, false); |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
117 } |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
118 else |
18847
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
119 { |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
120 |
18847
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
121 int count = 0; |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
122 QAction* before = 0; |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
123 |
18847
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
124 foreach (QAction* a, m_parent->actions ()) |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
125 if (! a->isSeparator () && a->objectName () != "builtinMenu") |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
126 { |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
127 count++; |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
128 if (pos <= count) |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
129 { |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
130 before = a; |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
131 break; |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
132 } |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
133 } |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
134 |
18847
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
135 if (m_separator) |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
136 m_parent->insertAction (before, m_separator); |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
137 m_parent->insertAction (before, action); |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
138 |
18847
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
139 if (before) |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
140 updateSiblingPositions (); |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
141 else |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
142 up.get_property ("position").set |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
143 (octave_value (static_cast<double> (count+1)), true, false); |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
144 } |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
145 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
146 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
147 connect (action, SIGNAL (triggered (bool)), SLOT (actionTriggered (void))); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
148 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
149 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
150 Menu::~Menu (void) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
151 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
152 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
153 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
154 void Menu::update (int pId) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
155 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
156 uimenu::properties& up = properties<uimenu> (); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
157 QAction* action = qWidget<QAction> (); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
158 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
159 switch (pId) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
160 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
161 case uimenu::properties::ID_LABEL: |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
162 action->setText (Utils::fromStdString (up.get_label ())); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
163 break; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
164 case uimenu::properties::ID_CHECKED: |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
165 if (up.is_checked ()) |
18847
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
166 { |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
167 action->setCheckable (true); |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
168 action->setChecked (up.is_checked ()); |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
169 } |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
170 else |
18847
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
171 { |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
172 action->setChecked (false); |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
173 action->setCheckable (false); |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
174 } |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
175 break; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
176 case uimenu::properties::ID_ENABLE: |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
177 action->setEnabled (up.is_enable ()); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
178 break; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
179 case uimenu::properties::ID_ACCELERATOR: |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
180 if (! action->menu ()) |
18847
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
181 action->setShortcut (accelSequence (up)); |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
182 break; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
183 case uimenu::properties::ID_SEPARATOR: |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
184 if (up.is_separator ()) |
18847
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
185 { |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
186 if (! m_separator) |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
187 { |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
188 m_separator = new QAction (action); |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
189 m_separator->setSeparator (true); |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
190 m_separator->setVisible (up.is_visible ()); |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
191 if (m_parent) |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
192 m_parent->insertAction (action, m_separator); |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
193 } |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
194 } |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
195 else |
18847
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
196 { |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
197 if (m_separator) |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
198 delete m_separator; |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
199 m_separator = 0; |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
200 } |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
201 break; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
202 case uimenu::properties::ID_VISIBLE: |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
203 action->setVisible (up.is_visible ()); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
204 if (m_separator) |
18847
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
205 m_separator->setVisible (up.is_visible ()); |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
206 break; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
207 case uimenu::properties::ID_POSITION: |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
208 if (m_separator) |
18847
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
209 m_parent->removeAction (m_separator); |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
210 m_parent->removeAction (action); |
18847
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
211 { |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
212 int pos = static_cast<int> (up.get_position ()); |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
213 QAction* before = 0; |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
214 |
18847
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
215 if (pos > 0) |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
216 { |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
217 int count = 0; |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
218 |
18847
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
219 foreach (QAction* a, m_parent->actions ()) |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
220 if (! a->isSeparator () && a->objectName () != "builtinMenu") |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
221 { |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
222 count++; |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
223 if (pos <= count) |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
224 { |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
225 before = a; |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
226 break; |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
227 } |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
228 } |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
229 } |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
230 |
18847
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
231 if (m_separator) |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
232 m_parent->insertAction (before, m_separator); |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
233 m_parent->insertAction (before, action); |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
234 updateSiblingPositions (); |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
235 } |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
236 break; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
237 default: |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
238 Object::update (pId); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
239 break; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
240 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
241 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
242 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
243 QWidget* Menu::menu (void) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
244 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
245 QAction* action = qWidget<QAction> (); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
246 QMenu* _menu = action->menu (); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
247 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
248 if (! _menu) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
249 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
250 _menu = new QMenu (action->parentWidget ()); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
251 action->setMenu (_menu); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
252 action->setShortcut (QKeySequence ()); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
253 connect (_menu, SIGNAL (aboutToShow (void)), |
18847
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
254 this, SLOT (actionHovered (void))); |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
255 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
256 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
257 return _menu; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
258 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
259 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
260 void Menu::actionTriggered (void) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
261 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
262 QAction* action = qWidget<QAction> (); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
263 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
264 if (action->isCheckable ()) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
265 action->setChecked (! action->isChecked ()); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
266 gh_manager::post_callback (m_handle, "callback"); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
267 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
268 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
269 void Menu::actionHovered (void) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
270 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
271 gh_manager::post_callback (m_handle, "callback"); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
272 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
273 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
274 void Menu::updateSiblingPositions (void) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
275 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
276 if (m_parent) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
277 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
278 double count = 1.0; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
279 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
280 foreach (QAction* a, m_parent->actions ()) |
18847
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
281 { |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
282 if (! a->isSeparator () && a->objectName () != "builtinMenu") |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
283 { |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
284 Object* aObj = Object::fromQObject (a); |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
285 |
18847
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
286 if (aObj) |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
287 { |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
288 graphics_object go = aObj->object (); |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
289 |
18847
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
290 // Probably overkill as a uimenu child can only be another |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
291 // uimenu object. |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
292 if (go.isa ("uimenu")) |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
293 { |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
294 uimenu::properties& up = Utils::properties<uimenu> (go); |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
295 |
18847
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
296 up.get_property ("position").set |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
297 (octave_value (count), true, false); |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
298 } |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
299 } |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
300 |
18847
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
301 count++; |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
302 } |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18573
diff
changeset
|
303 } |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
304 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
305 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
306 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
307 }; // namespace QtHandles |