Mercurial > hg > octave-nkf
annotate libgui/graphics/Menu.cc @ 20530:8c4317b8f7c5 stable
ellipke.m: Use correct definition of elliptic integral in documentation (bug #45522).
* ellipke.m: Replace 'm^2' with just 'm' in definitions of elliptic integrals.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 10 Jul 2015 11:55:14 -0700 |
parents | f0e61a67ad9f |
children |
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 |
20213
f0e61a67ad9f
Update copyright year in Qt graphics code.
John W. Eaton <jwe@octave.org>
parents:
20176
diff
changeset
|
3 Copyright (C) 2011-2015 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 |
20176
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
39 static QKeySequence |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
40 accelSequence (const uimenu::properties& up) |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
41 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
42 std::string s (up.get_accelerator ()); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
43 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
44 if (! s.empty ()) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
45 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
46 char c = s[0]; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
47 int keyMod = Qt::CTRL; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
48 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
49 if (c >= 'A' && c <= 'Z') |
19818
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
50 keyMod |= Qt::SHIFT; |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
51 if (c >= 'a' && c <= 'z') |
19818
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
52 c -= ('a' - 'A'); |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
53 if (c >= 'A' && c <= 'Z') |
19818
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
54 return QKeySequence (keyMod | static_cast<int> (c)); |
18566
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 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
57 return QKeySequence (); |
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 |
20176
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
60 Menu* |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
61 Menu::create (const graphics_object& go) |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
62 { |
19813
709f3a77685d
avoid shadowed variable warnings in libgui sources
John W. Eaton <jwe@octave.org>
parents:
18573
diff
changeset
|
63 Object* parent_obj = Object::parentObject (go); |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
64 |
19813
709f3a77685d
avoid shadowed variable warnings in libgui sources
John W. Eaton <jwe@octave.org>
parents:
18573
diff
changeset
|
65 if (parent_obj) |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
66 { |
19813
709f3a77685d
avoid shadowed variable warnings in libgui sources
John W. Eaton <jwe@octave.org>
parents:
18573
diff
changeset
|
67 QObject* qObj = parent_obj->qObject (); |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
68 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
69 if (qObj) |
19818
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
70 return new Menu (go, new QAction (qObj), parent_obj); |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
71 } |
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 return 0; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
74 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
75 |
19813
709f3a77685d
avoid shadowed variable warnings in libgui sources
John W. Eaton <jwe@octave.org>
parents:
18573
diff
changeset
|
76 Menu::Menu (const graphics_object& go, QAction* action, Object* xparent) |
20176
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
77 : Object (go, action), m_parent (0), m_separator (0) |
18566
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 uimenu::properties& up = properties<uimenu> (); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
80 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
81 action->setText (Utils::fromStdString (up.get_label ())); |
20176
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
82 |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
83 if (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->setCheckable (true); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
86 action->setChecked (up.is_checked ()); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
87 } |
20176
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
88 |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
89 action->setEnabled (up.is_enable ()); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
90 action->setShortcut (accelSequence (up)); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
91 action->setVisible (up.is_visible ()); |
20176
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
92 |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
93 if (up.is_separator ()) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
94 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
95 m_separator = new QAction (action); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
96 m_separator->setSeparator (true); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
97 m_separator->setVisible (up.is_visible ()); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
98 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
99 |
19813
709f3a77685d
avoid shadowed variable warnings in libgui sources
John W. Eaton <jwe@octave.org>
parents:
18573
diff
changeset
|
100 MenuContainer* menuContainer = dynamic_cast<MenuContainer*> (xparent); |
18566
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 if (menuContainer) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
103 m_parent = menuContainer->menu (); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
104 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
105 if (m_parent) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
106 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
107 int pos = static_cast<int> (up.get_position ()); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
108 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
109 if (pos <= 0) |
19818
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
110 { |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
111 if (m_separator) |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
112 m_parent->insertAction (0, m_separator); |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
113 m_parent->insertAction (0, action); |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
114 |
19818
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
115 int count = 0; |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
116 |
19818
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
117 foreach (QAction* a, m_parent->actions ()) |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
118 if (! a->isSeparator () && a->objectName () != "builtinMenu") |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
119 count++; |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
120 up.get_property ("position").set |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
121 (octave_value (static_cast<double> (count)), true, false); |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
122 } |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
123 else |
19818
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
124 { |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
125 |
19818
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
126 int count = 0; |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
127 QAction* before = 0; |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
128 |
19818
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
129 foreach (QAction* a, m_parent->actions ()) |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
130 if (! a->isSeparator () && a->objectName () != "builtinMenu") |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
131 { |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
132 count++; |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
133 if (pos <= count) |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
134 { |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
135 before = a; |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
136 break; |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
137 } |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
138 } |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
139 |
19818
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
140 if (m_separator) |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
141 m_parent->insertAction (before, m_separator); |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
142 m_parent->insertAction (before, action); |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
143 |
19818
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
144 if (before) |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
145 updateSiblingPositions (); |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
146 else |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
147 up.get_property ("position").set |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
148 (octave_value (static_cast<double> (count+1)), true, false); |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
149 } |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
150 } |
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 connect (action, SIGNAL (triggered (bool)), SLOT (actionTriggered (void))); |
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 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
155 Menu::~Menu (void) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
156 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
157 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
158 |
20176
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
159 void |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
160 Menu::update (int pId) |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
161 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
162 uimenu::properties& up = properties<uimenu> (); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
163 QAction* action = qWidget<QAction> (); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
164 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
165 switch (pId) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
166 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
167 case uimenu::properties::ID_LABEL: |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
168 action->setText (Utils::fromStdString (up.get_label ())); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
169 break; |
20176
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
170 |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
171 case uimenu::properties::ID_CHECKED: |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
172 if (up.is_checked ()) |
19818
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
173 { |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
174 action->setCheckable (true); |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
175 action->setChecked (up.is_checked ()); |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
176 } |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
177 else |
19818
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
178 { |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
179 action->setChecked (false); |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
180 action->setCheckable (false); |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
181 } |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
182 break; |
20176
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
183 |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
184 case uimenu::properties::ID_ENABLE: |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
185 action->setEnabled (up.is_enable ()); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
186 break; |
20176
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
187 |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
188 case uimenu::properties::ID_ACCELERATOR: |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
189 if (! action->menu ()) |
19818
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
190 action->setShortcut (accelSequence (up)); |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
191 break; |
20176
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
192 |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
193 case uimenu::properties::ID_SEPARATOR: |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
194 if (up.is_separator ()) |
19818
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
195 { |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
196 if (! m_separator) |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
197 { |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
198 m_separator = new QAction (action); |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
199 m_separator->setSeparator (true); |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
200 m_separator->setVisible (up.is_visible ()); |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
201 if (m_parent) |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
202 m_parent->insertAction (action, m_separator); |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
203 } |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
204 } |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
205 else |
19818
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
206 { |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
207 if (m_separator) |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
208 delete m_separator; |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
209 m_separator = 0; |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
210 } |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
211 break; |
20176
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
212 |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
213 case uimenu::properties::ID_VISIBLE: |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
214 action->setVisible (up.is_visible ()); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
215 if (m_separator) |
19818
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
216 m_separator->setVisible (up.is_visible ()); |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
217 break; |
20176
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
218 |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
219 case uimenu::properties::ID_POSITION: |
20176
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
220 { |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
221 if (m_separator) |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
222 m_parent->removeAction (m_separator); |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
223 |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
224 m_parent->removeAction (action); |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
225 |
20176
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
226 int pos = static_cast<int> (up.get_position ()); |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
227 QAction* before = 0; |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
228 |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
229 if (pos > 0) |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
230 { |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
231 int count = 0; |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
232 |
20176
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
233 foreach (QAction* a, m_parent->actions ()) |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
234 if (! a->isSeparator () && a->objectName () != "builtinMenu") |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
235 { |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
236 count++; |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
237 if (pos <= count) |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
238 { |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
239 before = a; |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
240 break; |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
241 } |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
242 } |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
243 } |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
244 |
20176
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
245 if (m_separator) |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
246 m_parent->insertAction (before, m_separator); |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
247 |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
248 m_parent->insertAction (before, action); |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
249 |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
250 updateSiblingPositions (); |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
251 } |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
252 break; |
20176
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
253 |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
254 default: |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
255 Object::update (pId); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
256 break; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
257 } |
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 |
20176
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
260 QWidget* |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
261 Menu::menu (void) |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
262 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
263 QAction* action = qWidget<QAction> (); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
264 QMenu* _menu = action->menu (); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
265 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
266 if (! _menu) |
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 _menu = new QMenu (action->parentWidget ()); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
269 action->setMenu (_menu); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
270 action->setShortcut (QKeySequence ()); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
271 connect (_menu, SIGNAL (aboutToShow (void)), |
19818
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
272 this, SLOT (actionHovered (void))); |
18566
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 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
275 return _menu; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
276 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
277 |
20176
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
278 void |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
279 Menu::actionTriggered (void) |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
280 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
281 QAction* action = qWidget<QAction> (); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
282 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
283 if (action->isCheckable ()) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
284 action->setChecked (! action->isChecked ()); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
285 gh_manager::post_callback (m_handle, "callback"); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
286 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
287 |
20176
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
288 void |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
289 Menu::actionHovered (void) |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
290 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
291 gh_manager::post_callback (m_handle, "callback"); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
292 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
293 |
20176
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
294 void |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19822
diff
changeset
|
295 Menu::updateSiblingPositions (void) |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
296 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
297 if (m_parent) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
298 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
299 double count = 1.0; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
300 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
301 foreach (QAction* a, m_parent->actions ()) |
19818
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
302 { |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
303 if (! a->isSeparator () && a->objectName () != "builtinMenu") |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
304 { |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
305 Object* aObj = Object::fromQObject (a); |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
306 |
19818
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
307 if (aObj) |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
308 { |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
309 graphics_object go = aObj->object (); |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
310 |
19818
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
311 // Probably overkill as a uimenu child can only be another |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
312 // uimenu object. |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
313 if (go.isa ("uimenu")) |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
314 { |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
315 uimenu::properties& up = Utils::properties<uimenu> (go); |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
316 |
19818
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
317 up.get_property ("position").set |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
318 (octave_value (count), true, false); |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
319 } |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
320 } |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
321 |
19818
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
322 count++; |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
323 } |
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19813
diff
changeset
|
324 } |
18566
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
325 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
326 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
327 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
328 }; // namespace QtHandles |