Mercurial > octave
annotate libgui/src/workspace-view.cc @ 31646:c6d54dd31a7e stable
maint: Use macros to begin/end C++ namespaces.
* BaseControl.cc, BaseControl.h, ButtonControl.cc, ButtonControl.h,
ButtonGroup.cc, ButtonGroup.h, Canvas.cc, Canvas.h,
CheckBoxControl.cc, CheckBoxControl.h, Container.cc, Container.h,
ContextMenu.cc, ContextMenu.h, EditControl.cc, EditControl.h,
Figure.cc, Figure.h, FigureWindow.cc, FigureWindow.h, GLCanvas.cc,
GLCanvas.h, GenericEventNotify.h, KeyMap.cc, KeyMap.h,
ListBoxControl.cc, ListBoxControl.h, Logger.cc, Logger.h, Menu.cc,
Menu.h, MenuContainer.h, Object.cc, Object.h, ObjectProxy.cc,
ObjectProxy.h, Panel.cc, Panel.h, PopupMenuControl.cc,
PopupMenuControl.h, PushButtonControl.cc, PushButtonControl.h,
PushTool.cc, PushTool.h, QtHandlesUtils.cc, QtHandlesUtils.h,
RadioButtonControl.cc, RadioButtonControl.h, SliderControl.cc,
SliderControl.h, Table.cc, Table.h, TextControl.cc, TextControl.h,
TextEdit.cc, TextEdit.h, ToggleButtonControl.cc,
ToggleButtonControl.h, ToggleTool.cc, ToggleTool.h, ToolBar.cc,
ToolBar.h, ToolBarButton.cc, ToolBarButton.h, annotation-dialog.cc,
annotation-dialog.h, gl-select.cc, gl-select.h, qopengl-functions.h,
qt-graphics-toolkit.cc, qt-graphics-toolkit.h, QTerminal.h,
color-picker.cc, color-picker.h, command-widget.cc, command-widget.h,
community-news.cc, community-news.h, dialog.cc, dialog.h,
documentation-bookmarks.cc, documentation-bookmarks.h,
documentation-dock-widget.cc, documentation-dock-widget.h,
documentation.cc, documentation.h, dw-main-window.cc,
dw-main-window.h, external-editor-interface.cc,
external-editor-interface.h, files-dock-widget.cc,
files-dock-widget.h, find-files-dialog.cc, find-files-dialog.h,
find-files-model.cc, find-files-model.h, graphics-init.cc,
graphics-init.h, gui-settings.cc, gui-settings.h, gui-utils.cc,
gui-utils.h, history-dock-widget.cc, history-dock-widget.h,
interpreter-qobject.cc, interpreter-qobject.h, led-indicator.cc,
led-indicator.h, file-editor-interface.h, file-editor-tab.cc,
file-editor-tab.h, file-editor.cc, file-editor.h, find-dialog.cc,
find-dialog.h, marker.cc, marker.h, octave-qscintilla.cc,
octave-qscintilla.h, octave-txt-lexer.cc, octave-txt-lexer.h,
main-window.cc, main-window.h, news-reader.cc, news-reader.h,
octave-dock-widget.cc, octave-dock-widget.h, octave-qobject.cc,
octave-qobject.h, qt-application.cc, qt-application.h,
qt-interpreter-events.cc, qt-interpreter-events.h, qt-utils.h,
release-notes.cc, release-notes.h, resource-manager.cc,
resource-manager.h, set-path-dialog.cc, set-path-dialog.h,
set-path-model.cc, set-path-model.h, settings-dialog.cc,
settings-dialog.h, shortcut-manager.cc, shortcut-manager.h,
tab-bar.cc, tab-bar.h, terminal-dock-widget.cc,
terminal-dock-widget.h, variable-editor-model.cc,
variable-editor-model.h, variable-editor.cc, variable-editor.h,
welcome-wizard.cc, welcome-wizard.h, workspace-model.cc,
workspace-model.h, workspace-view.cc, workspace-view.h:
Use new macros to begin/end C++ namespaces.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 06 Dec 2022 14:37:51 -0500 |
parents | 04601f6c47f4 |
children | 431f80aba37a 29d734430e5f |
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 // |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
30398
diff
changeset
|
3 // Copyright (C) 2011-2022 The Octave Project Developers |
27923
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 //////////////////////////////////////////////////////////////////////// |
13501 | 25 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21568
diff
changeset
|
26 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21203
diff
changeset
|
27 # include "config.h" |
15286
ae9079bbc627
Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents:
15204
diff
changeset
|
28 #endif |
ae9079bbc627
Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents:
15204
diff
changeset
|
29 |
16521
dbc7018be4be
use context menu for workspace viewer rename and copy to clipboard operations
John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
30 #include <QApplication> |
dbc7018be4be
use context menu for workspace viewer rename and copy to clipboard operations
John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
31 #include <QClipboard> |
27412
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27377
diff
changeset
|
32 #include <QCompleter> |
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27377
diff
changeset
|
33 #include <QHBoxLayout> |
15460
7f36f7dc25b2
save and restore the columns order and width of the workspace-view
Torsten <ttl@justmail.de>
parents:
15389
diff
changeset
|
34 #include <QHeaderView> |
27412
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27377
diff
changeset
|
35 #include <QInputDialog> |
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27377
diff
changeset
|
36 #include <QLabel> |
16502
45ae1038ee89
allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents:
16478
diff
changeset
|
37 #include <QLineEdit> |
16462
8c666c7b0e5d
Added context menu to workspace variable display
John Donoghue <john.donoghue@ieee.org>
parents:
16459
diff
changeset
|
38 #include <QMenu> |
27412
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27377
diff
changeset
|
39 #include <QMessageBox> |
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27377
diff
changeset
|
40 #include <QPushButton> |
20641
2b0886f2c186
add possibility to hide columns of workspace view
Torsten <ttl@justmail.de>
parents:
20570
diff
changeset
|
41 #include <QSignalMapper> |
13501 | 42 #include <QVBoxLayout> |
43 | |
27560
3fcc650de22f
split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
27478
diff
changeset
|
44 #include "gui-preferences-ws.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
|
45 #include "octave-qobject.h" |
29560
5b7e721844df
provide QOverload template if it is not in <QtGlobal> (bug #60416)
John W. Eaton <jwe@octave.org>
parents:
29542
diff
changeset
|
46 #include "octave-qtutils.h" |
16502
45ae1038ee89
allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents:
16478
diff
changeset
|
47 #include "workspace-view.h" |
23599
5cb3a2bb5e1e
don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents:
23449
diff
changeset
|
48 |
31646
c6d54dd31a7e
maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents:
30964
diff
changeset
|
49 OCTAVE_BEGIN_NAMESPACE(octave) |
c6d54dd31a7e
maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents:
30964
diff
changeset
|
50 |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
51 workspace_view::workspace_view (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
|
52 : octave_dock_widget ("WorkspaceView", p, oct_qobj), |
27610
8586eb41abf5
improve memory management in workspace_view class
John W. Eaton <jwe@octave.org>
parents:
27560
diff
changeset
|
53 m_view (new QTableView (this)), |
8586eb41abf5
improve memory management in workspace_view class
John W. Eaton <jwe@octave.org>
parents:
27560
diff
changeset
|
54 m_filter_checkbox (new QCheckBox ()), |
8586eb41abf5
improve memory management in workspace_view class
John W. Eaton <jwe@octave.org>
parents:
27560
diff
changeset
|
55 m_filter (new QComboBox (this)), |
8586eb41abf5
improve memory management in workspace_view class
John W. Eaton <jwe@octave.org>
parents:
27560
diff
changeset
|
56 m_filter_widget (new QWidget (this)) |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
57 { |
25508
3edae6ba1fcd
use a custom title bar widget for the main dock widgets
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
58 set_title (tr ("Workspace")); |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
59 setStatusTip (tr ("View the variables in the active workspace.")); |
13523
103b7bebb38f
Moved load/save/clear workspace into main menu.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13506
diff
changeset
|
60 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
61 m_filter->setToolTip (tr ("Enter text to filter the workspace")); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
62 m_filter->setEditable (true); |
27660
30e84a3d58e5
replace preference literals by symbolic constants for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
63 m_filter->setMaxCount (ws_max_filter_history.def.toInt ()); |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
64 m_filter->setInsertPolicy (QComboBox::NoInsert); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
65 m_filter->setSizeAdjustPolicy (QComboBox::AdjustToMinimumContentsLengthWithIcon); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
66 QSizePolicy sizePol (QSizePolicy::Expanding, QSizePolicy::Preferred); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
67 m_filter->setSizePolicy (sizePol); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
68 m_filter->completer ()->setCaseSensitivity (Qt::CaseSensitive); |
19538
e4b25475ef3d
provide a filter for the workspace view (bug #41222)
Torsten <ttl@justmail.de>
parents:
19433
diff
changeset
|
69 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
70 QLabel *filter_label = new QLabel (tr ("Filter")); |
19538
e4b25475ef3d
provide a filter for the workspace view (bug #41222)
Torsten <ttl@justmail.de>
parents:
19433
diff
changeset
|
71 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
72 m_view->setWordWrap (false); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
73 m_view->setContextMenuPolicy (Qt::CustomContextMenu); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
74 m_view->setShowGrid (false); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
75 (m_view->verticalHeader) ()->hide (); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
76 m_view->setAlternatingRowColors (true); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
77 m_view_previous_row_count = 0; |
13523
103b7bebb38f
Moved load/save/clear workspace into main menu.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13506
diff
changeset
|
78 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
79 // Set an empty widget, so we can assign a layout to it. |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
80 setWidget (new QWidget (this)); |
14874
5d74d8b982a5
Forgot to have a fallback lexer when the file suffix is unknown. Removed unused variable and added comments.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
14783
diff
changeset
|
81 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
82 // Create the layouts |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
83 QHBoxLayout *filter_layout = new QHBoxLayout (); |
20570
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20388
diff
changeset
|
84 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
85 filter_layout->addWidget (filter_label); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
86 filter_layout->addWidget (m_filter_checkbox); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
87 filter_layout->addWidget (m_filter); |
27478
9e526393d80a
reduced vertical space in gui with responsive toolbar buttons (bug #53902)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27467
diff
changeset
|
88 filter_layout->setMargin (0); |
9e526393d80a
reduced vertical space in gui with responsive toolbar buttons (bug #53902)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27467
diff
changeset
|
89 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
90 m_filter_widget->setLayout (filter_layout); |
20570
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20388
diff
changeset
|
91 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
92 QVBoxLayout *ws_layout = new QVBoxLayout (); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
93 ws_layout->addWidget (m_filter_widget); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
94 ws_layout->addWidget (m_view); |
27478
9e526393d80a
reduced vertical space in gui with responsive toolbar buttons (bug #53902)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27467
diff
changeset
|
95 ws_layout->setSpacing (0); |
20570
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20388
diff
changeset
|
96 |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
97 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
|
98 gui_settings *settings = rmgr.get_settings (); |
20570
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20388
diff
changeset
|
99 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
100 if (settings) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
101 { |
27672
a36443e94f8a
simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents:
27660
diff
changeset
|
102 m_filter_shown = settings->value (ws_filter_shown).toBool (); |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
103 m_filter_widget->setVisible (m_filter_shown); |
14874
5d74d8b982a5
Forgot to have a fallback lexer when the file suffix is unknown. Removed unused variable and added comments.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
14783
diff
changeset
|
104 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
105 ws_layout->setMargin (2); |
13501 | 106 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
107 // Set the empty widget to have our layout. |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
108 widget ()->setLayout (ws_layout); |
22177
6e9f5408c0db
Save settings in Qt convention, delete all children in destructors (bug #45366)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
21724
diff
changeset
|
109 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
110 // Initialize collapse/expand state of the workspace subcategories. |
15164
bc801a44bb1f
follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents:
14997
diff
changeset
|
111 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
112 //enable sorting (setting column and order after model was set) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
113 m_view->setSortingEnabled (true); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
114 // Initialize column order and width of the workspace |
27276
7455523fdf01
style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents:
27220
diff
changeset
|
115 m_view->horizontalHeader ()->restoreState |
27660
30e84a3d58e5
replace preference literals by symbolic constants for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
116 (settings->value (ws_column_state.key).toByteArray ()); |
22250
2fd4f1a3f4a8
allow building with Qt5 (bug #40252)
John W. Eaton <jwe@octave.org>
parents:
22177
diff
changeset
|
117 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
118 // Set header properties for sorting |
24827
1e0718c1867c
eliminate most Qt version checks
John W. Eaton <jwe@octave.org>
parents:
24775
diff
changeset
|
119 m_view->horizontalHeader ()->setSectionsClickable (true); |
1e0718c1867c
eliminate most Qt version checks
John W. Eaton <jwe@octave.org>
parents:
24775
diff
changeset
|
120 m_view->horizontalHeader ()->setSectionsMovable (true); |
27712
f8fae6e5d636
backout changeset fb2724126950 for fixing bug #57225
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27675
diff
changeset
|
121 m_view->horizontalHeader ()->setSortIndicator ( |
27935
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
122 settings->value (ws_sort_column).toInt (), |
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
123 static_cast<Qt::SortOrder> (settings->value (ws_sort_order).toUInt ())); |
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
124 // FIXME: use value<Qt::SortOrder> instead of static cast after |
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
125 // 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:
27712
diff
changeset
|
126 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
127 m_view->horizontalHeader ()->setSortIndicatorShown (true); |
19982
9a8be23d2c05
extend sorting of workspave view widget
Torsten <ttl@justmail.de>
parents:
19981
diff
changeset
|
128 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
129 m_view->horizontalHeader ()->setContextMenuPolicy (Qt::CustomContextMenu); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
130 connect (m_view->horizontalHeader (), |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
131 &QTableView::customContextMenuRequested, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
132 this, &workspace_view::header_contextmenu_requested); |
20641
2b0886f2c186
add possibility to hide columns of workspace view
Torsten <ttl@justmail.de>
parents:
20570
diff
changeset
|
133 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
134 // Init state of the filter |
27660
30e84a3d58e5
replace preference literals by symbolic constants for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
135 m_filter->addItems (settings->value (ws_mru_list.key).toStringList ()); |
19538
e4b25475ef3d
provide a filter for the workspace view (bug #41222)
Torsten <ttl@justmail.de>
parents:
19433
diff
changeset
|
136 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
137 bool filter_state = |
27672
a36443e94f8a
simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents:
27660
diff
changeset
|
138 settings->value (ws_filter_active).toBool (); |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
139 m_filter_checkbox->setChecked (filter_state); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
140 filter_activate (filter_state); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
141 } |
19538
e4b25475ef3d
provide a filter for the workspace view (bug #41222)
Torsten <ttl@justmail.de>
parents:
19433
diff
changeset
|
142 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
143 // Connect signals and slots. |
14874
5d74d8b982a5
Forgot to have a fallback lexer when the file suffix is unknown. Removed unused variable and added comments.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
14783
diff
changeset
|
144 |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
145 connect (m_filter, &QComboBox::editTextChanged, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
146 this, &workspace_view::filter_update); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
147 connect (m_filter_checkbox, &QCheckBox::toggled, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
148 this, &workspace_view::filter_activate); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
149 connect (m_filter->lineEdit (), &QLineEdit::editingFinished, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
150 this, &workspace_view::update_filter_history); |
19538
e4b25475ef3d
provide a filter for the workspace view (bug #41222)
Torsten <ttl@justmail.de>
parents:
19433
diff
changeset
|
151 |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
152 connect (m_view, &QTableView::customContextMenuRequested, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
153 this, &workspace_view::contextmenu_requested); |
16462
8c666c7b0e5d
Added context menu to workspace variable display
John Donoghue <john.donoghue@ieee.org>
parents:
16459
diff
changeset
|
154 |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
155 connect (m_view, &QTableView::activated, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
156 this, &workspace_view::handle_contextmenu_edit); |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29599
diff
changeset
|
157 |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29599
diff
changeset
|
158 if (! p) |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29599
diff
changeset
|
159 make_window (); |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
160 } |
13577
e440b3f32f02
Fixed bug with closing subwindows.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13541
diff
changeset
|
161 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
162 void workspace_view::setModel (workspace_model *model) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
163 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
164 m_filter_model.setSourceModel (model); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
165 m_filter_model.setFilterKeyColumn(0); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23945
diff
changeset
|
166 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
167 m_view->setModel (&m_filter_model); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23945
diff
changeset
|
168 |
27893
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27890
diff
changeset
|
169 // set the sorting after the model is set, it would be ignored otherwise |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
170 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
|
171 gui_settings *settings = rmgr.get_settings (); |
27712
f8fae6e5d636
backout changeset fb2724126950 for fixing bug #57225
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27675
diff
changeset
|
172 m_view->sortByColumn ( |
f8fae6e5d636
backout changeset fb2724126950 for fixing bug #57225
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27675
diff
changeset
|
173 settings->value (ws_sort_column).toInt (), |
f8fae6e5d636
backout changeset fb2724126950 for fixing bug #57225
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27675
diff
changeset
|
174 static_cast<Qt::SortOrder> (settings->value (ws_sort_order).toUInt ())); |
27726
b2c11742b7ec
add FIXMEs for replacing static casts by Qvariants value<T> after Qt 5.4
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27712
diff
changeset
|
175 // FIXME: use value<Qt::SortOrder> instead of static cast after |
b2c11742b7ec
add FIXMEs for replacing static casts by Qvariants value<T> after Qt 5.4
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27712
diff
changeset
|
176 // dropping support of Qt 5.4 |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23945
diff
changeset
|
177 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
178 m_model = model; |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
179 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23945
diff
changeset
|
180 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
181 void |
27611
0495b64288f7
use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
27610
diff
changeset
|
182 workspace_view::notice_settings (const gui_settings *settings) |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
183 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
184 m_model->notice_settings (settings); // update colors of model first |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23945
diff
changeset
|
185 |
27660
30e84a3d58e5
replace preference literals by symbolic constants for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
186 for (int i = 0; i < ws_columns_shown.length (); i++) |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29774
diff
changeset
|
187 m_view->setColumnHidden (i + 1, ! settings->value (ws_columns_shown_keys.at (i), true).toBool ()); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23945
diff
changeset
|
188 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
189 QString tool_tip; |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23945
diff
changeset
|
190 |
27672
a36443e94f8a
simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents:
27660
diff
changeset
|
191 if (settings->value (ws_enable_colors).toBool () |
a36443e94f8a
simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents:
27660
diff
changeset
|
192 && ! settings->value (ws_hide_tool_tips).toBool ()) |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
193 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
194 tool_tip = QString (tr ("View the variables in the active workspace.<br>")); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
195 tool_tip += QString (tr ("Colors for variable attributes:")); |
27660
30e84a3d58e5
replace preference literals by symbolic constants for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
196 |
30e84a3d58e5
replace preference literals by symbolic constants for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
197 for (int i = 0; i < ws_colors_count; i++) |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
198 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
199 tool_tip += |
27033
c76dd670a7a5
automatic selection of foreground color in worspace view (bug #53995)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26661
diff
changeset
|
200 QString (R"(<div style="background-color:%1;color:%2">%3</div>)") |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
201 .arg (m_model->storage_class_color (i).name ()) |
27660
30e84a3d58e5
replace preference literals by symbolic constants for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
202 .arg (m_model->storage_class_color (i + ws_colors_count).name ()) |
27890
5ca326b3c0d5
fix missing translations due to new symbolic constants for prefs (bug #57490)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27726
diff
changeset
|
203 .arg (QCoreApplication::translate ("octave::settings_dialog", |
28857
43ad651cf5a0
eliminate unnecessary uses of octave:: namespace qualifier
John W. Eaton <jwe@octave.org>
parents:
28851
diff
changeset
|
204 ws_color_names.at (i).toStdString ().data ())); |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
205 } |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
206 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23945
diff
changeset
|
207 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
208 setToolTip (tool_tip); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
209 } |
13577
e440b3f32f02
Fixed bug with closing subwindows.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13541
diff
changeset
|
210 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
211 void |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
212 workspace_view::save_settings (void) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
213 { |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
214 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
|
215 gui_settings *settings = rmgr.get_settings (); |
16463
8e2a853cdd7d
derive workspace_view from octave_dock_widget; style fixes
John W. Eaton <jwe@octave.org>
parents:
16462
diff
changeset
|
216 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
217 if (! settings) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
218 return; |
22177
6e9f5408c0db
Save settings in Qt convention, delete all children in destructors (bug #45366)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
21724
diff
changeset
|
219 |
27660
30e84a3d58e5
replace preference literals by symbolic constants for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
220 settings->setValue (ws_column_state.key, |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
221 m_view->horizontalHeader ()->saveState ()); |
19982
9a8be23d2c05
extend sorting of workspave view widget
Torsten <ttl@justmail.de>
parents:
19981
diff
changeset
|
222 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
223 int sort_column = m_view->horizontalHeader ()->sortIndicatorSection (); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
224 Qt::SortOrder sort_order = m_view->horizontalHeader ()->sortIndicatorOrder (); |
27660
30e84a3d58e5
replace preference literals by symbolic constants for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
225 settings->setValue (ws_sort_column.key, sort_column); |
30e84a3d58e5
replace preference literals by symbolic constants for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
226 settings->setValue (ws_sort_order.key, sort_order); |
19982
9a8be23d2c05
extend sorting of workspave view widget
Torsten <ttl@justmail.de>
parents:
19981
diff
changeset
|
227 |
27660
30e84a3d58e5
replace preference literals by symbolic constants for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
228 settings->setValue (ws_filter_active.key, m_filter_checkbox->isChecked ()); |
30e84a3d58e5
replace preference literals by symbolic constants for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
229 settings->setValue (ws_filter_shown.key, m_filter_shown); |
19538
e4b25475ef3d
provide a filter for the workspace view (bug #41222)
Torsten <ttl@justmail.de>
parents:
19433
diff
changeset
|
230 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
231 QStringList mru; |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
232 for (int i = 0; i < m_filter->count (); i++) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
233 mru.append (m_filter->itemText (i)); |
27660
30e84a3d58e5
replace preference literals by symbolic constants for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
234 settings->setValue (ws_mru_list.key, mru); |
16463
8e2a853cdd7d
derive workspace_view from octave_dock_widget; style fixes
John W. Eaton <jwe@octave.org>
parents:
16462
diff
changeset
|
235 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
236 settings->sync (); |
20641
2b0886f2c186
add possibility to hide columns of workspace view
Torsten <ttl@justmail.de>
parents:
20570
diff
changeset
|
237 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
238 octave_dock_widget::save_settings (); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
239 } |
16610
a1f613e5066d
workspace view colors based upon variable scope (derived from Dan's patch #8013)
Torsten <ttl@justmail.de>
parents:
16575
diff
changeset
|
240 |
29340
0e97c97044ee
improve handling focus of filter widgets in history and workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28857
diff
changeset
|
241 void workspace_view::set_filter_focus (bool focus) |
0e97c97044ee
improve handling focus of filter widgets in history and workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28857
diff
changeset
|
242 { |
0e97c97044ee
improve handling focus of filter widgets in history and workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28857
diff
changeset
|
243 if (focus) |
0e97c97044ee
improve handling focus of filter widgets in history and workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28857
diff
changeset
|
244 { |
0e97c97044ee
improve handling focus of filter widgets in history and workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28857
diff
changeset
|
245 m_filter->setFocus (); |
0e97c97044ee
improve handling focus of filter widgets in history and workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28857
diff
changeset
|
246 setFocusProxy (m_filter); |
0e97c97044ee
improve handling focus of filter widgets in history and workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28857
diff
changeset
|
247 } |
0e97c97044ee
improve handling focus of filter widgets in history and workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28857
diff
changeset
|
248 else |
0e97c97044ee
improve handling focus of filter widgets in history and workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28857
diff
changeset
|
249 { |
0e97c97044ee
improve handling focus of filter widgets in history and workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28857
diff
changeset
|
250 m_view->setFocus (); |
0e97c97044ee
improve handling focus of filter widgets in history and workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28857
diff
changeset
|
251 setFocusProxy (m_view); |
0e97c97044ee
improve handling focus of filter widgets in history and workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28857
diff
changeset
|
252 } |
0e97c97044ee
improve handling focus of filter widgets in history and workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28857
diff
changeset
|
253 } |
0e97c97044ee
improve handling focus of filter widgets in history and workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28857
diff
changeset
|
254 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
255 void |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
256 workspace_view::filter_update (const QString& expression) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
257 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
258 m_filter_model.setFilterWildcard (expression); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
259 handle_model_changed (); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
260 } |
19538
e4b25475ef3d
provide a filter for the workspace view (bug #41222)
Torsten <ttl@justmail.de>
parents:
19433
diff
changeset
|
261 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
262 void |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
263 workspace_view::filter_activate (bool state) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
264 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
265 m_filter->setEnabled (state); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
266 m_filter_model.setDynamicSortFilter (state); |
19538
e4b25475ef3d
provide a filter for the workspace view (bug #41222)
Torsten <ttl@justmail.de>
parents:
19433
diff
changeset
|
267 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
268 if (state) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
269 filter_update (m_filter->currentText ()); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
270 else |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
271 filter_update (QString ()); |
29340
0e97c97044ee
improve handling focus of filter widgets in history and workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28857
diff
changeset
|
272 |
0e97c97044ee
improve handling focus of filter widgets in history and workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28857
diff
changeset
|
273 set_filter_focus (state); |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
274 } |
19538
e4b25475ef3d
provide a filter for the workspace view (bug #41222)
Torsten <ttl@justmail.de>
parents:
19433
diff
changeset
|
275 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
276 void |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
277 workspace_view::update_filter_history (void) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
278 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
279 QString text = m_filter->currentText (); // get current text |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
280 int index = m_filter->findText (text); // and its actual index |
19562
010cef260698
improve filter of workspace view
Torsten <ttl@justmail.de>
parents:
19539
diff
changeset
|
281 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
282 if (index > -1) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
283 m_filter->removeItem (index); // remove if already existing |
19538
e4b25475ef3d
provide a filter for the workspace view (bug #41222)
Torsten <ttl@justmail.de>
parents:
19433
diff
changeset
|
284 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
285 m_filter->insertItem (0, text); // (re)insert at beginning |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
286 m_filter->setCurrentIndex (0); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
287 } |
19433
2f0c21339e9d
values of variables in workspace view copyable (bug #43674)
Torsten <ttl@justmail.de>
parents:
19162
diff
changeset
|
288 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
289 void |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
290 workspace_view::header_contextmenu_requested (const QPoint& mpos) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
291 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
292 QMenu menu (this); |
27610
8586eb41abf5
improve memory management in workspace_view class
John W. Eaton <jwe@octave.org>
parents:
27560
diff
changeset
|
293 QSignalMapper sig_mapper (this); |
20641
2b0886f2c186
add possibility to hide columns of workspace view
Torsten <ttl@justmail.de>
parents:
20570
diff
changeset
|
294 |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
295 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
|
296 gui_settings *settings = rmgr.get_settings (); |
20641
2b0886f2c186
add possibility to hide columns of workspace view
Torsten <ttl@justmail.de>
parents:
20570
diff
changeset
|
297 |
27660
30e84a3d58e5
replace preference literals by symbolic constants for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
298 for (int i = 0; i < ws_columns_shown.length (); i++) |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
299 { |
27890
5ca326b3c0d5
fix missing translations due to new symbolic constants for prefs (bug #57490)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27726
diff
changeset
|
300 QAction *action |
5ca326b3c0d5
fix missing translations due to new symbolic constants for prefs (bug #57490)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27726
diff
changeset
|
301 = menu.addAction (tr (ws_columns_shown.at (i).toStdString ().data ()), |
5ca326b3c0d5
fix missing translations due to new symbolic constants for prefs (bug #57490)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27726
diff
changeset
|
302 &sig_mapper, SLOT (map ())); |
27610
8586eb41abf5
improve memory management in workspace_view class
John W. Eaton <jwe@octave.org>
parents:
27560
diff
changeset
|
303 sig_mapper.setMapping (action, i); |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
304 action->setCheckable (true); |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29774
diff
changeset
|
305 action->setChecked (settings->value (ws_columns_shown_keys.at (i), true).toBool ()); |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
306 } |
20641
2b0886f2c186
add possibility to hide columns of workspace view
Torsten <ttl@justmail.de>
parents:
20570
diff
changeset
|
307 |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
308 // FIXME: We could use |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
309 // |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
310 // connect (&m_sig_mapper, QOverload<int>::of (&QSignalMapper::mapped), |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
311 // this, &workspace_view::toggle_header); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
312 // |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
313 // but referring to QSignalMapper::mapped will generate deprecated |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
314 // function warnings from GCC. We could also use |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
315 // |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
316 // connect (&m_sig_mapper, &QSignalMapper::mappedInt, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
317 // this, &workspace_view::toggle_header); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
318 // |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
319 // but the function mappedInt was not introduced until Qt 5.15 so |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
320 // we'll need a feature test. |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
321 |
27610
8586eb41abf5
improve memory management in workspace_view class
John W. Eaton <jwe@octave.org>
parents:
27560
diff
changeset
|
322 connect (&sig_mapper, SIGNAL (mapped (int)), |
8586eb41abf5
improve memory management in workspace_view class
John W. Eaton <jwe@octave.org>
parents:
27560
diff
changeset
|
323 this, SLOT (toggle_header (int))); |
20641
2b0886f2c186
add possibility to hide columns of workspace view
Torsten <ttl@justmail.de>
parents:
20570
diff
changeset
|
324 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
325 menu.exec (m_view->mapToGlobal (mpos)); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
326 } |
20641
2b0886f2c186
add possibility to hide columns of workspace view
Torsten <ttl@justmail.de>
parents:
20570
diff
changeset
|
327 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
328 void |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
329 workspace_view::toggle_header (int col) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
330 { |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
331 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
|
332 gui_settings *settings = rmgr.get_settings (); |
20641
2b0886f2c186
add possibility to hide columns of workspace view
Torsten <ttl@justmail.de>
parents:
20570
diff
changeset
|
333 |
27660
30e84a3d58e5
replace preference literals by symbolic constants for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
334 QString key = ws_columns_shown_keys.at (col); |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29774
diff
changeset
|
335 bool shown = settings->value (key, true).toBool (); |
20641
2b0886f2c186
add possibility to hide columns of workspace view
Torsten <ttl@justmail.de>
parents:
20570
diff
changeset
|
336 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
337 m_view->setColumnHidden (col + 1, shown); |
20641
2b0886f2c186
add possibility to hide columns of workspace view
Torsten <ttl@justmail.de>
parents:
20570
diff
changeset
|
338 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
339 settings->setValue (key, ! shown); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
340 settings->sync (); |
22177
6e9f5408c0db
Save settings in Qt convention, delete all children in destructors (bug #45366)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
21724
diff
changeset
|
341 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
342 octave_dock_widget::save_settings (); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
343 } |
20641
2b0886f2c186
add possibility to hide columns of workspace view
Torsten <ttl@justmail.de>
parents:
20570
diff
changeset
|
344 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
345 void |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
346 workspace_view::contextmenu_requested (const QPoint& qpos) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
347 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
348 QMenu menu (this); |
16462
8c666c7b0e5d
Added context menu to workspace variable display
John Donoghue <john.donoghue@ieee.org>
parents:
16459
diff
changeset
|
349 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
350 QModelIndex index = m_view->indexAt (qpos); |
16462
8c666c7b0e5d
Added context menu to workspace variable display
John Donoghue <john.donoghue@ieee.org>
parents:
16459
diff
changeset
|
351 |
27893
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27890
diff
changeset
|
352 // if it isn't Local, Global etc, allow the ctx menu |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
353 if (index.isValid () && index.column () == 0) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
354 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
355 QString var_name = get_var_name (index); |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
356 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
357 menu.addAction (tr ("Open in Variable Editor"), this, |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
358 &workspace_view::handle_contextmenu_edit); |
23945
cf16f6521180
double clicking a variable in workspace view opens variable editor (bug #51843)
Torsten <mttl@mailbox.org>
parents:
23927
diff
changeset
|
359 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
360 menu.addAction (tr ("Copy name"), this, |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
361 &workspace_view::handle_contextmenu_copy); |
16462
8c666c7b0e5d
Added context menu to workspace variable display
John Donoghue <john.donoghue@ieee.org>
parents:
16459
diff
changeset
|
362 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
363 menu.addAction (tr ("Copy value"), this, |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
364 &workspace_view::handle_contextmenu_copy_value); |
16521
dbc7018be4be
use context menu for workspace viewer rename and copy to clipboard operations
John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
365 |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
366 QAction *rename |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
367 = menu.addAction (tr ("Rename"), this, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
368 &workspace_view::handle_contextmenu_rename); |
16521
dbc7018be4be
use context menu for workspace viewer rename and copy to clipboard operations
John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
369 |
27192
8779c631d55f
fix access to top_level info flag when creating workspace view context menu
John W. Eaton <jwe@octave.org>
parents:
27033
diff
changeset
|
370 // Use m_model here instead of using "m_view->model ()" because |
8779c631d55f
fix access to top_level info flag when creating workspace view context menu
John W. Eaton <jwe@octave.org>
parents:
27033
diff
changeset
|
371 // that points to the proxy model. |
8779c631d55f
fix access to top_level info flag when creating workspace view context menu
John W. Eaton <jwe@octave.org>
parents:
27033
diff
changeset
|
372 if (! m_model->is_top_level ()) |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
373 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
374 rename->setDisabled (true); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
375 rename->setToolTip (tr ("Only top-level symbols may be renamed")); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
376 } |
16521
dbc7018be4be
use context menu for workspace viewer rename and copy to clipboard operations
John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
377 |
24775
3da6c628873a
clear variable via context menu of workspace view (bug #53149)
Torsten <mttl@mailbox.org>
parents:
24766
diff
changeset
|
378 menu.addAction ("Clear " + var_name, this, |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
379 &workspace_view::handle_contextmenu_clear); |
24775
3da6c628873a
clear variable via context menu of workspace view (bug #53149)
Torsten <mttl@mailbox.org>
parents:
24766
diff
changeset
|
380 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
381 menu.addSeparator (); |
16521
dbc7018be4be
use context menu for workspace viewer rename and copy to clipboard operations
John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
382 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
383 menu.addAction ("disp (" + var_name + ')', this, |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
384 &workspace_view::handle_contextmenu_disp); |
16462
8c666c7b0e5d
Added context menu to workspace variable display
John Donoghue <john.donoghue@ieee.org>
parents:
16459
diff
changeset
|
385 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
386 menu.addAction ("plot (" + var_name + ')', this, |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
387 &workspace_view::handle_contextmenu_plot); |
16462
8c666c7b0e5d
Added context menu to workspace variable display
John Donoghue <john.donoghue@ieee.org>
parents:
16459
diff
changeset
|
388 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
389 menu.addAction ("stem (" + var_name + ')', this, |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
390 &workspace_view::handle_contextmenu_stem); |
16462
8c666c7b0e5d
Added context menu to workspace variable display
John Donoghue <john.donoghue@ieee.org>
parents:
16459
diff
changeset
|
391 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
392 menu.addSeparator (); |
20570
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20388
diff
changeset
|
393 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
394 } |
20570
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20388
diff
changeset
|
395 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
396 if (m_filter_shown) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
397 menu.addAction (tr ("Hide filter"), this, |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
398 &workspace_view::handle_contextmenu_filter); |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
399 else |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
400 menu.addAction (tr ("Show filter"), this, |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
401 &workspace_view::handle_contextmenu_filter); |
20570
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20388
diff
changeset
|
402 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
403 menu.exec (m_view->mapToGlobal (qpos)); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
404 } |
16462
8c666c7b0e5d
Added context menu to workspace variable display
John Donoghue <john.donoghue@ieee.org>
parents:
16459
diff
changeset
|
405 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
406 void |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
407 workspace_view::handle_contextmenu_copy (void) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
408 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
409 QModelIndex index = m_view->currentIndex (); |
16521
dbc7018be4be
use context menu for workspace viewer rename and copy to clipboard operations
John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
410 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
411 if (index.isValid ()) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
412 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
413 QString var_name = get_var_name (index); |
16521
dbc7018be4be
use context menu for workspace viewer rename and copy to clipboard operations
John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
414 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
415 QClipboard *clipboard = QApplication::clipboard (); |
16521
dbc7018be4be
use context menu for workspace viewer rename and copy to clipboard operations
John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
416 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
417 clipboard->setText (var_name); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
418 } |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
419 } |
16521
dbc7018be4be
use context menu for workspace viewer rename and copy to clipboard operations
John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
420 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
421 void |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
422 workspace_view::handle_contextmenu_copy_value (void) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
423 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
424 QModelIndex index = m_view->currentIndex (); |
19433
2f0c21339e9d
values of variables in workspace view copyable (bug #43674)
Torsten <ttl@justmail.de>
parents:
19162
diff
changeset
|
425 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
426 if (index.isValid ()) |
29774
aa46787ed8b7
eliminate direct dependence on octave intepreter from workspace_view
John W. Eaton <jwe@octave.org>
parents:
29613
diff
changeset
|
427 emit copy_variable_value_to_clipboard (get_var_name (index)); |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
428 } |
19433
2f0c21339e9d
values of variables in workspace view copyable (bug #43674)
Torsten <ttl@justmail.de>
parents:
19162
diff
changeset
|
429 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
430 void |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
431 workspace_view::handle_contextmenu_rename (void) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
432 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
433 QModelIndex index = m_view->currentIndex (); |
16521
dbc7018be4be
use context menu for workspace viewer rename and copy to clipboard operations
John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
434 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
435 if (index.isValid ()) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
436 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
437 QString var_name = get_var_name (index); |
16521
dbc7018be4be
use context menu for workspace viewer rename and copy to clipboard operations
John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
438 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
439 QInputDialog *inputDialog = new QInputDialog (); |
16521
dbc7018be4be
use context menu for workspace viewer rename and copy to clipboard operations
John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
440 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
441 inputDialog->setOptions (QInputDialog::NoButtons); |
16521
dbc7018be4be
use context menu for workspace viewer rename and copy to clipboard operations
John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
442 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
443 bool ok = false; |
16521
dbc7018be4be
use context menu for workspace viewer rename and copy to clipboard operations
John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
444 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
445 QString new_name |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
446 = inputDialog->getText (nullptr, "Rename Variable", "New name:", |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
447 QLineEdit::Normal, var_name, &ok); |
16521
dbc7018be4be
use context menu for workspace viewer rename and copy to clipboard operations
John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
448 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
449 if (ok && ! new_name.isEmpty ()) |
27220
9a4a9fcc186b
connect workspace view rename variable signal to main window slot
John W. Eaton <jwe@octave.org>
parents:
27192
diff
changeset
|
450 emit rename_variable_signal (var_name, new_name); |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
451 } |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
452 } |
16521
dbc7018be4be
use context menu for workspace viewer rename and copy to clipboard operations
John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
453 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
454 void |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
455 workspace_view::handle_contextmenu_edit (void) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
456 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
457 QModelIndex index = m_view->currentIndex (); |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23807
diff
changeset
|
458 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
459 if (index.isValid ()) |
29774
aa46787ed8b7
eliminate direct dependence on octave intepreter from workspace_view
John W. Eaton <jwe@octave.org>
parents:
29613
diff
changeset
|
460 emit edit_variable_signal (get_var_name (index)); |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
461 } |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23807
diff
changeset
|
462 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
463 void |
24775
3da6c628873a
clear variable via context menu of workspace view (bug #53149)
Torsten <mttl@mailbox.org>
parents:
24766
diff
changeset
|
464 workspace_view::handle_contextmenu_clear (void) |
3da6c628873a
clear variable via context menu of workspace view (bug #53149)
Torsten <mttl@mailbox.org>
parents:
24766
diff
changeset
|
465 { |
3da6c628873a
clear variable via context menu of workspace view (bug #53149)
Torsten <mttl@mailbox.org>
parents:
24766
diff
changeset
|
466 relay_contextmenu_command ("clear", true); |
3da6c628873a
clear variable via context menu of workspace view (bug #53149)
Torsten <mttl@mailbox.org>
parents:
24766
diff
changeset
|
467 } |
3da6c628873a
clear variable via context menu of workspace view (bug #53149)
Torsten <mttl@mailbox.org>
parents:
24766
diff
changeset
|
468 |
3da6c628873a
clear variable via context menu of workspace view (bug #53149)
Torsten <mttl@mailbox.org>
parents:
24766
diff
changeset
|
469 void |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
470 workspace_view::handle_contextmenu_disp (void) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
471 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
472 relay_contextmenu_command ("disp"); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
473 } |
16462
8c666c7b0e5d
Added context menu to workspace variable display
John Donoghue <john.donoghue@ieee.org>
parents:
16459
diff
changeset
|
474 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
475 void |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
476 workspace_view::handle_contextmenu_plot (void) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
477 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
478 relay_contextmenu_command ("figure (); plot"); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
479 } |
16462
8c666c7b0e5d
Added context menu to workspace variable display
John Donoghue <john.donoghue@ieee.org>
parents:
16459
diff
changeset
|
480 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
481 void |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
482 workspace_view::handle_contextmenu_stem (void) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
483 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
484 relay_contextmenu_command ("figure (); stem"); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
485 } |
16462
8c666c7b0e5d
Added context menu to workspace variable display
John Donoghue <john.donoghue@ieee.org>
parents:
16459
diff
changeset
|
486 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
487 void |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
488 workspace_view::handle_contextmenu_filter (void) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
489 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
490 m_filter_shown = ! m_filter_shown; |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
491 m_filter_widget->setVisible (m_filter_shown); |
29340
0e97c97044ee
improve handling focus of filter widgets in history and workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28857
diff
changeset
|
492 |
0e97c97044ee
improve handling focus of filter widgets in history and workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28857
diff
changeset
|
493 set_filter_focus (m_filter_shown && m_filter_checkbox->isChecked ()); |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
494 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23945
diff
changeset
|
495 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
496 void |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
497 workspace_view::handle_model_changed (void) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
498 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
499 // m_view->resizeRowsToContents (); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
500 // Just modify those rows that have been added rather than go through |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
501 // the whole list. For-loop test will handle when number of rows reduced. |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
502 QFontMetrics fm = m_view->fontMetrics (); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
503 int row_height = fm.height (); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
504 int new_row_count = m_filter_model.rowCount (); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
505 for (int i = m_view_previous_row_count; i < new_row_count; i++) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
506 m_view->setRowHeight (i, row_height); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
507 m_view_previous_row_count = new_row_count; |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
508 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23945
diff
changeset
|
509 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
510 void |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
511 workspace_view::copyClipboard () |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
512 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
513 if (m_view->hasFocus ()) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
514 handle_contextmenu_copy (); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
515 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23945
diff
changeset
|
516 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
517 void |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
518 workspace_view::selectAll () |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
519 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
520 if (m_view->hasFocus ()) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
521 m_view->selectAll (); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
522 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23945
diff
changeset
|
523 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
524 void |
24775
3da6c628873a
clear variable via context menu of workspace view (bug #53149)
Torsten <mttl@mailbox.org>
parents:
24766
diff
changeset
|
525 workspace_view::relay_contextmenu_command (const QString& cmdname, bool str) |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
526 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
527 QModelIndex index = m_view->currentIndex (); |
16462
8c666c7b0e5d
Added context menu to workspace variable display
John Donoghue <john.donoghue@ieee.org>
parents:
16459
diff
changeset
|
528 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
529 if (index.isValid ()) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
530 { |
24775
3da6c628873a
clear variable via context menu of workspace view (bug #53149)
Torsten <mttl@mailbox.org>
parents:
24766
diff
changeset
|
531 QString var_name; |
3da6c628873a
clear variable via context menu of workspace view (bug #53149)
Torsten <mttl@mailbox.org>
parents:
24766
diff
changeset
|
532 |
3da6c628873a
clear variable via context menu of workspace view (bug #53149)
Torsten <mttl@mailbox.org>
parents:
24766
diff
changeset
|
533 if (str) |
3da6c628873a
clear variable via context menu of workspace view (bug #53149)
Torsten <mttl@mailbox.org>
parents:
24766
diff
changeset
|
534 var_name = "\'" + get_var_name (index) + "\'"; |
3da6c628873a
clear variable via context menu of workspace view (bug #53149)
Torsten <mttl@mailbox.org>
parents:
24766
diff
changeset
|
535 else |
3da6c628873a
clear variable via context menu of workspace view (bug #53149)
Torsten <mttl@mailbox.org>
parents:
24766
diff
changeset
|
536 var_name = get_var_name (index); |
16462
8c666c7b0e5d
Added context menu to workspace variable display
John Donoghue <john.donoghue@ieee.org>
parents:
16459
diff
changeset
|
537 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
538 emit command_requested (cmdname + " (" + var_name + ");"); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
539 } |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
540 } |
16572
17941fedd4ce
Change workspace row height to font height.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16570
diff
changeset
|
541 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
542 QString |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
543 workspace_view::get_var_name (const QModelIndex& index) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
544 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
545 // We are using a sort model proxy so m_model won't provide the |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
546 // correct ordering. |
24648
1f1ac73910ab
respect sorting in variable editor (bug #51843)
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
547 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
548 QAbstractItemModel *m = m_view->model (); |
24648
1f1ac73910ab
respect sorting in variable editor (bug #51843)
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
549 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
550 QMap<int, QVariant> item_data |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
551 = m->itemData (index.sibling (index.row (), 0)); |
19042
110702c507e3
user setting for hiding the tool tip in the workspace view (part of bug #42306)
Torsten <ttl@justmail.de>
parents:
18555
diff
changeset
|
552 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
553 return item_data[0].toString (); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24695
diff
changeset
|
554 } |
31646
c6d54dd31a7e
maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents:
30964
diff
changeset
|
555 |
c6d54dd31a7e
maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents:
30964
diff
changeset
|
556 OCTAVE_END_NAMESPACE(octave) |