Mercurial > octave
annotate libgui/src/variable-editor.cc @ 27935:f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
* Table.cc, qt-graphics-toolkit.cc, documentation.cc, documentation.h,
files-dock-widget.cc, find-files-dialog.cc, gui-preferences-cs.h,
gui-preferences-dw.h, gui-preferences-ed.h, gui-preferences-ff.h,
gui-preferences-mw.h, gui-preferences-sc.h, history-dock-widget.cc,
file-editor-tab.cc, file-editor.cc, find-dialog.cc, octave-qscintilla.cc,
main-window.cc, octave-dock-widget.cc, octave-qobject.cc, resource-manager.cc,
set-path-dialog.cc, set-path-model.cc, settings-dialog.cc, settings-dialog.h,
shortcut-manager.cc, tab-bar.cc, variable-editor.cc, workspace-model.cc,
workspace-model.h, workspace-view.cc:
Use Octave coding conventions in libgui/ directory.
author | Rik <rik@octave.org> |
---|---|
date | Sun, 12 Jan 2020 09:33:21 -0800 |
parents | bd51beb6205e |
children | 0c6dcf803529 d0a64e67749e |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
3 // Copyright (C) 2013-2020 The Octave Project Developers |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
25 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
26 #ifdef HAVE_CONFIG_H |
23978
665507c3c29d
Use Octave coding conventions for Variable Editor code.
Rik <rik@octave.org>
parents:
23969
diff
changeset
|
27 # include "config.h" |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
28 #endif |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
29 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
30 #include <limits> |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
31 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
32 #include <QApplication> |
23978
665507c3c29d
Use Octave coding conventions for Variable Editor code.
Rik <rik@octave.org>
parents:
23969
diff
changeset
|
33 #include <QClipboard> |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
34 #include <QFileDialog> |
23978
665507c3c29d
Use Octave coding conventions for Variable Editor code.
Rik <rik@octave.org>
parents:
23969
diff
changeset
|
35 #include <QHeaderView> |
665507c3c29d
Use Octave coding conventions for Variable Editor code.
Rik <rik@octave.org>
parents:
23969
diff
changeset
|
36 #include <QLabel> |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
37 #include <QMdiArea> |
23978
665507c3c29d
Use Octave coding conventions for Variable Editor code.
Rik <rik@octave.org>
parents:
23969
diff
changeset
|
38 #include <QMenu> |
665507c3c29d
Use Octave coding conventions for Variable Editor code.
Rik <rik@octave.org>
parents:
23969
diff
changeset
|
39 #include <QPalette> |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
40 #include <QScreen> |
24762
ed2d9ef336a7
resize varible editor model on scrollbar actions
John W. Eaton <jwe@octave.org>
parents:
24758
diff
changeset
|
41 #include <QScrollBar> |
23978
665507c3c29d
Use Octave coding conventions for Variable Editor code.
Rik <rik@octave.org>
parents:
23969
diff
changeset
|
42 #include <QSignalMapper> |
24697
21d6d80ed427
refactor variable editor model internal representation (bug #53054)
John W. Eaton <jwe@octave.org>
parents:
24694
diff
changeset
|
43 #include <QStackedWidget> |
27412
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27386
diff
changeset
|
44 #include <QTabWidget> |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
45 #include <QTableView> |
24697
21d6d80ed427
refactor variable editor model internal representation (bug #53054)
John W. Eaton <jwe@octave.org>
parents:
24694
diff
changeset
|
46 #include <QTextEdit> |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
47 #include <QToolBar> |
23978
665507c3c29d
Use Octave coding conventions for Variable Editor code.
Rik <rik@octave.org>
parents:
23969
diff
changeset
|
48 #include <QToolButton> |
665507c3c29d
Use Octave coding conventions for Variable Editor code.
Rik <rik@octave.org>
parents:
23969
diff
changeset
|
49 #include <QVBoxLayout> |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
50 |
25398
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
51 #include "dw-main-window.h" |
27560
3fcc650de22f
split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
27412
diff
changeset
|
52 #include "gui-preferences-cs.h" |
3fcc650de22f
split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
27412
diff
changeset
|
53 #include "gui-preferences-global.h" |
3fcc650de22f
split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
27412
diff
changeset
|
54 #include "gui-preferences-ve.h" |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
55 #include "octave-qobject.h" |
24694
9b4edcc62936
add contextmenu to the tab bar of the variable editor (part bug #53002)
Torsten <mttl@mailbox.org>
parents:
24693
diff
changeset
|
56 #include "shortcut-manager.h" |
27412
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27386
diff
changeset
|
57 #include "variable-editor-model.h" |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
58 #include "variable-editor.h" |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
59 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
60 namespace octave |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
61 { |
27101
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26787
diff
changeset
|
62 // Code reuse functions |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26787
diff
changeset
|
63 |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26787
diff
changeset
|
64 static QString |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26787
diff
changeset
|
65 idx_to_expr (int32_t from, int32_t to) |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26787
diff
changeset
|
66 { |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26787
diff
changeset
|
67 return (from == to |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26787
diff
changeset
|
68 ? QString ("%1").arg (from) |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26787
diff
changeset
|
69 : QString ("%1:%2").arg (from).arg (to)); |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26787
diff
changeset
|
70 } |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26787
diff
changeset
|
71 |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26787
diff
changeset
|
72 static QSignalMapper * |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26787
diff
changeset
|
73 make_plot_mapper (QMenu *menu) |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26787
diff
changeset
|
74 { |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26787
diff
changeset
|
75 QList<QString> list; |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26787
diff
changeset
|
76 list << "plot" << "bar" << "stem" << "stairs" << "area" << "pie" << "hist"; |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26787
diff
changeset
|
77 |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26787
diff
changeset
|
78 QSignalMapper *plot_mapper = new QSignalMapper (menu); |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26787
diff
changeset
|
79 |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26787
diff
changeset
|
80 for (int i = 0; i < list.size(); ++i) |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26787
diff
changeset
|
81 { |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26787
diff
changeset
|
82 plot_mapper->setMapping |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26787
diff
changeset
|
83 (menu->addAction (list.at (i), plot_mapper, SLOT (map ())), |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26787
diff
changeset
|
84 "figure (); " + list.at (i) + " (%1); title (\"%1\");"); |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26787
diff
changeset
|
85 } |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26787
diff
changeset
|
86 |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26787
diff
changeset
|
87 return plot_mapper; |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26787
diff
changeset
|
88 } |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26787
diff
changeset
|
89 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
90 // Variable dock widget |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
91 |
27620
45bb5bbaf291
don't use singleton pattern for resource manager in GUI
John W. Eaton <jwe@octave.org>
parents:
27611
diff
changeset
|
92 variable_dock_widget::variable_dock_widget (QWidget *p, |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
93 base_qobject& oct_qobj) |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
94 : label_dock_widget (p, oct_qobj) |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
95 // See Octave bug #53807 and https://bugreports.qt.io/browse/QTBUG-44813 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
96 #if (QT_VERSION >= 0x050302) && (QT_VERSION <= QTBUG_44813_FIX_VERSION) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
97 , m_waiting_for_mouse_move (false) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
98 , m_waiting_for_mouse_button_release (false) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
99 #endif |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
100 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
101 setFocusPolicy (Qt::StrongFocus); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
102 setAttribute (Qt::WA_DeleteOnClose); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
103 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
104 connect (m_dock_action, SIGNAL (triggered (bool)), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
105 this, SLOT (change_floating (bool))); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
106 connect (m_close_action, SIGNAL (triggered (bool)), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
107 this, SLOT (change_existence (bool))); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
108 connect (this, SIGNAL (topLevelChanged(bool)), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
109 this, SLOT (toplevel_change (bool))); |
24834
6daf8a9bd1ed
hide floating variable widgets when variable editor is hidden
Torsten <mttl@mailbox.org>
parents:
24832
diff
changeset
|
110 connect (p, SIGNAL (visibilityChanged (bool)), |
6daf8a9bd1ed
hide floating variable widgets when variable editor is hidden
Torsten <mttl@mailbox.org>
parents:
24832
diff
changeset
|
111 this, SLOT (setVisible (bool))); |
24858
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
112 |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
113 #if defined (HAVE_QGUIAPPLICATION) |
24865
5f7b9ee5b878
Add a QFrame to the variable editor panels and adjust tooltips (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24858
diff
changeset
|
114 #define DOCKED_FULLSCREEN_BUTTON_TOOLTIP "Fullscreen undock" |
5f7b9ee5b878
Add a QFrame to the variable editor panels and adjust tooltips (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24858
diff
changeset
|
115 #define UNDOCKED_FULLSCREEN_BUTTON_TOOLTIP "Fullscreen" |
24858
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
116 // Add a fullscreen button |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
117 |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
118 m_fullscreen_action = nullptr; |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
119 m_full_screen = false; |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
120 m_prev_floating = false; |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
121 m_prev_geom = QRect (0, 0, 0, 0); |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
122 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
123 QHBoxLayout *h_layout = m_title_widget->findChild<QHBoxLayout *> (); |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
124 resource_manager& rmgr = m_octave_qobj.get_resource_manager (); |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
125 m_fullscreen_action |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
126 = new QAction (rmgr.icon ("view-fullscreen", false), "", this); |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
127 m_fullscreen_action->setToolTip (tr (DOCKED_FULLSCREEN_BUTTON_TOOLTIP)); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
128 QToolButton *fullscreen_button = new QToolButton (m_title_widget); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
129 fullscreen_button->setDefaultAction (m_fullscreen_action); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
130 fullscreen_button->setFocusPolicy (Qt::NoFocus); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
131 fullscreen_button->setIconSize (QSize (m_icon_size,m_icon_size)); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
132 QString css_button = QString ("QToolButton {background: transparent; border: 0px;}"); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
133 fullscreen_button->setStyleSheet (css_button); |
24858
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
134 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
135 connect (m_fullscreen_action, SIGNAL (triggered ()), |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
136 this, SLOT (change_fullscreen ())); |
24858
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
137 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
138 int index = -1; |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
139 QToolButton *first = m_title_widget->findChild<QToolButton *> (); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
140 if (first != nullptr) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
141 index = h_layout->indexOf (first); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
142 h_layout->insertWidget (index, fullscreen_button); |
24858
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
143 #endif |
24865
5f7b9ee5b878
Add a QFrame to the variable editor panels and adjust tooltips (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24858
diff
changeset
|
144 |
5f7b9ee5b878
Add a QFrame to the variable editor panels and adjust tooltips (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24858
diff
changeset
|
145 // Custom title bars cause loss of decorations, add a frame |
5f7b9ee5b878
Add a QFrame to the variable editor panels and adjust tooltips (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24858
diff
changeset
|
146 m_frame = new QFrame (this); |
5f7b9ee5b878
Add a QFrame to the variable editor panels and adjust tooltips (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24858
diff
changeset
|
147 m_frame->setFrameStyle (QFrame::Box | QFrame::Sunken); |
5f7b9ee5b878
Add a QFrame to the variable editor panels and adjust tooltips (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24858
diff
changeset
|
148 m_frame->setAttribute (Qt::WA_TransparentForMouseEvents); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
149 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
150 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
151 // slot for (un)dock action |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
152 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
153 variable_dock_widget::change_floating (bool) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
154 { |
24858
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
155 #if defined (HAVE_QGUIAPPLICATION) |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
156 if (isFloating ()) |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
157 { |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
158 if (m_full_screen) |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
159 { |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
160 setGeometry (m_prev_geom); |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
161 resource_manager& rmgr = m_octave_qobj.get_resource_manager (); |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
162 m_fullscreen_action->setIcon (rmgr.icon ("view-fullscreen", false)); |
24858
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
163 m_full_screen = false; |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
164 } |
24865
5f7b9ee5b878
Add a QFrame to the variable editor panels and adjust tooltips (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24858
diff
changeset
|
165 m_fullscreen_action->setToolTip (tr (DOCKED_FULLSCREEN_BUTTON_TOOLTIP)); |
24858
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
166 } |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
167 else |
24865
5f7b9ee5b878
Add a QFrame to the variable editor panels and adjust tooltips (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24858
diff
changeset
|
168 m_fullscreen_action->setToolTip (tr (UNDOCKED_FULLSCREEN_BUTTON_TOOLTIP)); |
24858
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
169 #endif |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
170 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
171 setFloating (! isFloating ()); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
172 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
173 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
174 // slot for hiding the widget |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
175 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
176 variable_dock_widget::change_existence (bool) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
177 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
178 close (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
179 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
180 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
181 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
182 variable_dock_widget::toplevel_change (bool toplevel) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
183 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
184 if (toplevel) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
185 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
186 m_dock_action->setIcon (QIcon (":/actions/icons/widget-dock.png")); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
187 m_dock_action->setToolTip (tr ("Dock widget")); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
188 |
27383
44c72e41d468
add window decorations to floating variable editor subpanes (bug #55048)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27302
diff
changeset
|
189 setWindowFlags (Qt::Window); |
27386
69dc24383358
more descriptive titles for floating variable editor subpanes
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27383
diff
changeset
|
190 setWindowTitle (tr ("Variable Editor: ") + objectName ()); |
27383
44c72e41d468
add window decorations to floating variable editor subpanes (bug #55048)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27302
diff
changeset
|
191 |
44c72e41d468
add window decorations to floating variable editor subpanes (bug #55048)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27302
diff
changeset
|
192 show (); |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
193 activateWindow (); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
194 setFocus (); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
195 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
196 // See Octave bug #53807 and https://bugreports.qt.io/browse/QTBUG-44813 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
197 #if (QT_VERSION >= 0x050302) && (QT_VERSION <= QTBUG_44813_FIX_VERSION) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
198 m_waiting_for_mouse_move = true; |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
199 #endif |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
200 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
201 else |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
202 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
203 m_dock_action->setIcon (QIcon (":/actions/icons/widget-undock.png")); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
204 m_dock_action->setToolTip (tr ("Undock widget")); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
205 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
206 setFocus (); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
207 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
208 // See Octave bug #53807 and https://bugreports.qt.io/browse/QTBUG-44813 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
209 #if (QT_VERSION >= 0x050302) && (QT_VERSION <= QTBUG_44813_FIX_VERSION) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
210 m_waiting_for_mouse_move = false; |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
211 m_waiting_for_mouse_button_release = false; |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
212 #endif |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
213 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
214 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
215 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
216 void |
24858
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
217 variable_dock_widget::change_fullscreen (void) |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
218 { |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
219 #if defined (HAVE_QGUIAPPLICATION) |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
220 resource_manager& rmgr = m_octave_qobj.get_resource_manager (); |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
221 |
24858
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
222 if (! m_full_screen) |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
223 { |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
224 m_prev_floating = isFloating (); |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
225 m_fullscreen_action->setIcon (rmgr.icon ("view-restore", false)); |
24858
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
226 if (m_prev_floating) |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
227 m_fullscreen_action->setToolTip (tr ("Restore geometry")); |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
228 else |
24865
5f7b9ee5b878
Add a QFrame to the variable editor panels and adjust tooltips (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24858
diff
changeset
|
229 { |
5f7b9ee5b878
Add a QFrame to the variable editor panels and adjust tooltips (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24858
diff
changeset
|
230 m_fullscreen_action->setToolTip (tr ("Redock")); |
5f7b9ee5b878
Add a QFrame to the variable editor panels and adjust tooltips (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24858
diff
changeset
|
231 setFloating (true); |
5f7b9ee5b878
Add a QFrame to the variable editor panels and adjust tooltips (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24858
diff
changeset
|
232 } |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
233 m_prev_geom = geometry (); |
24858
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
234 |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
235 // showFullscreen() and setWindowState() only work for QWindow objects. |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
236 QScreen *pscreen = QGuiApplication::primaryScreen (); |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
237 QRect rect (0, 0, 0, 0); |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
238 rect = pscreen->availableGeometry (); |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
239 setGeometry (rect); |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
240 |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
241 m_full_screen = true; |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
242 } |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
243 else |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
244 { |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
245 m_fullscreen_action->setIcon (rmgr.icon ("view-fullscreen", false)); |
24858
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
246 setGeometry (m_prev_geom); |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
247 if (m_prev_floating) |
24865
5f7b9ee5b878
Add a QFrame to the variable editor panels and adjust tooltips (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24858
diff
changeset
|
248 m_fullscreen_action->setToolTip (tr (UNDOCKED_FULLSCREEN_BUTTON_TOOLTIP)); |
24858
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
249 else |
24865
5f7b9ee5b878
Add a QFrame to the variable editor panels and adjust tooltips (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24858
diff
changeset
|
250 { |
5f7b9ee5b878
Add a QFrame to the variable editor panels and adjust tooltips (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24858
diff
changeset
|
251 setFloating (false); |
5f7b9ee5b878
Add a QFrame to the variable editor panels and adjust tooltips (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24858
diff
changeset
|
252 m_fullscreen_action->setToolTip (tr (DOCKED_FULLSCREEN_BUTTON_TOOLTIP)); |
5f7b9ee5b878
Add a QFrame to the variable editor panels and adjust tooltips (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24858
diff
changeset
|
253 } |
24858
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
254 |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
255 m_full_screen = false; |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
256 } |
24865
5f7b9ee5b878
Add a QFrame to the variable editor panels and adjust tooltips (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24858
diff
changeset
|
257 #undef DOCKED_FULLSCREEN_BUTTON_TOOLTIP |
5f7b9ee5b878
Add a QFrame to the variable editor panels and adjust tooltips (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24858
diff
changeset
|
258 #undef UNDOCKED_FULLSCREEN_BUTTON_TOOLTIP |
24858
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
259 #endif |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
260 } |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
261 |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24843
diff
changeset
|
262 void |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
263 variable_dock_widget::closeEvent (QCloseEvent *e) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
264 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
265 QDockWidget::closeEvent (e); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
266 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
267 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
268 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
269 variable_dock_widget::handle_focus_change (QWidget *old, QWidget *now) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
270 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
271 octave_unused_parameter (now); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
272 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
273 // This is a proxied test |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
274 if (hasFocus ()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
275 { |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
276 if (old == this) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
277 return; |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
278 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
279 if (titleBarWidget () != nullptr) |
24843
bf1bace6d01d
Use OS GUI highlight backgroud color for variable editor name label (bug #53274)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24834
diff
changeset
|
280 { |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
281 QLabel *label = titleBarWidget ()->findChild<QLabel *> (); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
282 if (label != nullptr) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
283 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
284 label->setBackgroundRole (QPalette::Highlight); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
285 label->setStyleSheet ("background-color: palette(highlight); color: palette(highlightedText);"); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
286 } |
24843
bf1bace6d01d
Use OS GUI highlight backgroud color for variable editor name label (bug #53274)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24834
diff
changeset
|
287 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
288 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
289 emit variable_focused_signal (objectName ()); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
290 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
291 else if (old == focusWidget()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
292 { |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
293 if (titleBarWidget () != nullptr) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
294 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
295 QLabel *label = titleBarWidget ()->findChild<QLabel *> (); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
296 if (label != nullptr) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
297 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
298 label->setBackgroundRole (QPalette::NoRole); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
299 label->setStyleSheet (";"); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
300 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
301 } |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
302 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
303 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
304 |
24865
5f7b9ee5b878
Add a QFrame to the variable editor panels and adjust tooltips (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24858
diff
changeset
|
305 void variable_dock_widget::resizeEvent (QResizeEvent *) |
5f7b9ee5b878
Add a QFrame to the variable editor panels and adjust tooltips (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24858
diff
changeset
|
306 { |
5f7b9ee5b878
Add a QFrame to the variable editor panels and adjust tooltips (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24858
diff
changeset
|
307 if (m_frame) |
5f7b9ee5b878
Add a QFrame to the variable editor panels and adjust tooltips (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24858
diff
changeset
|
308 m_frame->resize (size ()); |
5f7b9ee5b878
Add a QFrame to the variable editor panels and adjust tooltips (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24858
diff
changeset
|
309 } |
5f7b9ee5b878
Add a QFrame to the variable editor panels and adjust tooltips (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24858
diff
changeset
|
310 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
311 // See Octave bug #53807 and https://bugreports.qt.io/browse/QTBUG-44813 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
312 #if (QT_VERSION >= 0x050302) && (QT_VERSION <= QTBUG_44813_FIX_VERSION) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
313 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
314 bool |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
315 variable_dock_widget::event (QEvent *event) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
316 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
317 // low-level check of whether docked-widget became a window via |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
318 // via drag-and-drop |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
319 if (event->type () == QEvent::MouseButtonPress) |
25417
b529e3e1393d
Work around for Variable Editor unfloat/float on Ubuntu Unity (bug #53893)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25398
diff
changeset
|
320 { |
b529e3e1393d
Work around for Variable Editor unfloat/float on Ubuntu Unity (bug #53893)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25398
diff
changeset
|
321 m_waiting_for_mouse_move = false; |
b529e3e1393d
Work around for Variable Editor unfloat/float on Ubuntu Unity (bug #53893)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25398
diff
changeset
|
322 m_waiting_for_mouse_button_release = false; |
b529e3e1393d
Work around for Variable Editor unfloat/float on Ubuntu Unity (bug #53893)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25398
diff
changeset
|
323 } |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
324 if (event->type () == QEvent::MouseMove && m_waiting_for_mouse_move) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
325 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
326 m_waiting_for_mouse_move = false; |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
327 m_waiting_for_mouse_button_release = true; |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
328 } |
27935
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
329 if (event->type () == QEvent::MouseButtonRelease |
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
330 && m_waiting_for_mouse_button_release) |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
331 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
332 m_waiting_for_mouse_button_release = false; |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
333 bool retval = QDockWidget::event (event); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
334 if (isFloating ()) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
335 emit queue_unfloat_float (); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
336 return retval; |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
337 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
338 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
339 return QDockWidget::event (event); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
340 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
341 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
342 void |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
343 variable_dock_widget::unfloat_float (void) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
344 { |
25417
b529e3e1393d
Work around for Variable Editor unfloat/float on Ubuntu Unity (bug #53893)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25398
diff
changeset
|
345 hide (); |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
346 setFloating (false); |
25417
b529e3e1393d
Work around for Variable Editor unfloat/float on Ubuntu Unity (bug #53893)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25398
diff
changeset
|
347 // Avoid a Ubunty Unity issue by queuing this rather than direct. |
b529e3e1393d
Work around for Variable Editor unfloat/float on Ubuntu Unity (bug #53893)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25398
diff
changeset
|
348 emit queue_float (); |
b529e3e1393d
Work around for Variable Editor unfloat/float on Ubuntu Unity (bug #53893)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25398
diff
changeset
|
349 m_waiting_for_mouse_move = false; |
b529e3e1393d
Work around for Variable Editor unfloat/float on Ubuntu Unity (bug #53893)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25398
diff
changeset
|
350 m_waiting_for_mouse_button_release = false; |
b529e3e1393d
Work around for Variable Editor unfloat/float on Ubuntu Unity (bug #53893)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25398
diff
changeset
|
351 } |
b529e3e1393d
Work around for Variable Editor unfloat/float on Ubuntu Unity (bug #53893)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25398
diff
changeset
|
352 |
b529e3e1393d
Work around for Variable Editor unfloat/float on Ubuntu Unity (bug #53893)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25398
diff
changeset
|
353 void |
b529e3e1393d
Work around for Variable Editor unfloat/float on Ubuntu Unity (bug #53893)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25398
diff
changeset
|
354 variable_dock_widget::refloat (void) |
b529e3e1393d
Work around for Variable Editor unfloat/float on Ubuntu Unity (bug #53893)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25398
diff
changeset
|
355 { |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
356 setFloating (true); |
25417
b529e3e1393d
Work around for Variable Editor unfloat/float on Ubuntu Unity (bug #53893)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25398
diff
changeset
|
357 m_waiting_for_mouse_move = false; |
b529e3e1393d
Work around for Variable Editor unfloat/float on Ubuntu Unity (bug #53893)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25398
diff
changeset
|
358 m_waiting_for_mouse_button_release = false; |
b529e3e1393d
Work around for Variable Editor unfloat/float on Ubuntu Unity (bug #53893)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25398
diff
changeset
|
359 show (); |
b529e3e1393d
Work around for Variable Editor unfloat/float on Ubuntu Unity (bug #53893)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25398
diff
changeset
|
360 activateWindow (); |
b529e3e1393d
Work around for Variable Editor unfloat/float on Ubuntu Unity (bug #53893)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25398
diff
changeset
|
361 setFocus (); |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
362 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
363 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
364 #else |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
365 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
366 void |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
367 variable_dock_widget::unfloat_float (void) |
27935
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
368 { } |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
369 |
25427
c7e67fcb8630
Supply missing refloat function symbol when QTBUG-44813 is ignored (bug #54051)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25417
diff
changeset
|
370 void |
c7e67fcb8630
Supply missing refloat function symbol when QTBUG-44813 is ignored (bug #54051)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25417
diff
changeset
|
371 variable_dock_widget::refloat (void) |
27935
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
372 { } |
25427
c7e67fcb8630
Supply missing refloat function symbol when QTBUG-44813 is ignored (bug #54051)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25417
diff
changeset
|
373 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
374 #endif |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
375 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
376 // Variable editor stack |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
377 |
27620
45bb5bbaf291
don't use singleton pattern for resource manager in GUI
John W. Eaton <jwe@octave.org>
parents:
27611
diff
changeset
|
378 variable_editor_stack::variable_editor_stack (QWidget *p, |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
379 base_qobject& oct_qobj) |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
380 : QStackedWidget (p), m_octave_qobj (oct_qobj), |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
381 m_edit_view (new variable_editor_view (this, m_octave_qobj)) |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
382 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
383 setFocusPolicy (Qt::StrongFocus); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
384 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
385 m_disp_view = make_disp_view (this); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
386 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
387 addWidget (m_edit_view); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
388 addWidget (m_disp_view); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
389 } |
24694
9b4edcc62936
add contextmenu to the tab bar of the variable editor (part bug #53002)
Torsten <mttl@mailbox.org>
parents:
24693
diff
changeset
|
390 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
391 QTextEdit * |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
392 variable_editor_stack::make_disp_view (QWidget *parent) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
393 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
394 QTextEdit *viewer = new QTextEdit (parent); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
395 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
396 viewer->setLineWrapMode (QTextEdit::NoWrap); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
397 viewer->setReadOnly (true); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
398 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
399 return viewer; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
400 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
401 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
402 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
403 variable_editor_stack::set_editable (bool editable) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
404 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
405 // The QTableView is for editable data models |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
406 // and the QTextEdit is for non-editable models. |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
407 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
408 if (editable) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
409 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
410 if (m_edit_view != nullptr) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
411 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
412 setCurrentWidget (m_edit_view); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
413 setFocusProxy (m_edit_view); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
414 m_edit_view->setFocusPolicy (Qt::StrongFocus); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
415 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
416 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
417 if (m_disp_view != nullptr) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
418 m_disp_view->setFocusPolicy (Qt::NoFocus); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
419 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
420 else |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
421 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
422 if (m_disp_view != nullptr) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
423 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
424 setCurrentWidget (m_disp_view); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
425 setFocusProxy (m_disp_view); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
426 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
427 QAbstractTableModel *model = findChild<QAbstractTableModel *> (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
428 if (model != nullptr) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
429 m_disp_view->setPlainText (model->data (QModelIndex ()).toString ()); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
430 else |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
431 m_disp_view->setPlainText (""); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
432 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
433 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
434 if (m_edit_view != nullptr) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
435 m_edit_view->setFocusPolicy (Qt::NoFocus); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
436 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
437 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
438 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
439 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
440 variable_editor_stack::levelUp (void) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
441 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
442 if (! hasFocus ()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
443 return; |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
444 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
445 QString name = objectName (); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
446 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
447 // FIXME: Is there a better way? |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
448 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
449 if (name.endsWith (')') || name.endsWith ('}')) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
450 { |
27914
a044e50c8dcb
Streamline QRegExp instances in libgu.
Rik <rik@octave.org>
parents:
27893
diff
changeset
|
451 name.remove ( QRegExp ("[({][^({]*[)}]$)") ); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
452 emit edit_variable_signal (name, octave_value ()); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
453 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
454 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
455 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
456 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
457 variable_editor_stack::save (void) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
458 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
459 if (! hasFocus ()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
460 return; |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
461 |
26096
1002b49ce7b3
Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
26058
diff
changeset
|
462 // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved. |
1002b49ce7b3
Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
26058
diff
changeset
|
463 int opts = 0; // No options by default. |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
464 resource_manager& rmgr = m_octave_qobj.get_resource_manager (); |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
465 gui_settings *settings = rmgr.get_settings (); |
27672
a36443e94f8a
simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents:
27668
diff
changeset
|
466 if (! settings->value (global_use_native_dialogs).toBool ()) |
26096
1002b49ce7b3
Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
26058
diff
changeset
|
467 opts = QFileDialog::DontUseNativeDialog; |
1002b49ce7b3
Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
26058
diff
changeset
|
468 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
469 QString name = objectName (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
470 QString file |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
471 = QFileDialog::getSaveFileName (this, |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
472 tr ("Save Variable %1 As").arg (name), |
25062 | 473 // FIXME: Should determine extension from save_default_options |
474 QString ("./%1.txt").arg (name), | |
26096
1002b49ce7b3
Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
26058
diff
changeset
|
475 0, 0, QFileDialog::Option (opts)); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
476 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
477 // FIXME: Type? binary, float-binary, ascii, text, hdf5, matlab format? |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
478 // FIXME: Call octave_value::save_* directly? |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
479 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
480 if (! file.isEmpty ()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
481 emit command_signal (QString ("save (\"%1\", \"%2\");") |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
482 .arg (file) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
483 .arg (name)); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
484 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
485 |
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
486 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
487 // Custom editable variable table view |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
488 |
27620
45bb5bbaf291
don't use singleton pattern for resource manager in GUI
John W. Eaton <jwe@octave.org>
parents:
27611
diff
changeset
|
489 variable_editor_view::variable_editor_view (QWidget *p, |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
490 base_qobject& oct_qobj) |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
491 : QTableView (p), m_octave_qobj (oct_qobj), m_var_model (nullptr) |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
492 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
493 setWordWrap (false); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
494 setContextMenuPolicy (Qt::CustomContextMenu); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
495 setSelectionMode (QAbstractItemView::ContiguousSelection); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
496 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
497 horizontalHeader ()->setContextMenuPolicy (Qt::CustomContextMenu); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
498 verticalHeader ()->setContextMenuPolicy (Qt::CustomContextMenu); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
499 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
500 setHorizontalScrollMode (QAbstractItemView::ScrollPerPixel); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
501 setVerticalScrollMode (QAbstractItemView::ScrollPerPixel); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
502 |
24827
1e0718c1867c
eliminate most Qt version checks
John W. Eaton <jwe@octave.org>
parents:
24821
diff
changeset
|
503 #if defined (HAVE_QHEADERVIEW_SETSECTIONRESIZEMODE) |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
504 verticalHeader ()->setSectionResizeMode (QHeaderView::Interactive); |
24827
1e0718c1867c
eliminate most Qt version checks
John W. Eaton <jwe@octave.org>
parents:
24821
diff
changeset
|
505 #else |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
506 verticalHeader ()->setResizeMode (QHeaderView::Interactive); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
507 #endif |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
508 } |
24697
21d6d80ed427
refactor variable editor model internal representation (bug #53054)
John W. Eaton <jwe@octave.org>
parents:
24694
diff
changeset
|
509 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
510 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
511 variable_editor_view::setModel (QAbstractItemModel *model) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
512 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
513 QTableView::setModel (model); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
514 |
24827
1e0718c1867c
eliminate most Qt version checks
John W. Eaton <jwe@octave.org>
parents:
24821
diff
changeset
|
515 #if defined (HAVE_QHEADERVIEW_SETSECTIONRESIZEMODE) |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
516 horizontalHeader ()->setSectionResizeMode (QHeaderView::Interactive); |
24827
1e0718c1867c
eliminate most Qt version checks
John W. Eaton <jwe@octave.org>
parents:
24821
diff
changeset
|
517 #else |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
518 horizontalHeader ()->setResizeMode (QHeaderView::Interactive); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
519 #endif |
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
520 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
521 m_var_model = parent ()->findChild<variable_editor_model *> (); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
522 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
523 if (m_var_model != nullptr && m_var_model->column_width () > 0) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
524 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
525 // col_width is in characters. The font should be a fixed-width |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
526 // font, so any character will do. If not, you lose! |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
527 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
528 QFontMetrics fm (font ()); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
529 int w = m_var_model->column_width () * fm.width ('0'); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
530 horizontalHeader ()->setDefaultSectionSize (w); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
531 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
532 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
533 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
534 QList<int> |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
535 variable_editor_view::range_selected (void) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
536 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
537 QItemSelectionModel *sel = selectionModel (); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
538 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
539 // Return early if nothing selected. |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
540 if (! sel->hasSelection ()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
541 return QList<int> (); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
542 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
543 QList<QModelIndex> indices = sel->selectedIndexes (); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
544 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
545 // FIXME: Shouldn't this be keyed to octave_idx_type? |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
546 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
547 int32_t from_row = std::numeric_limits<int32_t>::max (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
548 int32_t to_row = 0; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
549 int32_t from_col = std::numeric_limits<int32_t>::max (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
550 int32_t to_col = 0; |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
551 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
552 for (const auto& idx : indices) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
553 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
554 from_row = std::min (from_row, idx.row ()); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
555 to_row = std::max (to_row, idx.row ()); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
556 from_col = std::min (from_col, idx.column ()); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
557 to_col = std::max (to_col, idx.column ()); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
558 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
559 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
560 QVector<int> vect; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
561 vect << from_row + 1 << to_row + 1 << from_col + 1 << to_col + 1; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
562 QList<int> range = QList<int>::fromVector(vect); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
563 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
564 return range; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
565 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
566 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
567 QString |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
568 variable_editor_view::selected_to_octave (void) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
569 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
570 QList<int> range = range_selected (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
571 if (range.isEmpty ()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
572 return objectName (); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
573 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
574 QString rows = idx_to_expr (range.at (0), range.at (1)); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
575 QString cols = idx_to_expr (range.at (2), range.at (3)); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
576 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
577 // FIXME: Does cell need separate handling? Maybe use '{.,.}'? |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
578 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
579 return QString ("%1(%2, %3)").arg (objectName ()).arg (rows).arg (cols); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
580 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
581 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
582 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
583 variable_editor_view::selected_command_requested (const QString& cmd) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
584 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
585 if (! hasFocus ()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
586 return; |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
587 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
588 QString selarg = selected_to_octave (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
589 if (! selarg.isEmpty ()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
590 emit command_signal (cmd.arg (selarg)); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
591 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
592 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
593 void |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25091
diff
changeset
|
594 variable_editor_view::add_edit_actions (QMenu *menu, |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25091
diff
changeset
|
595 const QString& qualifier_string) |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
596 { |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
597 resource_manager& rmgr = m_octave_qobj.get_resource_manager (); |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
598 |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
599 menu->addAction (rmgr.icon ("edit-cut"), |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
600 tr ("Cut") + qualifier_string, |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
601 this, SLOT (cutClipboard ())); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
602 |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
603 menu->addAction (rmgr.icon ("edit-copy"), |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
604 tr ("Copy") + qualifier_string, |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
605 this, SLOT (copyClipboard ())); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
606 |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
607 menu->addAction (rmgr.icon ("edit-paste"), |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
608 tr ("Paste"), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
609 this, SLOT (pasteClipboard ())); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
610 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
611 menu->addSeparator (); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
612 |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
613 menu->addAction (rmgr.icon ("edit-delete"), |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
614 tr ("Clear") + qualifier_string, |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
615 this, SLOT (clearContent ())); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
616 |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
617 menu->addAction (rmgr.icon ("edit-delete"), |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
618 tr ("Delete") + qualifier_string, |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
619 this, SLOT (delete_selected ())); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
620 |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
621 menu->addAction (rmgr.icon ("document-new"), |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
622 tr ("Variable from Selection"), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
623 this, SLOT (createVariable ())); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
624 } |
24697
21d6d80ed427
refactor variable editor model internal representation (bug #53054)
John W. Eaton <jwe@octave.org>
parents:
24694
diff
changeset
|
625 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
626 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
627 variable_editor_view::createContextMenu (const QPoint& qpos) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
628 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
629 QModelIndex index = indexAt (qpos); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
630 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
631 if (index.isValid ()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
632 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
633 QMenu *menu = new QMenu (this); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
634 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
635 add_edit_actions (menu, tr ("")); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
636 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
637 // FIXME: addAction for sort? |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
638 // FIXME: Add icon for transpose. |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
639 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
640 menu->addAction (tr ("Transpose"), this, SLOT (transposeContent ())); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
641 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
642 QItemSelectionModel *sel = selectionModel (); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
643 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
644 QList<QModelIndex> indices = sel->selectedIndexes (); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
645 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
646 if (! indices.isEmpty ()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
647 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
648 menu->addSeparator (); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
649 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
650 QSignalMapper *plot_mapper = make_plot_mapper (menu); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
651 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
652 connect (plot_mapper, SIGNAL (mapped (const QString&)), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
653 this, SLOT (selected_command_requested (const QString&))); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
654 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
655 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
656 menu->exec (mapToGlobal (qpos)); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
657 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
658 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
659 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
660 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
661 variable_editor_view::createColumnMenu (const QPoint& pt) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
662 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
663 int index = horizontalHeader ()->logicalIndexAt (pt); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
664 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
665 if (index < 0 || index > model ()->columnCount ()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
666 return; |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
667 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
668 QList<int> coords = range_selected (); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
669 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
670 bool nothingSelected = coords.isEmpty (); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
671 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
672 bool whole_columns_selected |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
673 = (nothingSelected |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
674 ? false |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
675 : (coords[0] == 1 && coords[1] == model ()->rowCount ())); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
676 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
677 bool current_column_selected |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
678 = nothingSelected ? false : (coords[2] <= index+1 && coords[3] > index); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
679 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
680 int column_selection_count |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
681 = nothingSelected ? 0 : (coords[3] - coords[2] + 1); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
682 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
683 if (! whole_columns_selected || ! current_column_selected) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
684 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
685 selectColumn (index); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
686 column_selection_count = 1; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
687 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
688 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
689 QString column_string |
26787
1ff470c9e9c2
Mark strings for translation in variable editor (bug #55772).
Rik <rik@octave.org>
parents:
26735
diff
changeset
|
690 = column_selection_count > 1 ? tr (" columns") : tr (" column"); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
691 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
692 QMenu *menu = new QMenu (this); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
693 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
694 add_edit_actions (menu, column_string); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
695 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
696 menu->addSeparator (); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
697 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
698 QSignalMapper *plot_mapper = make_plot_mapper (menu); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
699 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
700 connect (plot_mapper, SIGNAL (mapped (const QString&)), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
701 this, SLOT (selected_command_requested (const QString&))); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
702 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
703 QPoint menupos = pt; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
704 menupos.setY (horizontalHeader ()->height ()); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
705 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
706 menu->exec (mapToGlobal (menupos)); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
707 } |
24697
21d6d80ed427
refactor variable editor model internal representation (bug #53054)
John W. Eaton <jwe@octave.org>
parents:
24694
diff
changeset
|
708 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
709 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
710 variable_editor_view::createRowMenu (const QPoint& pt) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
711 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
712 int index = verticalHeader ()->logicalIndexAt (pt); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
713 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
714 if (index < 0 || index > model ()->columnCount ()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
715 return; |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
716 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
717 QList<int> coords = range_selected (); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
718 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
719 bool nothingSelected = coords.isEmpty (); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
720 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
721 bool whole_rows_selected |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
722 = (nothingSelected |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
723 ? false |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
724 : (coords[2] == 1 && coords[3] == model ()->columnCount ())); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
725 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
726 bool current_row_selected |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
727 = (nothingSelected ? false : (coords[0] <= index+1 && coords[1] > index)); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
728 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
729 int rowselection_count = nothingSelected ? 0 : (coords[3] - coords[2] + 1); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
730 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
731 if (! whole_rows_selected || ! current_row_selected) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
732 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
733 selectRow (index); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
734 rowselection_count = 1; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
735 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
736 |
26787
1ff470c9e9c2
Mark strings for translation in variable editor (bug #55772).
Rik <rik@octave.org>
parents:
26735
diff
changeset
|
737 QString row_string = rowselection_count > 1 ? tr (" rows") : tr (" row"); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
738 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
739 QMenu *menu = new QMenu (this); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
740 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
741 add_edit_actions (menu, row_string); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
742 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
743 menu->addSeparator (); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
744 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
745 QSignalMapper *plot_mapper = make_plot_mapper (menu); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
746 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
747 connect (plot_mapper, SIGNAL (mapped (const QString&)), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
748 this, SLOT (selected_command_requested (const QString&))); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
749 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
750 QPoint menupos = pt; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
751 menupos.setX (verticalHeader ()->width ()); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
752 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
753 // FIXME: What was the intent here? |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
754 // setY (verticalHeader ()->sectionPosition (index+1) + |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
755 // verticalHeader ()->sectionSize (index)); |
24697
21d6d80ed427
refactor variable editor model internal representation (bug #53054)
John W. Eaton <jwe@octave.org>
parents:
24694
diff
changeset
|
756 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
757 menu->exec (mapToGlobal (menupos)); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
758 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
759 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
760 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
761 variable_editor_view::createVariable (void) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
762 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
763 // FIXME: Create unnamed1..n if exist ('unnamed', 'var') is true. |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
764 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
765 selected_command_requested ("unnamed = %1"); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
766 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
767 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
768 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
769 variable_editor_view::transposeContent (void) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
770 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
771 if (! hasFocus ()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
772 return; |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
773 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
774 emit command_signal (QString ("%1 = %1';").arg (objectName ())); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
775 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
776 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
777 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
778 variable_editor_view::delete_selected (void) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
779 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
780 if (! hasFocus ()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
781 return; |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
782 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
783 QAbstractItemModel *mod = model (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
784 QList<int> coords = range_selected (); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
785 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
786 if (coords.isEmpty ()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
787 return; |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
788 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
789 bool whole_columns_selected |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
790 = coords[0] == 1 && coords[1] == mod->rowCount (); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
791 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
792 bool whole_rows_selected |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
793 = coords[2] == 1 && coords[3] == mod->columnCount (); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
794 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
795 // Must be deleting whole columns or whole rows, and not the whole thing. |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
796 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
797 if (whole_columns_selected == whole_rows_selected) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
798 return; |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
799 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
800 if (whole_rows_selected) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
801 mod->removeRows (coords[0], coords[1] - coords[0]); |
24697
21d6d80ed427
refactor variable editor model internal representation (bug #53054)
John W. Eaton <jwe@octave.org>
parents:
24694
diff
changeset
|
802 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
803 if (whole_columns_selected) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
804 mod->removeColumns (coords[2], coords[3] - coords[2]); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
805 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
806 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
807 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
808 variable_editor_view::clearContent (void) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
809 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
810 if (! hasFocus ()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
811 return; |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
812 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
813 if (m_var_model == nullptr) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
814 return; |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
815 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
816 QItemSelectionModel *sel = selectionModel (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
817 QList<QModelIndex> indices = sel->selectedIndexes (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
818 |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
819 // FIXME: Use [] for empty cells? |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
820 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
821 for (const auto& idx : indices) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
822 m_var_model->clear_content (idx); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
823 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
824 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
825 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
826 variable_editor_view::cutClipboard (void) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
827 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
828 copyClipboard (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
829 |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
830 clearContent (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
831 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
832 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
833 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
834 variable_editor_view::copyClipboard (void) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
835 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
836 if (! hasFocus ()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
837 return; |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
838 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
839 QItemSelectionModel *sel = selectionModel (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
840 QList<QModelIndex> indices = sel->selectedIndexes (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
841 qSort (indices); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
842 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
843 if (indices.isEmpty ()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
844 return; |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
845 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
846 // Convert selected items into TSV format and copy that. |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
847 // Spreadsheet tools should understand that. |
24758
09364b41ddb6
allow dynamic resizing of display rows and columns in variable editor
John W. Eaton <jwe@octave.org>
parents:
24708
diff
changeset
|
848 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
849 QAbstractItemModel *mod = model (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
850 QModelIndex previous = indices.first (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
851 QString copy = mod->data (previous).toString (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
852 indices.removeFirst (); |
27676
ea7d36e9f197
use standard C++ range-based for loops instead of Qt foreach macro
John W. Eaton <jwe@octave.org>
parents:
27672
diff
changeset
|
853 for (auto idx : indices) |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
854 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
855 copy.push_back (previous.row () != idx.row () ? '\n' : '\t'); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
856 copy.append (mod->data (idx).toString ()); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
857 previous = idx; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
858 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
859 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
860 QClipboard *clipboard = QApplication::clipboard (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
861 clipboard->setText (copy); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
862 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
863 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
864 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
865 variable_editor_view::pasteClipboard (void) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
866 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
867 if (! hasFocus ()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
868 return; |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
869 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
870 QAbstractItemModel *mod = model (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
871 QItemSelectionModel *sel = selectionModel (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
872 QList<QModelIndex> indices = sel->selectedIndexes (); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
873 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
874 QClipboard *clipboard = QApplication::clipboard (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
875 QString text = clipboard->text (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
876 |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
877 QPoint start, end; |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
878 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
879 QPoint tabsize = QPoint (mod->rowCount (), mod->columnCount ()); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
880 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
881 if (indices.isEmpty ()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
882 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
883 start = QPoint (0,0); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
884 end = tabsize; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
885 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
886 else if (indices.size () == 1) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
887 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
888 start = QPoint (indices[0].row (), indices[0].column ()); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
889 end = tabsize; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
890 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
891 else |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
892 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
893 end = QPoint (0,0); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
894 start = tabsize; |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
895 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
896 for (int i = 0; i < indices.size (); i++) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
897 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
898 if (indices[i].column () < start.y ()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
899 start.setY (indices[i].column ()); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
900 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
901 if (indices[i].column () > end.y ()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
902 end.setY (indices[i].column ()); |
24758
09364b41ddb6
allow dynamic resizing of display rows and columns in variable editor
John W. Eaton <jwe@octave.org>
parents:
24708
diff
changeset
|
903 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
904 if (indices[i].row () < start.x ()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
905 start.setX (indices[i].column ()); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
906 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
907 if (indices[i].row () > end.x ()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
908 end.setX (indices[i].column ()); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
909 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
910 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
911 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
912 int rownum = 0; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
913 int colnum = 0; |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
914 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
915 QStringList rows = text.split ('\n'); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
916 for (const auto& row : rows) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
917 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
918 if (rownum > end.x () - start.x ()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
919 continue; |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
920 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
921 QStringList cols = row.split ('\t'); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
922 if (cols.isEmpty ()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
923 continue; |
24758
09364b41ddb6
allow dynamic resizing of display rows and columns in variable editor
John W. Eaton <jwe@octave.org>
parents:
24708
diff
changeset
|
924 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
925 for (const auto& col : cols) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
926 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
927 if (col.isEmpty ()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
928 continue; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
929 if (colnum > end.y () - start.y () ) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
930 continue; |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
931 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
932 mod->setData (mod->index (rownum + start.x (), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
933 colnum + start.y ()), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
934 QVariant (col)); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
935 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
936 colnum++; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
937 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
938 |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
939 colnum = 0; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
940 rownum++; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
941 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
942 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
943 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
944 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
945 variable_editor_view::handle_horizontal_scroll_action (int action) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
946 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
947 if (action == QAbstractSlider::SliderSingleStepAdd |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
948 || action == QAbstractSlider::SliderPageStepAdd |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
949 || action == QAbstractSlider::SliderToMaximum |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
950 || action == QAbstractSlider::SliderMove) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
951 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
952 if (m_var_model != nullptr) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
953 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
954 QScrollBar *sb = horizontalScrollBar (); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
955 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
956 if (sb && sb->value () == sb->maximum ()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
957 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
958 int new_cols = m_var_model->display_columns () + 16; |
24758
09364b41ddb6
allow dynamic resizing of display rows and columns in variable editor
John W. Eaton <jwe@octave.org>
parents:
24708
diff
changeset
|
959 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
960 m_var_model->maybe_resize_columns (new_cols); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
961 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
962 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
963 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
964 } |
24758
09364b41ddb6
allow dynamic resizing of display rows and columns in variable editor
John W. Eaton <jwe@octave.org>
parents:
24708
diff
changeset
|
965 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
966 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
967 variable_editor_view::handle_vertical_scroll_action (int action) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
968 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
969 if (action == QAbstractSlider::SliderSingleStepAdd |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
970 || action == QAbstractSlider::SliderPageStepAdd |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
971 || action == QAbstractSlider::SliderToMaximum |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
972 || action == QAbstractSlider::SliderMove) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
973 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
974 if (m_var_model != nullptr) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
975 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
976 QScrollBar *sb = verticalScrollBar (); |
24762
ed2d9ef336a7
resize varible editor model on scrollbar actions
John W. Eaton <jwe@octave.org>
parents:
24758
diff
changeset
|
977 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
978 if (sb && sb->value () == sb->maximum ()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
979 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
980 int new_rows = m_var_model->display_rows () + 16; |
24762
ed2d9ef336a7
resize varible editor model on scrollbar actions
John W. Eaton <jwe@octave.org>
parents:
24758
diff
changeset
|
981 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
982 m_var_model->maybe_resize_rows (new_rows); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
983 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
984 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
985 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
986 } |
24762
ed2d9ef336a7
resize varible editor model on scrollbar actions
John W. Eaton <jwe@octave.org>
parents:
24758
diff
changeset
|
987 |
24694
9b4edcc62936
add contextmenu to the tab bar of the variable editor (part bug #53002)
Torsten <mttl@mailbox.org>
parents:
24693
diff
changeset
|
988 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
989 // Gadgets for focus restoration |
24694
9b4edcc62936
add contextmenu to the tab bar of the variable editor (part bug #53002)
Torsten <mttl@mailbox.org>
parents:
24693
diff
changeset
|
990 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
991 HoverToolButton::HoverToolButton (QWidget *parent) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
992 : QToolButton (parent) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
993 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
994 installEventFilter (this); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
995 } |
24694
9b4edcc62936
add contextmenu to the tab bar of the variable editor (part bug #53002)
Torsten <mttl@mailbox.org>
parents:
24693
diff
changeset
|
996 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
997 bool HoverToolButton::eventFilter (QObject *obj, QEvent *ev) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
998 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
999 if (ev->type () == QEvent::HoverEnter) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1000 emit hovered_signal (); |
25239
565d724ecf50
maint: remove redundant test on HoverToolButton (bug #53315).
Rik <rik@octave.org>
parents:
25199
diff
changeset
|
1001 else if (ev->type () == QEvent::MouseButtonPress) |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1002 emit popup_shown_signal (); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
1003 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1004 return QToolButton::eventFilter (obj, ev); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1005 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
1006 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1007 ReturnFocusToolButton::ReturnFocusToolButton (QWidget *parent) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1008 : HoverToolButton (parent) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1009 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1010 installEventFilter (this); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1011 } |
24694
9b4edcc62936
add contextmenu to the tab bar of the variable editor (part bug #53002)
Torsten <mttl@mailbox.org>
parents:
24693
diff
changeset
|
1012 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1013 bool ReturnFocusToolButton::eventFilter (QObject *obj, QEvent *ev) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1014 { |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
1015 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1016 if (ev->type () == QEvent::MouseButtonRelease && isDown ()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1017 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1018 emit about_to_activate (); |
24694
9b4edcc62936
add contextmenu to the tab bar of the variable editor (part bug #53002)
Torsten <mttl@mailbox.org>
parents:
24693
diff
changeset
|
1019 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1020 setDown (false); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1021 QAction *action = defaultAction (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1022 if (action != nullptr) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1023 action->activate (QAction::Trigger); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
1024 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1025 return true; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1026 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
1027 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1028 return HoverToolButton::eventFilter (obj, ev); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1029 } |
24697
21d6d80ed427
refactor variable editor model internal representation (bug #53054)
John W. Eaton <jwe@octave.org>
parents:
24694
diff
changeset
|
1030 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1031 ReturnFocusMenu::ReturnFocusMenu (QWidget *parent) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1032 : QMenu (parent) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1033 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1034 installEventFilter (this); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1035 } |
24697
21d6d80ed427
refactor variable editor model internal representation (bug #53054)
John W. Eaton <jwe@octave.org>
parents:
24694
diff
changeset
|
1036 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1037 bool ReturnFocusMenu::eventFilter (QObject *obj, QEvent *ev) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1038 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1039 if (ev->type () == QEvent::MouseButtonRelease && underMouse ()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1040 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1041 emit about_to_activate (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1042 } |
24697
21d6d80ed427
refactor variable editor model internal representation (bug #53054)
John W. Eaton <jwe@octave.org>
parents:
24694
diff
changeset
|
1043 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1044 return QMenu::eventFilter (obj, ev); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1045 } |
24694
9b4edcc62936
add contextmenu to the tab bar of the variable editor (part bug #53002)
Torsten <mttl@mailbox.org>
parents:
24693
diff
changeset
|
1046 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1047 // Variable editor. |
24694
9b4edcc62936
add contextmenu to the tab bar of the variable editor (part bug #53002)
Torsten <mttl@mailbox.org>
parents:
24693
diff
changeset
|
1048 |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1049 variable_editor::variable_editor (QWidget *p, base_qobject& oct_qobj) |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1050 : octave_dock_widget ("VariableEditor", p, oct_qobj), |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1051 m_main (new dw_main_window (oct_qobj)), |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1052 m_tool_bar (new QToolBar (m_main)), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1053 m_default_width (30), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1054 m_default_height (100), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1055 m_add_font_height (0), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1056 m_use_terminal_font (true), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1057 m_alternate_rows (true), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1058 m_stylesheet (""), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1059 m_font (), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1060 m_sel_font (), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1061 m_table_colors (), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1062 m_current_focus_vname (""), |
25220
07bddddc5856
Restore Variable Editor focusWidget lost in dock/undock transition (bug #53410)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25199
diff
changeset
|
1063 m_hovered_focus_vname (""), |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1064 m_focus_widget (nullptr), |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1065 m_focus_widget_vdw (nullptr) |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1066 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1067 set_title (tr ("Variable Editor")); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1068 setStatusTip (tr ("Edit variables.")); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1069 setWindowIcon (QIcon (":/actions/icons/logo.png")); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1070 setAttribute (Qt::WA_AlwaysShowToolTips); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
1071 |
25091
2b8442c890d8
Fix locked GUI panels for Qt 5.6.1 through 5.7.0 series versions (bug #53409)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25062
diff
changeset
|
1072 m_main->setParent (this); |
2b8442c890d8
Fix locked GUI panels for Qt 5.6.1 through 5.7.0 series versions (bug #53409)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25062
diff
changeset
|
1073 // See Octave bug #53409 and https://bugreports.qt.io/browse/QTBUG-55357 |
2b8442c890d8
Fix locked GUI panels for Qt 5.6.1 through 5.7.0 series versions (bug #53409)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25062
diff
changeset
|
1074 #if (QT_VERSION < 0x050601) || (QT_VERSION >= 0x050701) |
2b8442c890d8
Fix locked GUI panels for Qt 5.6.1 through 5.7.0 series versions (bug #53409)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25062
diff
changeset
|
1075 m_main->setDockOptions (QMainWindow::AnimatedDocks | |
2b8442c890d8
Fix locked GUI panels for Qt 5.6.1 through 5.7.0 series versions (bug #53409)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25062
diff
changeset
|
1076 QMainWindow::AllowNestedDocks | |
2b8442c890d8
Fix locked GUI panels for Qt 5.6.1 through 5.7.0 series versions (bug #53409)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25062
diff
changeset
|
1077 QMainWindow::VerticalTabs); |
2b8442c890d8
Fix locked GUI panels for Qt 5.6.1 through 5.7.0 series versions (bug #53409)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25062
diff
changeset
|
1078 #else |
2b8442c890d8
Fix locked GUI panels for Qt 5.6.1 through 5.7.0 series versions (bug #53409)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25062
diff
changeset
|
1079 m_main->setDockNestingEnabled (true); |
2b8442c890d8
Fix locked GUI panels for Qt 5.6.1 through 5.7.0 series versions (bug #53409)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25062
diff
changeset
|
1080 #endif |
2b8442c890d8
Fix locked GUI panels for Qt 5.6.1 through 5.7.0 series versions (bug #53409)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25062
diff
changeset
|
1081 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1082 // Tool Bar. |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
1083 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1084 construct_tool_bar (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1085 m_main->addToolBar (m_tool_bar); |
24621
2bb3f3de0b4e
more style fixes for variable editor
John W. Eaton <jwe@octave.org>
parents:
24585
diff
changeset
|
1086 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1087 // Colors. |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
1088 |
27662
3b078b750181
replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
1089 for (int i = 0; i < ve_colors_count; i++) |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1090 m_table_colors.append (QColor (Qt::white)); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
1091 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1092 // Use an MDI area that is shrunk to nothing as the central widget. |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1093 // Future feature might be to switch to MDI mode in which the dock |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1094 // area is shrunk to nothing and the widgets live in the MDI window. |
24703
28211444585e
style fixes for variable editor
John W. Eaton <jwe@octave.org>
parents:
24701
diff
changeset
|
1095 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1096 QMdiArea *central_mdiarea = new QMdiArea (m_main); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1097 central_mdiarea->setMinimumSize (QSize (0, 0)); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1098 central_mdiarea->setMaximumSize (QSize (0, 0)); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1099 central_mdiarea->resize (QSize (0, 0)); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1100 m_main->setCentralWidget (central_mdiarea); |
24703
28211444585e
style fixes for variable editor
John W. Eaton <jwe@octave.org>
parents:
24701
diff
changeset
|
1101 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1102 setWidget (m_main); |
24703
28211444585e
style fixes for variable editor
John W. Eaton <jwe@octave.org>
parents:
24701
diff
changeset
|
1103 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1104 connect (this, SIGNAL (command_signal (const QString&)), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1105 p, SLOT (execute_command_in_terminal (const QString&))); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1106 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
1107 |
25199
8cff7eceee87
Do Variable Editor focus retention and titlebar highlight properly (bug #53410).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25192
diff
changeset
|
1108 void variable_editor::focusInEvent (QFocusEvent *ev) |
8cff7eceee87
Do Variable Editor focus retention and titlebar highlight properly (bug #53410).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25192
diff
changeset
|
1109 { |
8cff7eceee87
Do Variable Editor focus retention and titlebar highlight properly (bug #53410).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25192
diff
changeset
|
1110 octave_dock_widget::focusInEvent (ev); |
8cff7eceee87
Do Variable Editor focus retention and titlebar highlight properly (bug #53410).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25192
diff
changeset
|
1111 |
25220
07bddddc5856
Restore Variable Editor focusWidget lost in dock/undock transition (bug #53410)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25199
diff
changeset
|
1112 // set focus to the current variable or most recent if still valid |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1113 if (m_focus_widget != nullptr) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1114 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1115 // Activating a floating window causes problems. |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1116 if (! m_focus_widget_vdw->isFloating ()) |
27935
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
1117 activateWindow (); |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1118 m_focus_widget->setFocus (); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1119 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1120 else |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1121 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1122 QWidget *fw = m_main->focusWidget (); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1123 if (fw != nullptr) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1124 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1125 activateWindow (); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1126 fw->setFocus (); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1127 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1128 else |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1129 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1130 QDockWidget *any_qdw = m_main->findChild<QDockWidget *> (); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1131 if (any_qdw != nullptr) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1132 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1133 activateWindow (); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1134 any_qdw->setFocus (); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1135 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1136 else |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1137 setFocus(); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1138 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1139 } |
25199
8cff7eceee87
Do Variable Editor focus retention and titlebar highlight properly (bug #53410).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25192
diff
changeset
|
1140 } |
8cff7eceee87
Do Variable Editor focus retention and titlebar highlight properly (bug #53410).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25192
diff
changeset
|
1141 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1142 // Add an action to a menu or the widget itself. |
24694
9b4edcc62936
add contextmenu to the tab bar of the variable editor (part bug #53002)
Torsten <mttl@mailbox.org>
parents:
24693
diff
changeset
|
1143 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1144 QAction* |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25091
diff
changeset
|
1145 variable_editor::add_action (QMenu *menu, const QIcon& icon, |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25091
diff
changeset
|
1146 const QString& text, |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1147 const char *member) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1148 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1149 QAction *a; |
24694
9b4edcc62936
add contextmenu to the tab bar of the variable editor (part bug #53002)
Torsten <mttl@mailbox.org>
parents:
24693
diff
changeset
|
1150 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1151 if (menu) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1152 a = menu->addAction (icon, text, this, member); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1153 else |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1154 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1155 a = new QAction (this); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1156 connect (a, SIGNAL (triggered ()), this, member); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1157 } |
24694
9b4edcc62936
add contextmenu to the tab bar of the variable editor (part bug #53002)
Torsten <mttl@mailbox.org>
parents:
24693
diff
changeset
|
1158 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1159 addAction (a); // important for shortcut context |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1160 a->setShortcutContext (Qt::WidgetWithChildrenShortcut); |
24694
9b4edcc62936
add contextmenu to the tab bar of the variable editor (part bug #53002)
Torsten <mttl@mailbox.org>
parents:
24693
diff
changeset
|
1161 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1162 return a; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1163 } |
24694
9b4edcc62936
add contextmenu to the tab bar of the variable editor (part bug #53002)
Torsten <mttl@mailbox.org>
parents:
24693
diff
changeset
|
1164 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1165 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1166 variable_editor::edit_variable (const QString& name, const octave_value& val) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1167 { |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1168 resource_manager& rmgr = m_octave_qobj.get_resource_manager (); |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1169 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1170 if (m_stylesheet.isEmpty ()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1171 { |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1172 gui_settings *settings = rmgr.get_settings (); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1173 notice_settings (settings); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1174 } |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
1175 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1176 QDockWidget *existing_qdw = m_main->findChild<QDockWidget *> (name); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1177 if (existing_qdw != NULL) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1178 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1179 // Already open. |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
1180 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1181 // Put current focused variable out of focus |
24975
241b80a7d8c7
Prevent openvar() crash when called twice with same variable (bug #53411)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24865
diff
changeset
|
1182 if (m_main->focusWidget () != nullptr) |
241b80a7d8c7
Prevent openvar() crash when called twice with same variable (bug #53411)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24865
diff
changeset
|
1183 { |
241b80a7d8c7
Prevent openvar() crash when called twice with same variable (bug #53411)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24865
diff
changeset
|
1184 QFocusEvent event (QEvent::FocusOut, Qt::OtherFocusReason); |
241b80a7d8c7
Prevent openvar() crash when called twice with same variable (bug #53411)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24865
diff
changeset
|
1185 QApplication::sendEvent (m_main->focusWidget (), &event); |
241b80a7d8c7
Prevent openvar() crash when called twice with same variable (bug #53411)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24865
diff
changeset
|
1186 } |
24621
2bb3f3de0b4e
more style fixes for variable editor
John W. Eaton <jwe@octave.org>
parents:
24585
diff
changeset
|
1187 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1188 // Put existing variable in focus and raise |
25178
4e79e324f441
Focus variable panel when Variable Editor comes from hidden state (bug #53443).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25168
diff
changeset
|
1189 m_main->parentWidget ()->show (); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1190 existing_qdw->show (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1191 existing_qdw->raise (); |
24975
241b80a7d8c7
Prevent openvar() crash when called twice with same variable (bug #53411)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24865
diff
changeset
|
1192 existing_qdw->activateWindow (); |
25168
8c38361718a9
When Variable Editor is tabbed, activate that tab via openvar (bug #53443).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
1193 tab_to_front (); |
8c38361718a9
When Variable Editor is tabbed, activate that tab via openvar (bug #53443).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
1194 existing_qdw->setFocus (); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
1195 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1196 return; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1197 } |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
1198 |
27620
45bb5bbaf291
don't use singleton pattern for resource manager in GUI
John W. Eaton <jwe@octave.org>
parents:
27611
diff
changeset
|
1199 variable_dock_widget *page |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1200 = new variable_dock_widget (this, m_octave_qobj); |
27620
45bb5bbaf291
don't use singleton pattern for resource manager in GUI
John W. Eaton <jwe@octave.org>
parents:
27611
diff
changeset
|
1201 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1202 page->setObjectName (name); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1203 m_main->addDockWidget (Qt::LeftDockWidgetArea, page); |
24621
2bb3f3de0b4e
more style fixes for variable editor
John W. Eaton <jwe@octave.org>
parents:
24585
diff
changeset
|
1204 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1205 connect (QApplication::instance(), SIGNAL (focusChanged (QWidget *, QWidget *)), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1206 page, SLOT (handle_focus_change (QWidget *, QWidget *))); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1207 connect (page, SIGNAL (destroyed (QObject *)), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1208 this, SLOT (variable_destroyed (QObject *))); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1209 connect (page, SIGNAL (variable_focused_signal (const QString&)), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1210 this, SLOT (variable_focused (const QString&))); |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1211 // See Octave bug #53807 and https://bugreports.qt.io/browse/QTBUG-44813 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1212 #if (QT_VERSION >= 0x050302) && (QT_VERSION <= QTBUG_44813_FIX_VERSION) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1213 connect (page, SIGNAL (queue_unfloat_float ()), |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1214 page, SLOT (unfloat_float ()), Qt::QueuedConnection); |
25417
b529e3e1393d
Work around for Variable Editor unfloat/float on Ubuntu Unity (bug #53893)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25398
diff
changeset
|
1215 connect (page, SIGNAL (queue_float ()), |
b529e3e1393d
Work around for Variable Editor unfloat/float on Ubuntu Unity (bug #53893)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25398
diff
changeset
|
1216 page, SLOT (refloat ()), Qt::QueuedConnection); |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1217 #endif |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
1218 |
27620
45bb5bbaf291
don't use singleton pattern for resource manager in GUI
John W. Eaton <jwe@octave.org>
parents:
27611
diff
changeset
|
1219 variable_editor_stack *stack |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1220 = new variable_editor_stack (page, m_octave_qobj); |
27620
45bb5bbaf291
don't use singleton pattern for resource manager in GUI
John W. Eaton <jwe@octave.org>
parents:
27611
diff
changeset
|
1221 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1222 stack->setObjectName (name); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1223 page->setWidget (stack); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1224 page->setFocusProxy (stack); |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
1225 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1226 connect (stack, SIGNAL (command_signal (const QString&)), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1227 this, SIGNAL (command_signal (const QString&))); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1228 connect (stack, SIGNAL (edit_variable_signal (const QString&, const octave_value&)), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1229 this, SLOT (edit_variable (const QString&, const octave_value&))); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1230 connect (this, SIGNAL (level_up_signal ()), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1231 stack, SLOT (levelUp ())); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1232 connect (this, SIGNAL (save_signal ()), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1233 stack, SLOT (save ())); |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
1234 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1235 variable_editor_view *edit_view = stack->edit_view (); |
24697
21d6d80ed427
refactor variable editor model internal representation (bug #53054)
John W. Eaton <jwe@octave.org>
parents:
24694
diff
changeset
|
1236 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1237 edit_view->setObjectName (name); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1238 edit_view->setFont (m_font); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1239 edit_view->setStyleSheet (m_stylesheet); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1240 edit_view->setAlternatingRowColors (m_alternate_rows); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1241 edit_view->verticalHeader ()->setDefaultSectionSize (m_default_height |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1242 + m_add_font_height); |
24697
21d6d80ed427
refactor variable editor model internal representation (bug #53054)
John W. Eaton <jwe@octave.org>
parents:
24694
diff
changeset
|
1243 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1244 connect (edit_view, SIGNAL (command_signal (const QString&)), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1245 this, SIGNAL (command_signal (const QString&))); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1246 connect (this, SIGNAL (delete_selected_signal ()), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1247 edit_view, SLOT (delete_selected ())); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1248 connect (this, SIGNAL (clear_content_signal ()), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1249 edit_view, SLOT (clearContent ())); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1250 connect (this, SIGNAL (copy_clipboard_signal ()), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1251 edit_view, SLOT (copyClipboard ())); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1252 connect (this, SIGNAL (paste_clipboard_signal ()), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1253 edit_view, SLOT (pasteClipboard ())); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1254 connect (this, SIGNAL (selected_command_signal (const QString&)), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1255 edit_view, SLOT (selected_command_requested (const QString&))); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1256 connect (edit_view->horizontalHeader (), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1257 SIGNAL (customContextMenuRequested (const QPoint&)), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1258 edit_view, SLOT (createColumnMenu (const QPoint&))); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1259 connect (edit_view->verticalHeader (), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1260 SIGNAL (customContextMenuRequested (const QPoint&)), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1261 edit_view, SLOT (createRowMenu (const QPoint&))); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1262 connect (edit_view, SIGNAL (customContextMenuRequested (const QPoint&)), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1263 edit_view, SLOT (createContextMenu (const QPoint&))); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1264 connect (edit_view->horizontalScrollBar (), SIGNAL (actionTriggered (int)), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1265 edit_view, SLOT (handle_horizontal_scroll_action (int))); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1266 connect (edit_view->verticalScrollBar (), SIGNAL (actionTriggered (int)), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1267 edit_view, SLOT (handle_vertical_scroll_action (int))); |
24697
21d6d80ed427
refactor variable editor model internal representation (bug #53054)
John W. Eaton <jwe@octave.org>
parents:
24694
diff
changeset
|
1268 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1269 variable_editor_model *model = |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1270 new variable_editor_model (name, val, stack); |
24697
21d6d80ed427
refactor variable editor model internal representation (bug #53054)
John W. Eaton <jwe@octave.org>
parents:
24694
diff
changeset
|
1271 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1272 connect (model, SIGNAL (edit_variable_signal (const QString&, const octave_value&)), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1273 this, SLOT (edit_variable (const QString&, const octave_value&))); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1274 connect (model, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1275 this, SLOT (callUpdate (const QModelIndex&, const QModelIndex&))); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1276 connect (this, SIGNAL (refresh_signal ()), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1277 model, SLOT (update_data_cache ())); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1278 connect (model, SIGNAL (set_editable_signal (bool)), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1279 stack, SLOT (set_editable (bool))); |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
1280 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1281 edit_view->setModel (model); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1282 connect (edit_view, SIGNAL (doubleClicked (const QModelIndex&)), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1283 model, SLOT (double_click (const QModelIndex&))); |
24762
ed2d9ef336a7
resize varible editor model on scrollbar actions
John W. Eaton <jwe@octave.org>
parents:
24758
diff
changeset
|
1284 |
27302
5f170ea12fa1
use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents:
27101
diff
changeset
|
1285 // Any interpreter_event signal from a variable_editor_model object is |
5f170ea12fa1
use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents:
27101
diff
changeset
|
1286 // handled the same as for the parent variable_editor object. |
5f170ea12fa1
use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents:
27101
diff
changeset
|
1287 |
5f170ea12fa1
use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents:
27101
diff
changeset
|
1288 connect (model, SIGNAL (interpreter_event (const fcn_callback&)), |
5f170ea12fa1
use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents:
27101
diff
changeset
|
1289 this, SIGNAL (interpreter_event (const fcn_callback&))); |
5f170ea12fa1
use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents:
27101
diff
changeset
|
1290 |
5f170ea12fa1
use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents:
27101
diff
changeset
|
1291 connect (model, SIGNAL (interpreter_event (const meth_callback&)), |
5f170ea12fa1
use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents:
27101
diff
changeset
|
1292 this, SIGNAL (interpreter_event (const meth_callback&))); |
5f170ea12fa1
use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents:
27101
diff
changeset
|
1293 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1294 // Must supply a title for a QLabel to be created. Calling set_title() |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1295 // more than once will add more QLabels. Could change octave_dock_widget |
27893
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27726
diff
changeset
|
1296 // to always supply a QLabel (initially empty) and then simply update its |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1297 // contents. |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1298 page->set_title (name); |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1299 if (page->titleBarWidget () != nullptr) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1300 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1301 QLabel *existing_ql = page->titleBarWidget ()->findChild<QLabel *> (); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1302 connect (model, SIGNAL (update_label_signal (const QString&)), |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1303 existing_ql, SLOT (setText (const QString&))); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1304 existing_ql->setMargin (2); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1305 } |
24669
15fe766fbaf5
set initial size of variable editor columns based on data
John W. Eaton <jwe@octave.org>
parents:
24651
diff
changeset
|
1306 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1307 model->update_data (val); |
24697
21d6d80ed427
refactor variable editor model internal representation (bug #53054)
John W. Eaton <jwe@octave.org>
parents:
24694
diff
changeset
|
1308 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1309 QList<QTableView *> viewlist = findChildren<QTableView *> (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1310 if (viewlist.size () == 1) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1311 m_tool_bar->setEnabled (true); |
24975
241b80a7d8c7
Prevent openvar() crash when called twice with same variable (bug #53411)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24865
diff
changeset
|
1312 |
25178
4e79e324f441
Focus variable panel when Variable Editor comes from hidden state (bug #53443).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25168
diff
changeset
|
1313 m_main->parentWidget ()->show (); |
24975
241b80a7d8c7
Prevent openvar() crash when called twice with same variable (bug #53411)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24865
diff
changeset
|
1314 page->show (); |
241b80a7d8c7
Prevent openvar() crash when called twice with same variable (bug #53411)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24865
diff
changeset
|
1315 page->raise (); |
241b80a7d8c7
Prevent openvar() crash when called twice with same variable (bug #53411)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24865
diff
changeset
|
1316 page->activateWindow (); |
25168
8c38361718a9
When Variable Editor is tabbed, activate that tab via openvar (bug #53443).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
1317 tab_to_front (); |
8c38361718a9
When Variable Editor is tabbed, activate that tab via openvar (bug #53443).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
1318 page->setFocus (); |
8c38361718a9
When Variable Editor is tabbed, activate that tab via openvar (bug #53443).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
1319 } |
8c38361718a9
When Variable Editor is tabbed, activate that tab via openvar (bug #53443).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
1320 |
8c38361718a9
When Variable Editor is tabbed, activate that tab via openvar (bug #53443).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
1321 void |
8c38361718a9
When Variable Editor is tabbed, activate that tab via openvar (bug #53443).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
1322 variable_editor::tab_to_front (void) |
8c38361718a9
When Variable Editor is tabbed, activate that tab via openvar (bug #53443).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
1323 { |
8c38361718a9
When Variable Editor is tabbed, activate that tab via openvar (bug #53443).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
1324 if (parent () != nullptr) |
8c38361718a9
When Variable Editor is tabbed, activate that tab via openvar (bug #53443).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
1325 { |
8c38361718a9
When Variable Editor is tabbed, activate that tab via openvar (bug #53443).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
1326 QList<QTabBar *> barlist = main_win ()->findChildren<QTabBar *> (); |
25192
8cc3213f788f
clean up variable editor method for style and compiler warnings (bug #53443)
Mike Miller <mtmiller@octave.org>
parents:
25190
diff
changeset
|
1327 QVariant this_value (reinterpret_cast<quintptr> (this)); |
25168
8c38361718a9
When Variable Editor is tabbed, activate that tab via openvar (bug #53443).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
1328 |
27676
ea7d36e9f197
use standard C++ range-based for loops instead of Qt foreach macro
John W. Eaton <jwe@octave.org>
parents:
27672
diff
changeset
|
1329 for (auto *tbar : barlist) |
25192
8cc3213f788f
clean up variable editor method for style and compiler warnings (bug #53443)
Mike Miller <mtmiller@octave.org>
parents:
25190
diff
changeset
|
1330 for (int i = 0; i < tbar->count (); i++) |
8cc3213f788f
clean up variable editor method for style and compiler warnings (bug #53443)
Mike Miller <mtmiller@octave.org>
parents:
25190
diff
changeset
|
1331 if (tbar->tabData (i) == this_value) |
25168
8c38361718a9
When Variable Editor is tabbed, activate that tab via openvar (bug #53443).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
1332 { |
25192
8cc3213f788f
clean up variable editor method for style and compiler warnings (bug #53443)
Mike Miller <mtmiller@octave.org>
parents:
25190
diff
changeset
|
1333 tbar->setCurrentIndex (i); |
8cc3213f788f
clean up variable editor method for style and compiler warnings (bug #53443)
Mike Miller <mtmiller@octave.org>
parents:
25190
diff
changeset
|
1334 return; |
25168
8c38361718a9
When Variable Editor is tabbed, activate that tab via openvar (bug #53443).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
1335 } |
8c38361718a9
When Variable Editor is tabbed, activate that tab via openvar (bug #53443).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
1336 } |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1337 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
1338 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1339 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1340 variable_editor::refresh (void) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1341 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1342 emit refresh_signal (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1343 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
1344 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1345 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1346 variable_editor::callUpdate (const QModelIndex&, const QModelIndex&) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1347 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1348 emit updated (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1349 } |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
1350 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1351 void |
27611
0495b64288f7
use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
27583
diff
changeset
|
1352 variable_editor::notice_settings (const gui_settings *settings) |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1353 { |
25398
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
1354 m_main->notice_settings (settings); // update settings in parent main win |
24621
2bb3f3de0b4e
more style fixes for variable editor
John W. Eaton <jwe@octave.org>
parents:
24585
diff
changeset
|
1355 |
27672
a36443e94f8a
simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents:
27668
diff
changeset
|
1356 m_default_width = settings->value (ve_column_width).toInt (); |
24585
8a4aedbb3e5a
style fixes for variable editor
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1357 |
27672
a36443e94f8a
simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents:
27668
diff
changeset
|
1358 m_default_height = settings->value (ve_row_height).toInt (); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
1359 |
27672
a36443e94f8a
simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents:
27668
diff
changeset
|
1360 m_alternate_rows = settings->value (ve_alternate_rows).toBool (); |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1361 |
27672
a36443e94f8a
simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents:
27668
diff
changeset
|
1362 m_use_terminal_font = settings->value (ve_use_terminal_font).toBool (); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
1363 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1364 QString font_name; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1365 int font_size; |
27672
a36443e94f8a
simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents:
27668
diff
changeset
|
1366 QString default_font = settings->value (global_mono_font).toString (); |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
1367 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1368 if (m_use_terminal_font) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1369 { |
26008
38a881b8fbec
do not use courier new as default font (bug #54086)
Torsten <mttl@mailbox.org>
parents:
25952
diff
changeset
|
1370 font_name = settings->value (cs_font.key, default_font).toString (); |
27672
a36443e94f8a
simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents:
27668
diff
changeset
|
1371 font_size = settings->value (cs_font_size).toInt (); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1372 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1373 else |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1374 { |
27662
3b078b750181
replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
1375 font_name = settings->value (ve_font_name.key, default_font).toString (); |
27672
a36443e94f8a
simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents:
27668
diff
changeset
|
1376 font_size = settings->value (ve_font_size).toInt (); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1377 } |
24585
8a4aedbb3e5a
style fixes for variable editor
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1378 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1379 m_font = QFont (font_name, font_size); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
1380 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1381 QFontMetrics fm (m_font); |
24585
8a4aedbb3e5a
style fixes for variable editor
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1382 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1383 m_add_font_height = fm.height (); |
23943
f5b81e587bb5
only enable toolbar of variable editor if a tab is present
Torsten <mttl@mailbox.org>
parents:
23936
diff
changeset
|
1384 |
27662
3b078b750181
replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
1385 for (int i = 0; i < ve_colors_count; i++) |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1386 { |
27662
3b078b750181
replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
1387 // The default colors are given as color roles for |
3b078b750181
replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
1388 // the application's palette |
3b078b750181
replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
1389 QColor default_color = qApp->palette ().color |
27935
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
1390 (static_cast<QPalette::ColorRole> (ve_colors[i].def.toInt ())); |
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
1391 // FIXME: use value<QPalette::ColorRole> instead of static cast after |
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
1392 // dropping support of Qt 5.4 |
27726
b2c11742b7ec
add FIXMEs for replacing static casts by Qvariants value<T> after Qt 5.4
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27676
diff
changeset
|
1393 |
27662
3b078b750181
replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
1394 QColor setting_color = |
27935
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
1395 settings->value (ve_colors[i].key, default_color).value<QColor> (); |
24639
1c90b6d357ec
more style fixes for variable editor
John W. Eaton <jwe@octave.org>
parents:
24633
diff
changeset
|
1396 |
27662
3b078b750181
replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
1397 m_table_colors.replace (i, setting_color); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1398 } |
24585
8a4aedbb3e5a
style fixes for variable editor
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1399 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1400 update_colors (); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
1401 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1402 // Icon size in the toolbar. |
24621
2bb3f3de0b4e
more style fixes for variable editor
John W. Eaton <jwe@octave.org>
parents:
24585
diff
changeset
|
1403 |
27672
a36443e94f8a
simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents:
27668
diff
changeset
|
1404 int size_idx = settings->value (global_icon_size).toInt (); |
26058
ecd86b8b8979
use constants for icon size preferences instead of hard coded numbers
Torsten <mttl@mailbox.org>
parents:
26008
diff
changeset
|
1405 size_idx = (size_idx > 0) - (size_idx < 0) + 1; // Make valid index from 0 to 2 |
24621
2bb3f3de0b4e
more style fixes for variable editor
John W. Eaton <jwe@octave.org>
parents:
24585
diff
changeset
|
1406 |
26058
ecd86b8b8979
use constants for icon size preferences instead of hard coded numbers
Torsten <mttl@mailbox.org>
parents:
26008
diff
changeset
|
1407 QStyle *st = style (); |
ecd86b8b8979
use constants for icon size preferences instead of hard coded numbers
Torsten <mttl@mailbox.org>
parents:
26008
diff
changeset
|
1408 int icon_size = st->pixelMetric (global_icon_sizes[size_idx]); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1409 m_tool_bar->setIconSize (QSize (icon_size, icon_size)); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1410 } |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
1411 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1412 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1413 variable_editor::closeEvent (QCloseEvent *e) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1414 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1415 emit finished (); |
24585
8a4aedbb3e5a
style fixes for variable editor
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1416 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1417 octave_dock_widget::closeEvent (e); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1418 } |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
1419 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1420 void |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1421 variable_editor::variable_destroyed (QObject *obj) |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1422 { |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1423 // Invalidate the focus-restoring widget pointer if currently active. |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1424 if (m_focus_widget_vdw == obj) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1425 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1426 m_focus_widget = nullptr; |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1427 m_focus_widget_vdw = nullptr; |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1428 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1429 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1430 // If no variable pages remain, deactivate the tool bar. |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1431 QList<variable_dock_widget *> vdwlist = findChildren<variable_dock_widget *> (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1432 if (vdwlist.isEmpty ()) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1433 m_tool_bar->setEnabled (false); |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1434 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1435 QFocusEvent ev (QEvent::FocusIn); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1436 focusInEvent (&ev); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1437 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
1438 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1439 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1440 variable_editor::variable_focused (const QString &name) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1441 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1442 m_current_focus_vname = name; |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1443 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1444 // focusWidget() appears lost in transition to/from main window |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1445 // so keep a record of the widget. |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1446 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1447 QWidget *current = QApplication::focusWidget (); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1448 m_focus_widget = nullptr; |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1449 m_focus_widget_vdw = nullptr; |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1450 if (current != nullptr) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1451 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1452 QList<variable_dock_widget *> vdwlist = findChildren<variable_dock_widget *> (); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1453 for (int i = 0; i < vdwlist.size (); i++) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1454 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1455 variable_dock_widget *vdw = vdwlist.at (i); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1456 if (vdw->isAncestorOf (current)) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1457 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1458 m_focus_widget = current; |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1459 m_focus_widget_vdw = vdw; |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1460 break; |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1461 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1462 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25258
diff
changeset
|
1463 } |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1464 } |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
1465 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1466 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1467 variable_editor::record_hovered_focus_variable (void) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1468 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1469 m_hovered_focus_vname = m_current_focus_vname; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1470 } |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
1471 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1472 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1473 variable_editor::restore_hovered_focus_variable (void) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1474 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1475 variable_dock_widget *tofocus = findChild<variable_dock_widget *> (m_hovered_focus_vname); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1476 if (tofocus != nullptr) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1477 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1478 // Note that this may be platform and window system dependent. |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1479 // On a particular Linux system, activateWindow() alone didn't |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1480 // immediately set the active window and there was a race |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1481 // between the window focus and action signal. Setting the |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1482 // active window via the QApplication route did work. |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1483 QApplication::setActiveWindow(tofocus->window()); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1484 tofocus->activateWindow (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1485 tofocus->setFocus (Qt::OtherFocusReason); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1486 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1487 } |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
1488 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1489 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1490 variable_editor::save (void) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1491 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1492 emit save_signal (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1493 } |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
1494 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1495 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1496 variable_editor::cutClipboard (void) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1497 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1498 copyClipboard (); |
24585
8a4aedbb3e5a
style fixes for variable editor
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1499 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1500 emit clear_content_signal (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1501 } |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
1502 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1503 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1504 variable_editor::copyClipboard (void) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1505 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1506 emit copy_clipboard_signal (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1507 } |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
1508 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1509 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1510 variable_editor::pasteClipboard (void) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1511 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1512 emit paste_clipboard_signal (); |
24585
8a4aedbb3e5a
style fixes for variable editor
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1513 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1514 emit updated (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1515 } |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
1516 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1517 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1518 variable_editor::levelUp (void) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1519 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1520 emit level_up_signal (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1521 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
1522 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1523 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1524 variable_editor::relay_selected_command (const QString& cmd) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1525 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1526 emit selected_command_signal (cmd); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1527 } |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
1528 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1529 // Also updates the font. |
24621
2bb3f3de0b4e
more style fixes for variable editor
John W. Eaton <jwe@octave.org>
parents:
24585
diff
changeset
|
1530 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1531 void variable_editor::update_colors (void) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1532 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1533 m_stylesheet = ""; |
24585
8a4aedbb3e5a
style fixes for variable editor
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1534 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1535 if (m_table_colors.length () > 0) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1536 m_stylesheet += "QTableView::item{ foreground-color: " |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25091
diff
changeset
|
1537 + m_table_colors[0].name () +" }"; |
24585
8a4aedbb3e5a
style fixes for variable editor
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1538 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1539 if (m_table_colors.length () > 1) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1540 m_stylesheet += "QTableView::item{ background-color: " |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25091
diff
changeset
|
1541 + m_table_colors[1].name () +" }"; |
24585
8a4aedbb3e5a
style fixes for variable editor
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1542 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1543 if (m_table_colors.length () > 2) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1544 m_stylesheet += "QTableView::item{ selection-color: " |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25091
diff
changeset
|
1545 + m_table_colors[2].name () +" }"; |
24585
8a4aedbb3e5a
style fixes for variable editor
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1546 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1547 if (m_table_colors.length () > 3) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1548 m_stylesheet += "QTableView::item:selected{ background-color: " |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25091
diff
changeset
|
1549 + m_table_colors[3].name () +" }"; |
24585
8a4aedbb3e5a
style fixes for variable editor
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1550 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1551 if (m_table_colors.length () > 4 && m_alternate_rows) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1552 { |
27935
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
1553 m_stylesheet += "QTableView::item:alternate{ background-color: " |
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
1554 + m_table_colors[4].name () +" }"; |
24585
8a4aedbb3e5a
style fixes for variable editor
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1555 |
27935
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
1556 m_stylesheet += "QTableView::item:alternate:selected{ background-color: " |
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
1557 + m_table_colors[3].name () +" }"; |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1558 } |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
1559 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1560 QList<QTableView *> viewlist = findChildren<QTableView *> (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1561 for (int i = 0; i < viewlist.size (); i++) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1562 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1563 QTableView *view = viewlist.at (i); |
24697
21d6d80ed427
refactor variable editor model internal representation (bug #53054)
John W. Eaton <jwe@octave.org>
parents:
24694
diff
changeset
|
1564 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1565 if (! view) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1566 continue; |
24697
21d6d80ed427
refactor variable editor model internal representation (bug #53054)
John W. Eaton <jwe@octave.org>
parents:
24694
diff
changeset
|
1567 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1568 view->setAlternatingRowColors (m_alternate_rows); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1569 view->setStyleSheet (m_stylesheet); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1570 view->setFont (m_font); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1571 } |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
1572 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1573 } |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
1574 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1575 QAction * |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1576 variable_editor::add_tool_bar_button (const QIcon &icon, |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1577 const QString &text, |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1578 const QObject *receiver, |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1579 const char *member) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1580 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1581 QAction *action = new QAction (icon, text, this); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1582 connect(action, SIGNAL (triggered ()), receiver, member); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1583 QToolButton *button = new ReturnFocusToolButton (m_tool_bar); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1584 button->setDefaultAction (action); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1585 button->setText (text); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1586 button->setToolTip (text); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1587 button->setIcon (icon); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1588 m_tool_bar->addWidget (button); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
1589 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1590 return action; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1591 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
1592 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1593 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1594 variable_editor::construct_tool_bar (void) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1595 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1596 m_tool_bar->setAllowedAreas (Qt::TopToolBarArea); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1597 |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1598 m_tool_bar->setObjectName ("VariableEditorToolBar"); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1599 |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1600 m_tool_bar->setWindowTitle (tr ("Variable Editor Toolbar")); |
24703
28211444585e
style fixes for variable editor
John W. Eaton <jwe@octave.org>
parents:
24701
diff
changeset
|
1601 |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1602 resource_manager& rmgr = m_octave_qobj.get_resource_manager (); |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1603 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1604 QAction *action; |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1605 action = add_tool_bar_button (rmgr.icon ("document-save"), tr ("Save"), |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1606 this, SLOT (save ())); |
26735
48fbd27c6490
fix the shortcut context for savin a variable in variable editor (bug #54464)
Torsten <mttl@mailbox.org>
parents:
26554
diff
changeset
|
1607 addAction (action); |
48fbd27c6490
fix the shortcut context for savin a variable in variable editor (bug #54464)
Torsten <mttl@mailbox.org>
parents:
26554
diff
changeset
|
1608 action->setShortcutContext (Qt::WidgetWithChildrenShortcut); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1609 action->setShortcuts (QKeySequence::Save); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1610 action->setStatusTip(tr("Save variable to a file")); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
1611 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1612 m_tool_bar->addSeparator (); |
24029
1d184b55416a
Use Octave conventions in variable editor code.
Rik <rik@octave.org>
parents:
24028
diff
changeset
|
1613 |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1614 action = add_tool_bar_button (rmgr.icon ("edit-cut"), tr ("Cut"), |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1615 this, SLOT (cutClipboard ())); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1616 action->setStatusTip(tr("Cut data to clipboard")); |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
1617 |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1618 action = add_tool_bar_button (rmgr.icon ("edit-copy"), tr ("Copy"), |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1619 this, SLOT (copyClipboard ())); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1620 action->setStatusTip(tr("Copy data to clipboard")); |
24585
8a4aedbb3e5a
style fixes for variable editor
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1621 |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1622 action = add_tool_bar_button (rmgr.icon ("edit-paste"), tr ("Paste"), |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1623 this, SLOT (pasteClipboard ())); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1624 action->setStatusTip(tr("Paste clipboard into variable data")); |
24585
8a4aedbb3e5a
style fixes for variable editor
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1625 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1626 m_tool_bar->addSeparator (); |
24029
1d184b55416a
Use Octave conventions in variable editor code.
Rik <rik@octave.org>
parents:
24028
diff
changeset
|
1627 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1628 // FIXME: Add a print item? |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1629 // QAction *print_action; /icons/fileprint.png |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1630 // m_tool_bar->addSeparator (); |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
1631 |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1632 action = new QAction (rmgr.icon ("plot-xy-curve"), tr ("Plot"), m_tool_bar); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1633 action->setToolTip (tr ("Plot Selected Data")); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1634 QToolButton *plot_tool_button = new HoverToolButton (m_tool_bar); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1635 plot_tool_button->setDefaultAction (action); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
1636 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1637 plot_tool_button->setText (tr ("Plot")); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1638 plot_tool_button->setToolTip (tr ("Plot selected data")); |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1639 plot_tool_button->setIcon (rmgr.icon ("plot-xy-curve")); |
24703
28211444585e
style fixes for variable editor
John W. Eaton <jwe@octave.org>
parents:
24701
diff
changeset
|
1640 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1641 plot_tool_button->setPopupMode (QToolButton::InstantPopup); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
1642 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1643 QMenu *plot_menu = new ReturnFocusMenu (plot_tool_button); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1644 plot_menu->setTitle (tr ("Plot")); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1645 plot_menu->setSeparatorsCollapsible (false); |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
1646 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1647 QSignalMapper *plot_mapper = make_plot_mapper (plot_menu); |
24585
8a4aedbb3e5a
style fixes for variable editor
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1648 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1649 connect (plot_mapper, SIGNAL (mapped (const QString&)), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1650 this, SLOT (relay_selected_command (const QString&))); |
24585
8a4aedbb3e5a
style fixes for variable editor
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1651 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1652 plot_tool_button->setMenu (plot_menu); |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
1653 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1654 m_tool_bar->addWidget (plot_tool_button); |
24585
8a4aedbb3e5a
style fixes for variable editor
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1655 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1656 m_tool_bar->addSeparator (); |
24585
8a4aedbb3e5a
style fixes for variable editor
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1657 |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1658 action = add_tool_bar_button (rmgr.icon ("go-up"), tr ("Up"), this, |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1659 SLOT (levelUp ())); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1660 action->setStatusTip(tr("Go one level up in variable hierarchy")); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
1661 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1662 // The QToolButton mouse-clicks change active window, so connect all |
27893
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27726
diff
changeset
|
1663 // HoverToolButton and ReturnFocusToolButton objects to the mechanism |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1664 // that restores active window and focus before acting. |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1665 QList<HoverToolButton *> hbuttonlist |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1666 = m_tool_bar->findChildren<HoverToolButton *> ("" |
24821
88665923596c
Make variable editor code compile under Qt4 (bug #53259)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24812
diff
changeset
|
1667 #if defined (QOBJECT_FINDCHILDREN_ACCEPTS_FINDCHILDOPTIONS) |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1668 , Qt::FindDirectChildrenOnly |
24821
88665923596c
Make variable editor code compile under Qt4 (bug #53259)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24812
diff
changeset
|
1669 #endif |
27935
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
1670 ); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1671 for (int i = 0; i < hbuttonlist.size (); i++) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1672 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1673 connect (hbuttonlist.at (i), SIGNAL (hovered_signal ()), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1674 this, SLOT (record_hovered_focus_variable ())); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1675 connect (hbuttonlist.at (i), SIGNAL (popup_shown_signal ()), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1676 this, SLOT (restore_hovered_focus_variable ())); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1677 } |
24821
88665923596c
Make variable editor code compile under Qt4 (bug #53259)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24812
diff
changeset
|
1678 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1679 QList<ReturnFocusToolButton *> rfbuttonlist |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1680 = m_tool_bar->findChildren<ReturnFocusToolButton *> ("" |
24821
88665923596c
Make variable editor code compile under Qt4 (bug #53259)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24812
diff
changeset
|
1681 #if defined (QOBJECT_FINDCHILDREN_ACCEPTS_FINDCHILDOPTIONS) |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1682 , Qt::FindDirectChildrenOnly |
24821
88665923596c
Make variable editor code compile under Qt4 (bug #53259)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24812
diff
changeset
|
1683 #endif |
27935
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
1684 ); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1685 for (int i = 0; i < rfbuttonlist.size (); i++) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1686 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1687 connect (rfbuttonlist.at (i), SIGNAL (about_to_activate ()), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1688 this, SLOT (restore_hovered_focus_variable ())); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1689 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
1690 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1691 // Same for QMenu |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1692 QList<ReturnFocusMenu *> menulist |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1693 = m_tool_bar->findChildren<ReturnFocusMenu *> (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1694 for (int i = 0; i < menulist.size (); i++) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1695 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1696 connect (menulist.at (i), SIGNAL (about_to_activate ()), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1697 this, SLOT (restore_hovered_focus_variable ())); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1698 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24765
diff
changeset
|
1699 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1700 m_tool_bar->setAttribute(Qt::WA_ShowWithoutActivating); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1701 m_tool_bar->setFocusPolicy (Qt::NoFocus); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
1702 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1703 // Disabled when no tab is present. |
24621
2bb3f3de0b4e
more style fixes for variable editor
John W. Eaton <jwe@octave.org>
parents:
24585
diff
changeset
|
1704 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1705 m_tool_bar->setEnabled (false); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24827
diff
changeset
|
1706 } |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
1707 } |