Mercurial > octave
annotate libgui/src/octave-dock-widget.cc @ 29754:4c569e386e9b
improve behavior of dockable widgets (bug #60750)
* main-window.h, main-window.cc (main_window::set_window_layout):
Don't reset geometry of adopted dock_widgets.
(main_window::construct): Don't connect qt_link edit_variable_signal
to main_window edit_variable slot.
(main_window::reset_windows): Force reset of all windows.
(main_window::do_reset_windows): New argument, FORCE_ALL. Skip adoped
dock_widgets unless force_all is true.
* octave-dock-widget.h, octave-dock-widget.cc
(octave_dock_widget::make_widget): If m_main_window is nonnull, set
m_adopted to false.
Disconnect any existing m_dock_action signals that are connected to
the octave_dock_widget object before connecting the m_dock_action
triggered signal to the octave_dock_widget make_window slot.
(octave_dock_widget::m_adopted): New data member.
(octave_dock_widget::set_adopted, (octave_dock_widget::adopted):
New functions.
* octave-qobject.h, octave-qobject.cc (base_qobject::documentation_widget,
base_qobject::file_browser_widget, base_qobject::history_widget,
base_qobject::workspace_widget, base_qobject::variable_editor_widget):
Call set_main_window and set_adopted for widget if it already exists
and main_window argument is nonnull. Otherwise, create widget if it
doesn't already exist.
(base_qobject::show_variable_editor_window): Rename slot from
edit_variable. Change all uses. Acquire pointer to widget and
forward to the widget's edit_variable method.
* variable-editor.cc (variable_editor::variable_editor): Call
make_window if parent is nullptr.
(variable_editor::edit_variable): Don't call make_window.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 14 Jun 2021 12:39:51 -0400 |
parents | 3f61913fdee4 |
children | d79f65e37e89 |
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 // |
29358
0a5b15007766
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
29271
diff
changeset
|
3 // Copyright (C) 2012-2021 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 //////////////////////////////////////////////////////////////////////// |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
25 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
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" |
17923
b602014eeb54
* octave-dock-widget.cc: Include config.h.
John W. Eaton <jwe@octave.org>
parents:
17899
diff
changeset
|
28 #endif |
b602014eeb54
* octave-dock-widget.cc: Include config.h.
John W. Eaton <jwe@octave.org>
parents:
17899
diff
changeset
|
29 |
27412
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27302
diff
changeset
|
30 #include <QAction> |
16881
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16865
diff
changeset
|
31 #include <QApplication> |
26299
c95884eed1cf
make restoring gui more robust to changes of desktop size (bug #53207)
Torsten <mttl@mailbox.org>
parents:
25907
diff
changeset
|
32 #include <QDesktopWidget> |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
33 #include <QHBoxLayout> |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
34 #include <QLabel> |
19918
66928b4546ab
dock-/undock- and close-icons with variable size (bug #41938)
Torsten <ttl@justmail.de>
parents:
19913
diff
changeset
|
35 #include <QStyle> |
26299
c95884eed1cf
make restoring gui more robust to changes of desktop size (bug #53207)
Torsten <mttl@mailbox.org>
parents:
25907
diff
changeset
|
36 #include <QToolBar> |
27468
8ba19629d5ef
compacter menu bars in dock widgets (bug #53902)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27467
diff
changeset
|
37 #include <QMenuBar> |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
38 |
27665
a1271c5b621a
replace preference literals by symbolic constants for dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
39 #include "gui-preferences-dw.h" |
27671
61883a1a80a1
don't include gui-preferences-global.h in gui-preferences.h
John W. Eaton <jwe@octave.org>
parents:
27665
diff
changeset
|
40 #include "gui-preferences-global.h" |
27562
d7876110e854
use symbolic preference keys if available
John W. Eaton <jwe@octave.org>
parents:
27560
diff
changeset
|
41 #include "gui-preferences-mw.h" |
27937
8dc5b36f1245
include new undock/dock actions into the shortcut manager
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27936
diff
changeset
|
42 #include "gui-preferences-sc.h" |
27611
0495b64288f7
use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
27562
diff
changeset
|
43 #include "gui-settings.h" |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
44 #include "main-window.h" |
27412
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27302
diff
changeset
|
45 #include "octave-dock-widget.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
|
46 #include "octave-qobject.h" |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
47 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
48 namespace octave |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
49 { |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
50 label_dock_widget::label_dock_widget (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
|
51 : QDockWidget (p), m_octave_qobj (oct_qobj), |
27620
45bb5bbaf291
don't use singleton pattern for resource manager in GUI
John W. Eaton <jwe@octave.org>
parents:
27611
diff
changeset
|
52 m_default_float_button (nullptr), m_default_close_button (nullptr) |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
53 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
54 QStyle *st = style (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
55 m_icon_size = 0.75*st->pixelMetric (QStyle::PM_SmallIconSize); |
19918
66928b4546ab
dock-/undock- and close-icons with variable size (bug #41938)
Torsten <ttl@justmail.de>
parents:
19913
diff
changeset
|
56 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
57 // keep track of the original buttons on the default title bar, |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
58 // the button further left is considered "float" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
59 QList<QAbstractButton *> buttonlist = findChildren<QAbstractButton *> (); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
60 if (buttonlist.size () == 2) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
61 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
62 if (buttonlist.at (0)->x () < buttonlist.at (1)->x ()) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
63 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
64 m_default_float_button = buttonlist.at (0); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
65 m_default_close_button = buttonlist.at (1); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
66 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
67 else |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
68 { |
26343
df510676ca6a
octave-dock-widget.cc: Fix copy & paste error. (bug #55347)
Andreas Weber <octave@josoansi.de>
parents:
26299
diff
changeset
|
69 m_default_float_button = buttonlist.at (1); |
df510676ca6a
octave-dock-widget.cc: Fix copy & paste error. (bug #55347)
Andreas Weber <octave@josoansi.de>
parents:
26299
diff
changeset
|
70 m_default_close_button = buttonlist.at (0); |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
71 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
72 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
73 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
74 // the custom (extra) title bar of the widget |
24858
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24842
diff
changeset
|
75 m_title_widget = new QWidget (); |
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24842
diff
changeset
|
76 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
77 m_dock_action = new QAction |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
78 (QIcon (":/actions/icons/widget-undock.png"), "", this); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
79 m_dock_action->setToolTip (tr ("Undock widget")); |
24858
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24842
diff
changeset
|
80 m_dock_button = new QToolButton (m_title_widget); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
81 m_dock_button->setDefaultAction (m_dock_action); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
82 m_dock_button->setFocusPolicy (Qt::NoFocus); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
83 m_dock_button->setIconSize (QSize (m_icon_size,m_icon_size)); |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
84 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
85 m_close_action = new QAction |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
86 (QIcon (":/actions/icons/widget-close.png"), "", this); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
87 m_close_action->setToolTip (tr ("Close widget")); |
24858
8ce66fe46f18
Improve fullscreen action for variable editor panes (bug #53275)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24842
diff
changeset
|
88 m_close_button = new QToolButton (m_title_widget); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
89 m_close_button->setDefaultAction (m_close_action); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
90 m_close_button->setFocusPolicy (Qt::NoFocus); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
91 m_close_button->setIconSize (QSize (m_icon_size,m_icon_size)); |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
92 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
93 QString css_button = QString ("QToolButton {background: transparent; border: 0px;}"); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
94 m_dock_button->setStyleSheet (css_button); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
95 m_close_button->setStyleSheet (css_button); |
18218
7952fb0435db
improve title bar of dock widgets
Torsten <ttl@justmail.de>
parents:
18180
diff
changeset
|
96 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
97 QHBoxLayout *h_layout = new QHBoxLayout (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
98 h_layout->addStretch (100); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
99 h_layout->addWidget (m_dock_button); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
100 h_layout->addWidget (m_close_button); |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
101 h_layout->setSpacing (10); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
102 h_layout->setContentsMargins (5,2,2,2); |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
103 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
104 m_title_widget->setLayout (h_layout); |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
105 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
106 // copy & paste handling |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
107 connect (p, SIGNAL (copyClipboard_signal ()), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
108 this, SLOT (copyClipboard ())); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
109 connect (p, SIGNAL (pasteClipboard_signal ()), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
110 this, SLOT (pasteClipboard ())); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
111 connect (p, SIGNAL (selectAll_signal ()), |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
112 this, SLOT (selectAll ())); |
29147
5d7a651bf0bb
fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29145
diff
changeset
|
113 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
114 // undo handling |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
115 connect (p, SIGNAL (undo_signal ()), this, SLOT (do_undo ())); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
116 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24696
diff
changeset
|
117 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
118 // set the title in the dockwidgets title bar |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
119 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
120 label_dock_widget::set_title (const QString& title) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
121 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
122 QHBoxLayout *h_layout |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
123 = static_cast<QHBoxLayout *> (m_title_widget->layout ()); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
124 QLabel *label = new QLabel (title, m_title_widget); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
125 label->setStyleSheet ("background-color: transparent;"); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
126 h_layout->insertWidget (0,label); |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
127 setTitleBarWidget (m_title_widget); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
128 setWindowTitle (title); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
129 } |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24696
diff
changeset
|
130 |
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24696
diff
changeset
|
131 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
132 static QString |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
133 qdockwidget_css (const QString& close_icon, const QString& close_tooltip, |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
134 const QString& float_icon, const QString& float_tooltip, |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
135 int icon_size, const QString& titlebar_foreground, |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
136 const QString& titlebar_background) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
137 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
138 return QString ("QDockWidget\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
139 "{\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
140 "%6" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
141 " border: none;\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
142 " titlebar-close-icon: url(%1);\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
143 " titlebar-normal-icon: url(%2);\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
144 "}\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
145 "\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
146 "QDockWidget::close-button, QDockWidget::float-button\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
147 "{\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
148 " border: none;\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
149 " icon-size: %3px;\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
150 "}\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
151 "\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
152 "QAbstractButton#qt_dockwidget_closebutton\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
153 "{\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
154 " qproperty-toolTip: \"%4\";\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
155 "}\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
156 "\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
157 "QAbstractButton#qt_dockwidget_floatbutton\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
158 "{\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
159 " qproperty-toolTip: \"%5\";\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
160 "}\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
161 "\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
162 "QDockWidget::title {\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
163 " text-align: left;\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
164 "%7" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
165 " padding-left: 1px;\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
166 "}\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
167 "\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
168 "QDockWidget::close-button\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
169 "{\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
170 " right: %8px;\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
171 " top: 3px;\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
172 "}\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
173 "\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
174 "QDockWidget::float-button\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
175 "{\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
176 " right: %9px;\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
177 " top: 3px;\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
178 "}\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
179 ).arg (close_icon).arg (float_icon).arg (icon_size) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
180 .arg (close_tooltip).arg (float_tooltip) |
27893
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27672
diff
changeset
|
181 .arg (titlebar_foreground).arg (titlebar_background) |
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27672
diff
changeset
|
182 .arg ((icon_size*2)/3).arg((icon_size*7)/3); |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
183 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
184 |
27620
45bb5bbaf291
don't use singleton pattern for resource manager in GUI
John W. Eaton <jwe@octave.org>
parents:
27611
diff
changeset
|
185 octave_dock_widget::octave_dock_widget (const QString& obj_name, QWidget *p, |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
186 base_qobject& oct_qobj) |
29754
4c569e386e9b
improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents:
29709
diff
changeset
|
187 : label_dock_widget (p, oct_qobj), m_adopted (false), |
4c569e386e9b
improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents:
29709
diff
changeset
|
188 m_custom_style (false), m_focus_follows_mouse (false), |
29202
66af654b3485
provide focus follows mouse for widgets in the main window (bug #59701)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29199
diff
changeset
|
189 m_recent_float_geom (), m_recent_dock_geom (), |
66af654b3485
provide focus follows mouse for widgets in the main window (bug #59701)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29199
diff
changeset
|
190 m_waiting_for_mouse_button_release (false) |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
191 { |
25355
5bb07f6e3707
fix uninitialized settings of octave dock widgets at startup (bug #53835)
Torsten <mttl@mailbox.org>
parents:
25354
diff
changeset
|
192 setObjectName (obj_name); |
5bb07f6e3707
fix uninitialized settings of octave dock widgets at startup (bug #53835)
Torsten <mttl@mailbox.org>
parents:
25354
diff
changeset
|
193 |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
194 // FIXME: Can we avoid the cast here? |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
195 m_main_window = dynamic_cast<main_window *> (p); |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
196 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
197 m_predecessor_widget = nullptr; |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24696
diff
changeset
|
198 |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29434
diff
changeset
|
199 connect (this, &octave_dock_widget::topLevelChanged, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29434
diff
changeset
|
200 this, &octave_dock_widget::toplevel_change); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29434
diff
changeset
|
201 connect (this, &octave_dock_widget::visibilityChanged, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29434
diff
changeset
|
202 this, &octave_dock_widget::handle_visibility); |
29199
0b18887bc997
simplify initialization of gui dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29147
diff
changeset
|
203 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
204 if (m_default_float_button != nullptr) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
205 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
206 disconnect (m_default_float_button, 0, 0, 0); |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29434
diff
changeset
|
207 connect (m_default_float_button, &QAbstractButton::clicked, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29434
diff
changeset
|
208 this, &octave_dock_widget::make_window); |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
209 } |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29434
diff
changeset
|
210 connect (this, &octave_dock_widget::queue_make_window, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29434
diff
changeset
|
211 this, &octave_dock_widget::make_window, Qt::QueuedConnection); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29434
diff
changeset
|
212 connect (this, &octave_dock_widget::queue_make_widget, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29434
diff
changeset
|
213 this, [=] () { make_widget (); }, Qt::QueuedConnection); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24696
diff
changeset
|
214 |
27937
8dc5b36f1245
include new undock/dock actions into the shortcut manager
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27936
diff
changeset
|
215 shortcut_manager& scmgr = m_octave_qobj.get_shortcut_manager (); |
8dc5b36f1245
include new undock/dock actions into the shortcut manager
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27936
diff
changeset
|
216 scmgr.set_shortcut (m_dock_action, sc_dock_widget_dock); |
27936
106c8ba2f13c
Add shortcut keys for octave_dock_widget undock, dock and close (bug #54078)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
27935
diff
changeset
|
217 m_dock_action->setShortcutContext (Qt::WidgetWithChildrenShortcut); |
106c8ba2f13c
Add shortcut keys for octave_dock_widget undock, dock and close (bug #54078)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
27935
diff
changeset
|
218 addAction (m_dock_action); |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29434
diff
changeset
|
219 connect (m_dock_action, &QAction::triggered, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29434
diff
changeset
|
220 this, &octave_dock_widget::make_window); |
27937
8dc5b36f1245
include new undock/dock actions into the shortcut manager
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27936
diff
changeset
|
221 |
8dc5b36f1245
include new undock/dock actions into the shortcut manager
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27936
diff
changeset
|
222 scmgr.set_shortcut (m_close_action, sc_dock_widget_close); |
27936
106c8ba2f13c
Add shortcut keys for octave_dock_widget undock, dock and close (bug #54078)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
27935
diff
changeset
|
223 m_close_action->setShortcutContext (Qt::WidgetWithChildrenShortcut); |
106c8ba2f13c
Add shortcut keys for octave_dock_widget undock, dock and close (bug #54078)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
27935
diff
changeset
|
224 addAction (m_close_action); |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29434
diff
changeset
|
225 connect (m_close_action, &QAction::triggered, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29434
diff
changeset
|
226 this, &octave_dock_widget::change_visibility); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24696
diff
changeset
|
227 |
29612
9c04fea333ca
avoid connecting to parent slots in octave_dock_widget
John W. Eaton <jwe@octave.org>
parents:
29542
diff
changeset
|
228 connect (this, QOverload<const fcn_callback&>::of (&octave_dock_widget::interpreter_event), |
9c04fea333ca
avoid connecting to parent slots in octave_dock_widget
John W. Eaton <jwe@octave.org>
parents:
29542
diff
changeset
|
229 &oct_qobj, QOverload<const fcn_callback&>::of (&base_qobject::interpreter_event)); |
27302
5f170ea12fa1
use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents:
27281
diff
changeset
|
230 |
29612
9c04fea333ca
avoid connecting to parent slots in octave_dock_widget
John W. Eaton <jwe@octave.org>
parents:
29542
diff
changeset
|
231 connect (this, QOverload<const meth_callback&>::of (&octave_dock_widget::interpreter_event), |
9c04fea333ca
avoid connecting to parent slots in octave_dock_widget
John W. Eaton <jwe@octave.org>
parents:
29542
diff
changeset
|
232 &oct_qobj, QOverload<const meth_callback&>::of (&base_qobject::interpreter_event)); |
27302
5f170ea12fa1
use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents:
27281
diff
changeset
|
233 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
234 m_close_action->setToolTip (tr ("Hide widget")); |
24812
ed9ba20d6ed3
Make the variable editor multi-panel via a QMainWindow layout (bug #53046)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24696
diff
changeset
|
235 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
236 setStyleSheet (qdockwidget_css (QString (":/actions/icons/widget-close.png"), |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
237 QString ("Close widget"), |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
238 QString (":/actions/icons/widget-undock.png"), |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
239 QString ("Undock widget"), |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
240 m_icon_size, |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
241 QString (""), |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
242 QString (""))); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
243 if (widget ()) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
244 widget ()->setToolTip (QString ("")); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
245 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
246 m_icon_color = ""; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
247 m_title_3d = 50; |
19360
2f9d9663b6b0
fix double clicks into the borders of floating dock widgets (bug #43662)
Torsten <ttl@justmail.de>
parents:
18555
diff
changeset
|
248 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
249 installEventFilter (this); |
19360
2f9d9663b6b0
fix double clicks into the borders of floating dock widgets (bug #43662)
Torsten <ttl@justmail.de>
parents:
18555
diff
changeset
|
250 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
251 setFocusPolicy (Qt::StrongFocus); |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
252 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
253 setFeatures (QDockWidget::AllDockWidgetFeatures); |
25355
5bb07f6e3707
fix uninitialized settings of octave dock widgets at startup (bug #53835)
Torsten <mttl@mailbox.org>
parents:
25354
diff
changeset
|
254 |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
255 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
|
256 handle_settings (rmgr.get_settings ()); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
257 } |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
258 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
259 void |
29199
0b18887bc997
simplify initialization of gui dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29147
diff
changeset
|
260 octave_dock_widget::init_window_menu_entry (void) |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
261 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
262 emit active_changed (isVisible ()); // emit once for init of window menu |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
263 } |
16809
84505f200e05
fix checked state of window menu entries at startup (bug #39322)
Torsten <ttl@justmail.de>
parents:
16798
diff
changeset
|
264 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
265 // make the widget floating |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
266 void |
26818
f7b10bd40045
fix dock widget position when being dragged out of the main window (bug #55704)
Torsten <mttl@mailbox.org>
parents:
26452
diff
changeset
|
267 octave_dock_widget::make_window (bool widget_was_dragged) |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
268 { |
25356
1008b4797a6e
fix visibility of dock widgets at startup
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
269 bool vis = isVisible (); |
1008b4797a6e
fix visibility of dock widgets at startup
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
270 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
271 // prevent follow-up calls by clearing state variable |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
272 m_waiting_for_mouse_button_release = false; |
17686
65544374c1cf
restore (un)docking of widgets without reparenting on non-windows systems
Torsten <ttl@justmail.de>
parents:
17090
diff
changeset
|
273 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
274 set_focus_predecessor (); // set focus previously active widget if tabbed |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
275 |
26818
f7b10bd40045
fix dock widget position when being dragged out of the main window (bug #55704)
Torsten <mttl@mailbox.org>
parents:
26452
diff
changeset
|
276 // Before unparenting, get current geometry for restoring if dragged |
f7b10bd40045
fix dock widget position when being dragged out of the main window (bug #55704)
Torsten <mttl@mailbox.org>
parents:
26452
diff
changeset
|
277 QRect geom = geometry (); |
f7b10bd40045
fix dock widget position when being dragged out of the main window (bug #55704)
Torsten <mttl@mailbox.org>
parents:
26452
diff
changeset
|
278 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
279 // the widget has to be reparented (parent = 0), preferably |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
280 // from a non-toplevel widget otherwise may not have full |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
281 // decorations, e.g., no taskbar icon and always in front |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
282 if (isFloating ()) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
283 setFloating (false); |
26818
f7b10bd40045
fix dock widget position when being dragged out of the main window (bug #55704)
Torsten <mttl@mailbox.org>
parents:
26452
diff
changeset
|
284 |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
285 if (m_main_window) |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
286 { |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
287 // Before making it a separate (no more parent) floating widget, |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
288 // remove the dock widget from the main window. This ensures |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
289 // that tabbed widgets keep their focus when it is re-docked |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
290 // later |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
291 m_main_window->removeDockWidget (this); |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
292 } |
26818
f7b10bd40045
fix dock widget position when being dragged out of the main window (bug #55704)
Torsten <mttl@mailbox.org>
parents:
26452
diff
changeset
|
293 |
25509
e00aa6a75edd
Do not make floated widgets a Qt::Window to conserve title bar (bug #54078)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25396
diff
changeset
|
294 setParent (0, Qt::CustomizeWindowHint | Qt::WindowTitleHint | |
25887
ad3417a54be6
Keep QWindow flag when setting parent in undocked mode (Bug #54495)
John Donoghue
parents:
25509
diff
changeset
|
295 Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint | Qt::Window); |
24570
c9aab297130e
make floating dock widgets resizable in KDE Oxygen (bug #52797)
Torsten <mttl@mailbox.org>
parents:
24534
diff
changeset
|
296 |
26818
f7b10bd40045
fix dock widget position when being dragged out of the main window (bug #55704)
Torsten <mttl@mailbox.org>
parents:
26452
diff
changeset
|
297 // restore the last geometry when floating only if we have not dragged |
f7b10bd40045
fix dock widget position when being dragged out of the main window (bug #55704)
Torsten <mttl@mailbox.org>
parents:
26452
diff
changeset
|
298 // the window outside the main window |
f7b10bd40045
fix dock widget position when being dragged out of the main window (bug #55704)
Torsten <mttl@mailbox.org>
parents:
26452
diff
changeset
|
299 if (! widget_was_dragged) |
f7b10bd40045
fix dock widget position when being dragged out of the main window (bug #55704)
Torsten <mttl@mailbox.org>
parents:
26452
diff
changeset
|
300 geom = m_recent_float_geom.isNull () ? QRect (50,100,480,480) |
f7b10bd40045
fix dock widget position when being dragged out of the main window (bug #55704)
Torsten <mttl@mailbox.org>
parents:
26452
diff
changeset
|
301 : m_recent_float_geom; |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
302 setGeometry (geom); |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
303 |
27937
8dc5b36f1245
include new undock/dock actions into the shortcut manager
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27936
diff
changeset
|
304 // adjust the (un)dock action |
27936
106c8ba2f13c
Add shortcut keys for octave_dock_widget undock, dock and close (bug #54078)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
27935
diff
changeset
|
305 disconnect (m_dock_action, 0, this, 0); |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29434
diff
changeset
|
306 connect (m_dock_action, &QAction::triggered, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29434
diff
changeset
|
307 this, &octave_dock_widget::make_widget); |
27937
8dc5b36f1245
include new undock/dock actions into the shortcut manager
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27936
diff
changeset
|
308 |
8dc5b36f1245
include new undock/dock actions into the shortcut manager
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27936
diff
changeset
|
309 // adjust the (un)dock icon |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
310 if (titleBarWidget ()) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
311 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
312 m_dock_action->setIcon (QIcon (":/actions/icons/widget-dock" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
313 + m_icon_color + ".png")); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
314 m_dock_action->setToolTip (tr ("Dock widget")); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
315 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
316 else |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
317 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
318 disconnect (m_default_float_button, 0, this, 0); |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29434
diff
changeset
|
319 connect (m_default_float_button, &QAbstractButton::clicked, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29434
diff
changeset
|
320 this, &octave_dock_widget::make_widget); |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
321 } |
17686
65544374c1cf
restore (un)docking of widgets without reparenting on non-windows systems
Torsten <ttl@justmail.de>
parents:
17090
diff
changeset
|
322 |
25384
9b67c2294129
fix missing title bar highlighting when (un)docking a widget
Torsten <mttl@mailbox.org>
parents:
25373
diff
changeset
|
323 raise (); |
9b67c2294129
fix missing title bar highlighting when (un)docking a widget
Torsten <mttl@mailbox.org>
parents:
25373
diff
changeset
|
324 activateWindow (); |
9b67c2294129
fix missing title bar highlighting when (un)docking a widget
Torsten <mttl@mailbox.org>
parents:
25373
diff
changeset
|
325 |
25356
1008b4797a6e
fix visibility of dock widgets at startup
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
326 if (vis) |
27935
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
327 { |
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
328 show (); |
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
329 setFocus (); |
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
330 set_style (true); |
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
331 } |
27089
9326c2258e60
fix visibility of find dialog when editor is docked/undocked (bug #5)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26818
diff
changeset
|
332 |
9326c2258e60
fix visibility of find dialog when editor is docked/undocked (bug #5)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26818
diff
changeset
|
333 emit topLevelChanged (true); // Be sure signal is emitted |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
334 } |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
335 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
336 // dock the widget |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
337 void |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
338 octave_dock_widget::make_widget (bool) |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
339 { |
25356
1008b4797a6e
fix visibility of dock widgets at startup
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
340 bool vis = isVisible (); |
1008b4797a6e
fix visibility of dock widgets at startup
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
341 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
342 // Since floating widget has no parent, we have to read it |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
343 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
|
344 gui_settings *settings = rmgr.get_settings (); |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
345 |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
346 if (m_main_window) |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
347 { |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
348 settings->setValue (mw_state.key, m_main_window->saveState ()); |
29754
4c569e386e9b
improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents:
29709
diff
changeset
|
349 |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
350 // Stay window, otherwise will bounce back to window by default |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
351 // because there is no layout information for this widget in the |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
352 // saved settings. |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
353 setParent (m_main_window, Qt::Window); |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
354 m_main_window->addDockWidget (Qt::BottomDockWidgetArea, this); |
29754
4c569e386e9b
improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents:
29709
diff
changeset
|
355 m_adopted = false; |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
356 // recover old window states, hide and re-show new added widget |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
357 m_main_window->restoreState (settings->value (mw_state.key).toByteArray ()); |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
358 setFloating (false); |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
359 // restore size using setGeometry instead of restoreGeometry |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
360 // following this post: |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
361 // https://forum.qt.io/topic/79326/qdockwidget-restoregeometry-not-working-correctly-when-qmainwindow-is-maximized/5 |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
362 setGeometry (m_recent_dock_geom); |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
363 } |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
364 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
365 // adjust the (un)dock icon |
29754
4c569e386e9b
improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents:
29709
diff
changeset
|
366 disconnect (m_dock_action, 0, this, 0); |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29434
diff
changeset
|
367 connect (m_dock_action, &QAction::triggered, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29434
diff
changeset
|
368 this, &octave_dock_widget::make_window); |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
369 if (titleBarWidget ()) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
370 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
371 m_dock_action->setIcon (QIcon (":/actions/icons/widget-undock" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
372 + m_icon_color + ".png")); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
373 m_dock_action->setToolTip (tr ("Undock widget")); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
374 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
375 else |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
376 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
377 disconnect (m_default_float_button, 0, this, 0); |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29434
diff
changeset
|
378 connect (m_default_float_button, &QAbstractButton::clicked, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29434
diff
changeset
|
379 this, &octave_dock_widget::make_window); |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
380 } |
25356
1008b4797a6e
fix visibility of dock widgets at startup
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
381 |
25384
9b67c2294129
fix missing title bar highlighting when (un)docking a widget
Torsten <mttl@mailbox.org>
parents:
25373
diff
changeset
|
382 raise (); |
9b67c2294129
fix missing title bar highlighting when (un)docking a widget
Torsten <mttl@mailbox.org>
parents:
25373
diff
changeset
|
383 QApplication::setActiveWindow (this); |
9b67c2294129
fix missing title bar highlighting when (un)docking a widget
Torsten <mttl@mailbox.org>
parents:
25373
diff
changeset
|
384 |
25356
1008b4797a6e
fix visibility of dock widgets at startup
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
385 if (vis) |
1008b4797a6e
fix visibility of dock widgets at startup
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
386 { |
1008b4797a6e
fix visibility of dock widgets at startup
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
387 show (); |
27281
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
388 setFocus (); |
25384
9b67c2294129
fix missing title bar highlighting when (un)docking a widget
Torsten <mttl@mailbox.org>
parents:
25373
diff
changeset
|
389 set_style (true); |
25356
1008b4797a6e
fix visibility of dock widgets at startup
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
390 } |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
391 } |
17686
65544374c1cf
restore (un)docking of widgets without reparenting on non-windows systems
Torsten <ttl@justmail.de>
parents:
17090
diff
changeset
|
392 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
393 // dock the widget |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
394 void |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
395 octave_dock_widget::default_dock (bool) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
396 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
397 setFloating (false); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
398 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
399 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
400 // set the widget which previously had focus when tabified |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
401 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
402 octave_dock_widget::set_predecessor_widget (octave_dock_widget *prev_widget) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
403 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
404 m_predecessor_widget = prev_widget; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
405 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
406 |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
407 void |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
408 octave_dock_widget::set_main_window (main_window *mw) |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
409 { |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
410 m_main_window = mw; |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
411 |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
412 if (m_main_window) |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
413 { |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
414 connect (m_main_window, &main_window::copyClipboard_signal, |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
415 this, &octave_dock_widget::copyClipboard); |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
416 |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
417 connect (m_main_window, &main_window::pasteClipboard_signal, |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
418 this, &octave_dock_widget::pasteClipboard); |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
419 |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
420 connect (m_main_window, &main_window::selectAll_signal, |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
421 this, &octave_dock_widget::selectAll); |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
422 |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
423 connect (m_main_window, &main_window::undo_signal, |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
424 this, &octave_dock_widget::do_undo); |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
425 } |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
426 } |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
427 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
428 // close event |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
429 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
430 octave_dock_widget::closeEvent (QCloseEvent *e) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
431 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
432 emit active_changed (false); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
433 set_focus_predecessor (); |
28018
20a9b99d515c
fix restoring floating console widget (bug #56989)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28005
diff
changeset
|
434 save_settings (); |
20a9b99d515c
fix restoring floating console widget (bug #56989)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28005
diff
changeset
|
435 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
436 QDockWidget::closeEvent (e); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
437 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
438 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
439 // get focus widget |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
440 QWidget * |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
441 octave_dock_widget::focusWidget (void) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
442 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
443 QWidget *w = QApplication::focusWidget (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
444 if (w && w->focusProxy ()) w = w->focusProxy (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
445 return w; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
446 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
447 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
448 bool |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
449 octave_dock_widget::event (QEvent *event) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
450 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
451 // low-level check of whether docked-widget became a window via |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
452 // double-click or via drag-and-drop |
26818
f7b10bd40045
fix dock widget position when being dragged out of the main window (bug #55704)
Torsten <mttl@mailbox.org>
parents:
26452
diff
changeset
|
453 if ( (event->type () == QEvent::MouseButtonDblClick && ! isFloating ()) |
27935
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
454 || (event->type () == QEvent::ActivationChange |
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
455 && m_waiting_for_mouse_button_release)) |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
456 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
457 bool retval = QDockWidget::event (event); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
458 if (isFloating () && parent () != 0) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
459 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
460 m_waiting_for_mouse_button_release = false; |
26818
f7b10bd40045
fix dock widget position when being dragged out of the main window (bug #55704)
Torsten <mttl@mailbox.org>
parents:
26452
diff
changeset
|
461 emit queue_make_window (event->type () != QEvent::MouseButtonDblClick); |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
462 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
463 return retval; |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
464 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
465 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
466 return QDockWidget::event (event); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
467 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
468 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
469 void |
27611
0495b64288f7
use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
27562
diff
changeset
|
470 octave_dock_widget::handle_settings (const gui_settings *settings) |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
471 { |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
472 if (! settings) |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
473 return; |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
474 |
29202
66af654b3485
provide focus follows mouse for widgets in the main window (bug #59701)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29199
diff
changeset
|
475 m_focus_follows_mouse = settings->value (dw_focus_follows_mouse).toBool (); |
66af654b3485
provide focus follows mouse for widgets in the main window (bug #59701)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29199
diff
changeset
|
476 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
477 m_custom_style |
27672
a36443e94f8a
simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents:
27671
diff
changeset
|
478 = settings->value (dw_title_custom_style).toBool (); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
479 |
27665
a1271c5b621a
replace preference literals by symbolic constants for dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
480 m_title_3d = settings->value (dw_title_3d.key, dw_title_3d.def).toInt (); |
a1271c5b621a
replace preference literals by symbolic constants for dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
481 |
a1271c5b621a
replace preference literals by symbolic constants for dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
482 m_fg_color |
27672
a36443e94f8a
simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents:
27671
diff
changeset
|
483 = settings->value (dw_title_fg_color).value<QColor> (); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
484 |
27665
a1271c5b621a
replace preference literals by symbolic constants for dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
485 m_fg_color_active |
27672
a36443e94f8a
simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents:
27671
diff
changeset
|
486 = settings->value (dw_title_fg_color_active).value<QColor> (); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
487 |
27672
a36443e94f8a
simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents:
27671
diff
changeset
|
488 m_bg_color = settings->value (dw_title_bg_color).value<QColor> (); |
27665
a1271c5b621a
replace preference literals by symbolic constants for dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
489 |
a1271c5b621a
replace preference literals by symbolic constants for dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
490 m_bg_color_active |
27672
a36443e94f8a
simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents:
27671
diff
changeset
|
491 = settings->value (dw_title_bg_color_active).value<QColor> (); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
492 |
24842
74229798f604
always select suitable icon color for sock widgets depending on title bar color
Torsten <mttl@mailbox.org>
parents:
24836
diff
changeset
|
493 QColor bcol (m_bg_color); |
74229798f604
always select suitable icon color for sock widgets depending on title bar color
Torsten <mttl@mailbox.org>
parents:
24836
diff
changeset
|
494 QColor bcola (m_bg_color_active); |
74229798f604
always select suitable icon color for sock widgets depending on title bar color
Torsten <mttl@mailbox.org>
parents:
24836
diff
changeset
|
495 |
74229798f604
always select suitable icon color for sock widgets depending on title bar color
Torsten <mttl@mailbox.org>
parents:
24836
diff
changeset
|
496 if (! m_custom_style) |
74229798f604
always select suitable icon color for sock widgets depending on title bar color
Torsten <mttl@mailbox.org>
parents:
24836
diff
changeset
|
497 { |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
498 bcol = QWidget::palette ().color (m_title_widget->backgroundRole ()); |
24842
74229798f604
always select suitable icon color for sock widgets depending on title bar color
Torsten <mttl@mailbox.org>
parents:
24836
diff
changeset
|
499 bcola = bcol; |
74229798f604
always select suitable icon color for sock widgets depending on title bar color
Torsten <mttl@mailbox.org>
parents:
24836
diff
changeset
|
500 } |
74229798f604
always select suitable icon color for sock widgets depending on title bar color
Torsten <mttl@mailbox.org>
parents:
24836
diff
changeset
|
501 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
502 int r, g, b; |
24842
74229798f604
always select suitable icon color for sock widgets depending on title bar color
Torsten <mttl@mailbox.org>
parents:
24836
diff
changeset
|
503 bcol.getRgb (&r, &g, &b); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
504 if (r+g+b < 400) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
505 m_icon_color = "-light"; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
506 else |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
507 m_icon_color = ""; |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
508 |
24842
74229798f604
always select suitable icon color for sock widgets depending on title bar color
Torsten <mttl@mailbox.org>
parents:
24836
diff
changeset
|
509 bcola.getRgb (&r, &g, &b); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
510 if (r+g+b < 400) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
511 m_icon_color_active = "-light"; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
512 else |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
513 m_icon_color_active = ""; |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
514 |
29694
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
515 |
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
516 QWidget *ref_widget = m_main_window; |
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
517 if (! ref_widget) |
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
518 ref_widget = this; |
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
519 |
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
520 int x, y, w, h; |
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
521 QApplication::desktop ()->availableGeometry (ref_widget).getRect (&x, &y, &w, &h); |
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
522 QRect default_floating_size = QRect (x+16, y+32, w/3, h/2); |
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
523 |
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
524 QRect default_dock_size; |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
525 if (m_main_window) |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
526 { |
29694
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
527 // We have a main window, dock size depends on size of main window |
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
528 m_main_window->geometry ().getRect (&x, &y, &w, &h); |
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
529 default_dock_size = QRect (x+16, y+32, w/3, h/3); |
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
530 } |
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
531 else |
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
532 { |
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
533 // No main window, default dock size should never be used |
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
534 default_dock_size = QRect (0, 0, w/10, h/10); |
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
535 } |
26299
c95884eed1cf
make restoring gui more robust to changes of desktop size (bug #53207)
Torsten <mttl@mailbox.org>
parents:
25907
diff
changeset
|
536 |
29694
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
537 m_recent_float_geom |
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
538 = settings->value (dw_float_geometry.key.arg (objectName ()), |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
539 default_floating_size).toRect (); |
26428
93c4fabb2ead
only reset floating geometry of dock widget when not visible (bug #53207)
Torsten <mttl@mailbox.org>
parents:
26376
diff
changeset
|
540 |
29694
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
541 QWidget dummy; |
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
542 dummy.setGeometry (m_recent_float_geom); |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
543 |
29694
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
544 if (QApplication::desktop ()->screenNumber (&dummy) == -1) |
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
545 m_recent_float_geom = default_floating_size; |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
546 |
29694
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
547 // The following is required for ensure smooth transition from old |
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
548 // saveGeomety to new QRect setting (see comment for restoring size |
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
549 // of docked widgets) |
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
550 QVariant dock_geom |
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
551 = settings->value (dw_dock_geometry.key.arg (objectName ()), |
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
552 default_dock_size); |
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
553 if (dock_geom.canConvert (QMetaType::QRect)) |
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
554 m_recent_dock_geom = dock_geom.toRect (); |
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
555 else |
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
556 m_recent_dock_geom = dw_dock_geometry.def.toRect (); |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
557 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
558 notice_settings (settings); // call individual handler |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
559 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
560 set_style (false); |
27467
c7a898396151
compacter tool bar and filter bars in dock widgets (bug #53902)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27412
diff
changeset
|
561 |
c7a898396151
compacter tool bar and filter bars in dock widgets (bug #53902)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27412
diff
changeset
|
562 // Compacter design |
c7a898396151
compacter tool bar and filter bars in dock widgets (bug #53902)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27412
diff
changeset
|
563 QToolBar* toolbar = findChild <QToolBar *> (); |
c7a898396151
compacter tool bar and filter bars in dock widgets (bug #53902)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27412
diff
changeset
|
564 if (toolbar) |
27560
3fcc650de22f
split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
27478
diff
changeset
|
565 toolbar->setStyleSheet (toolbar->styleSheet () + global_toolbar_style); |
27478
9e526393d80a
reduced vertical space in gui with responsive toolbar buttons (bug #53902)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27468
diff
changeset
|
566 |
27468
8ba19629d5ef
compacter menu bars in dock widgets (bug #53902)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27467
diff
changeset
|
567 QMenuBar* menubar = findChild <QMenuBar *> (); |
8ba19629d5ef
compacter menu bars in dock widgets (bug #53902)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27467
diff
changeset
|
568 if (menubar) |
27560
3fcc650de22f
split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
27478
diff
changeset
|
569 menubar->setStyleSheet (menubar->styleSheet () + global_menubar_style); |
27467
c7a898396151
compacter tool bar and filter bars in dock widgets (bug #53902)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27412
diff
changeset
|
570 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
571 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
572 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
573 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
574 octave_dock_widget::handle_active_dock_changed (octave_dock_widget *w_old, |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
575 octave_dock_widget *w_new) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
576 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
577 if (m_custom_style && this == w_old) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
578 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
579 set_style (false); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
580 update (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
581 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
582 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
583 if (m_custom_style && this == w_new) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
584 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
585 set_style (true); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
586 update (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
587 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
588 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
589 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
590 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
591 octave_dock_widget::save_settings (void) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
592 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
593 // save state of this dock-widget |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
594 QString name = objectName (); |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
595 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
|
596 gui_settings *settings = rmgr.get_settings (); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
597 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
598 if (! settings) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
599 return; |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
600 |
25355
5bb07f6e3707
fix uninitialized settings of octave dock widgets at startup (bug #53835)
Torsten <mttl@mailbox.org>
parents:
25354
diff
changeset
|
601 store_geometry (); |
5bb07f6e3707
fix uninitialized settings of octave dock widgets at startup (bug #53835)
Torsten <mttl@mailbox.org>
parents:
25354
diff
changeset
|
602 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
603 // conditional needed? |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
604 if (! m_recent_float_geom.isNull ()) |
27665
a1271c5b621a
replace preference literals by symbolic constants for dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
605 settings->setValue (dw_float_geometry.key.arg (name), m_recent_float_geom); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
606 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
607 if (! m_recent_dock_geom.isEmpty ()) |
27665
a1271c5b621a
replace preference literals by symbolic constants for dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
608 settings->setValue (dw_dock_geometry.key.arg (name), m_recent_dock_geom); |
a1271c5b621a
replace preference literals by symbolic constants for dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
609 settings->setValue (dw_is_visible.key.arg (name), isVisible ()); // store visibility |
a1271c5b621a
replace preference literals by symbolic constants for dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
610 settings->setValue (dw_is_floating.key.arg (name), isFloating ()); // store floating |
a1271c5b621a
replace preference literals by symbolic constants for dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
611 settings->setValue (dw_is_minimized.key.arg (name), isMinimized ()); // store minimized |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
612 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
613 settings->sync (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
614 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
615 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
616 bool octave_dock_widget::eventFilter (QObject *obj, QEvent *e) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
617 { |
29202
66af654b3485
provide focus follows mouse for widgets in the main window (bug #59701)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29199
diff
changeset
|
618 // Ignore double clicks into window decoration elements |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
619 if (e->type () == QEvent::NonClientAreaMouseButtonDblClick) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
620 { |
29202
66af654b3485
provide focus follows mouse for widgets in the main window (bug #59701)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29199
diff
changeset
|
621 e->ignore (); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
622 return true; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
623 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
624 |
29202
66af654b3485
provide focus follows mouse for widgets in the main window (bug #59701)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29199
diff
changeset
|
625 // Detect mouse enter events if "focus follows mouse" is desired |
66af654b3485
provide focus follows mouse for widgets in the main window (bug #59701)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29199
diff
changeset
|
626 // for widgets docked to the main window (non floating) and activate |
29434
91f32bf0d497
maint: strip trailing spaces from code base.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
627 // the widget currently under the mouse |
29202
66af654b3485
provide focus follows mouse for widgets in the main window (bug #59701)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29199
diff
changeset
|
628 if (m_focus_follows_mouse && ! isFloating () && (e->type () == QEvent::Enter)) |
66af654b3485
provide focus follows mouse for widgets in the main window (bug #59701)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29199
diff
changeset
|
629 activate (); |
66af654b3485
provide focus follows mouse for widgets in the main window (bug #59701)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29199
diff
changeset
|
630 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
631 return QDockWidget::eventFilter (obj,e); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
632 } |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
633 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
634 void |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
635 octave_dock_widget::store_geometry (void) |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
636 { |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
637 if (isFloating ()) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
638 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
639 if (! parent ()) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
640 m_recent_float_geom = geometry (); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
641 } |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
642 else |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
643 { |
29088
909d68d27892
fix restoring dock widgets geometry in full screen main window
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28018
diff
changeset
|
644 m_recent_dock_geom = geometry (); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
645 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
646 } |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
647 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
648 void |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
649 octave_dock_widget::moveEvent (QMoveEvent *event) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
650 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
651 store_geometry (); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
652 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
653 QDockWidget::moveEvent (event); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
654 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
655 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
656 void |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
657 octave_dock_widget::resizeEvent (QResizeEvent *event) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
658 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
659 store_geometry (); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
660 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
661 QDockWidget::resizeEvent (event); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
662 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
663 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
664 // slot for hiding the widget |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
665 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
666 octave_dock_widget::change_visibility (bool) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
667 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
668 setVisible (false); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
669 emit active_changed (false); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
670 } |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
671 |
27281
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
672 void octave_dock_widget::activate (void) |
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
673 { |
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
674 if (! isVisible ()) |
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
675 setVisible (true); |
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
676 |
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
677 setFocus (); |
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
678 activateWindow (); |
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
679 raise (); |
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
680 } |
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
681 |
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
682 void octave_dock_widget::handle_visibility (bool visible) |
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
683 { |
29199
0b18887bc997
simplify initialization of gui dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29147
diff
changeset
|
684 if (visible) |
0b18887bc997
simplify initialization of gui dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29147
diff
changeset
|
685 { |
0b18887bc997
simplify initialization of gui dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29147
diff
changeset
|
686 emit active_changed (true); |
0b18887bc997
simplify initialization of gui dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29147
diff
changeset
|
687 if (! isFloating ()) |
0b18887bc997
simplify initialization of gui dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29147
diff
changeset
|
688 setFocus (); |
0b18887bc997
simplify initialization of gui dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29147
diff
changeset
|
689 } |
27281
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
690 } |
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
691 |
27935
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
692 void |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
693 octave_dock_widget::toplevel_change (bool toplevel) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
694 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
695 QObject *dockobj; |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
696 const char *docksig; |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
697 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
698 if (titleBarWidget ()) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
699 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
700 dockobj = m_dock_action; |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
701 docksig = SIGNAL (triggered (bool)); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
702 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
703 else |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
704 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
705 dockobj = m_default_float_button; |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
706 docksig = SIGNAL (clicked (bool)); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
707 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
708 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
709 if (toplevel) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
710 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
711 // This is a fallback in case the attempt to create a floated |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
712 // top-level window fails and the QDockWidget remains a child |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
713 // of the QMainWindow. |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
714 connect (dockobj, docksig, this, SLOT (default_dock (bool))); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
715 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
716 // Could be dragging window, so must wait until there is a |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
717 // change in focus. |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
718 if (parent () != 0) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
719 m_waiting_for_mouse_button_release = true; |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
720 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
721 else |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
722 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
723 // If a drag-and-drop within the QMainWindow occurred, want to remain a widget. |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
724 m_waiting_for_mouse_button_release = false; |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
725 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
726 // Making into a widget immediately will mangle the double-click |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
727 // status and cause problems on followup button clicks. |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
728 if (parent () == 0) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
729 emit queue_make_widget (); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
730 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
731 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
732 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
733 void |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
734 octave_dock_widget::set_style (bool active) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
735 { |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
736 QString css_foreground; |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
737 QString css_background; |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
738 QString css_button; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
739 QString dock_icon; |
18218
7952fb0435db
improve title bar of dock widgets
Torsten <ttl@justmail.de>
parents:
18180
diff
changeset
|
740 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
741 QString icon_col = m_icon_color; |
19431
bd27cd403d00
fix errors when building octave for windows (regression from d93293218966)
Torsten <ttl@justmail.de>
parents:
19423
diff
changeset
|
742 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
743 QString close_tooltip = "Close widget"; |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
744 QString dock_tooltip; |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
745 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
746 if (isFloating ()) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
747 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
748 dock_icon = "widget-dock"; |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
749 dock_tooltip = "Dock widget"; |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
750 } |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
751 else |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
752 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
753 dock_icon = "widget-undock"; |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
754 dock_tooltip = "Undock widget"; |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
755 } |
18180
b3838cedfe04
redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents:
17929
diff
changeset
|
756 |
20794
e870a68742a6
change alignment of dock widget titles for OSX (bug #46592)
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
757 #if defined (Q_OS_MAC) |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
758 QString alignment = "center"; |
20794
e870a68742a6
change alignment of dock widget titles for OSX (bug #46592)
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
759 #else |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
760 QString alignment = "center left"; |
20794
e870a68742a6
change alignment of dock widget titles for OSX (bug #46592)
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
761 #endif |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
762 if (m_custom_style) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
763 { |
18180
b3838cedfe04
redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents:
17929
diff
changeset
|
764 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
765 QColor bg_col, fg_col; |
18180
b3838cedfe04
redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents:
17929
diff
changeset
|
766 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
767 if (active) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
768 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
769 bg_col = m_bg_color_active; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
770 fg_col = m_fg_color_active; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
771 icon_col = m_icon_color_active; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
772 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
773 else |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
774 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
775 bg_col = m_bg_color; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
776 fg_col = m_fg_color; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
777 icon_col = m_icon_color; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
778 } |
18218
7952fb0435db
improve title bar of dock widgets
Torsten <ttl@justmail.de>
parents:
18180
diff
changeset
|
779 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
780 QColor bg_col_top, bg_col_bottom; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
781 if (m_title_3d > 0) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
782 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
783 bg_col_top = bg_col.lighter (100 + m_title_3d); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
784 bg_col_bottom = bg_col.darker (100 + m_title_3d); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
785 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
786 else |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
787 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
788 bg_col_top = bg_col.darker (100 - m_title_3d); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
789 bg_col_bottom = bg_col.lighter (100 - m_title_3d); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
790 } |
19913
2a992bd19169
make color gradient of custom title bar adjustable (bug #44435)
Torsten <ttl@justmail.de>
parents:
19911
diff
changeset
|
791 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
792 css_foreground = QString (" color: %1;\n").arg (fg_col.name ()); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
793 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
794 css_background = |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
795 QString (" background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1," |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
796 " stop: 0 %1, stop: 0.60 %2, stop: 0.95 %2 stop: 1.0 %3);\n"). |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
797 arg (bg_col_top.name ()). |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
798 arg (bg_col.name ()). |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
799 arg (bg_col_bottom.name ()); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
800 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
801 else |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
802 { |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
803 css_foreground = QString (""); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
804 css_background = QString (""); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
805 } |
18180
b3838cedfe04
redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents:
17929
diff
changeset
|
806 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
807 QString full_dock_icon = ":/actions/icons/" + dock_icon + icon_col + ".png"; |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
808 QString full_close_icon = ":/actions/icons/widget-close" + icon_col + ".png"; |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
809 if (titleBarWidget ()) |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
810 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
811 titleBarWidget ()->setStyleSheet (css_foreground + css_background); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
812 css_button = QString ("QToolButton {background: transparent; border: 0px;}"); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
813 m_dock_button->setStyleSheet (css_button); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
814 m_close_button->setStyleSheet (css_button); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
815 m_dock_action->setIcon (QIcon (full_dock_icon)); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
816 m_close_action->setIcon (QIcon (full_close_icon)); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
817 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
818 else |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
819 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
820 setStyleSheet (qdockwidget_css (full_close_icon, |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
821 close_tooltip, |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
822 full_dock_icon, |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
823 dock_tooltip, |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
824 m_icon_size, |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
825 css_foreground, |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
826 css_background)); |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
827 } |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
828 } |
19423
d93293218966
custom style of dock widget title bars depending on focus (bug #43837)
Torsten <ttl@justmail.de>
parents:
19360
diff
changeset
|
829 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
830 // set focus to previously active widget in tabbed widget stack |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
831 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
832 octave_dock_widget::set_focus_predecessor (void) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
833 { |
25396
75fef3484d12
Prevent hidden predecessor windows appearing when successor is floated (bug #53357)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25384
diff
changeset
|
834 // only != 0 if widget was tabbed |
75fef3484d12
Prevent hidden predecessor windows appearing when successor is floated (bug #53357)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25384
diff
changeset
|
835 if (m_predecessor_widget && m_predecessor_widget->isVisible ()) |
27281
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
836 m_predecessor_widget->setFocus (); |
19423
d93293218966
custom style of dock widget title bars depending on focus (bug #43837)
Torsten <ttl@justmail.de>
parents:
19360
diff
changeset
|
837 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
838 m_predecessor_widget = nullptr; |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
839 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
840 // FIXME: Until cset bda0c5b38bda, the wrong keys "Dockwidget/..." were used |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
841 // here. This had no effect in Qt4, but does in Qt5. In the following, the |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
842 // four incorrect keys are updated if still present in the settings files. |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
843 // The keys are also used in the settings dialog, but |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
844 // octave_dock_widget::handle_settings is already called at program start. |
25172
7b1b504c2f12
update future version numbers in doc strings and comments
John W. Eaton <jwe@octave.org>
parents:
25086
diff
changeset
|
845 // These tests can be removed in a future version of Octave (version 6). |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
846 |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
847 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
|
848 |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
849 rmgr.update_settings_key ("Dockwidgets/title_bg_color", |
27665
a1271c5b621a
replace preference literals by symbolic constants for dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
850 dw_title_bg_color.key); |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
851 |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
852 rmgr.update_settings_key ("Dockwidgets/title_bg_color_active", |
27665
a1271c5b621a
replace preference literals by symbolic constants for dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
853 dw_title_bg_color_active.key); |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
854 |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
855 rmgr.update_settings_key ("Dockwidgets/title_fg_color", |
27665
a1271c5b621a
replace preference literals by symbolic constants for dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
856 dw_title_fg_color.key); |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
857 |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
858 rmgr.update_settings_key ("Dockwidgets/title_fg_color_active", |
27665
a1271c5b621a
replace preference literals by symbolic constants for dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
859 dw_title_fg_color_active.key); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
860 } |
18180
b3838cedfe04
redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents:
17929
diff
changeset
|
861 } |