Mercurial > octave
annotate libgui/src/octave-dock-widget.cc @ 31649:deb553ac2c54
maint: Merge stable to default.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 06 Dec 2022 15:45:27 -0500 |
parents | 431f80aba37a 29d734430e5f |
children | 2422fb7f1e6c |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
30398
diff
changeset
|
3 // Copyright (C) 2012-2022 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
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> |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
32 #include <QHBoxLayout> |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
33 #include <QLabel> |
30690
e2c8c852399e
replace use of depreciated QDesktopWidget in GUI
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30626
diff
changeset
|
34 #include <QScreen> |
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> |
30690
e2c8c852399e
replace use of depreciated QDesktopWidget in GUI
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30626
diff
changeset
|
38 #include <QWindow> |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
39 |
27665
a1271c5b621a
replace preference literals by symbolic constants for dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
40 #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
|
41 #include "gui-preferences-global.h" |
27562
d7876110e854
use symbolic preference keys if available
John W. Eaton <jwe@octave.org>
parents:
27560
diff
changeset
|
42 #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
|
43 #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
|
44 #include "gui-settings.h" |
30690
e2c8c852399e
replace use of depreciated QDesktopWidget in GUI
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30626
diff
changeset
|
45 #include "gui-utils.h" |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
46 #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
|
47 #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
|
48 #include "octave-qobject.h" |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
49 |
31646
c6d54dd31a7e
maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
50 OCTAVE_BEGIN_NAMESPACE(octave) |
c6d54dd31a7e
maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
51 |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
52 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
|
53 : 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
|
54 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
|
55 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
56 QStyle *st = style (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
57 m_icon_size = 0.75*st->pixelMetric (QStyle::PM_SmallIconSize); |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
58 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
59 // 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
|
60 // 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
|
61 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
|
62 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
|
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 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
|
65 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
66 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
|
67 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
|
68 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
69 else |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
70 { |
26343
df510676ca6a
octave-dock-widget.cc: Fix copy & paste error. (bug #55347)
Andreas Weber <octave@josoansi.de>
parents:
26299
diff
changeset
|
71 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
|
72 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
|
73 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
74 } |
18218
7952fb0435db
improve title bar of dock widgets
Torsten <ttl@justmail.de>
parents:
18180
diff
changeset
|
75 |
31621
0645ea65ca6b
handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents:
31619
diff
changeset
|
76 gui_settings settings; |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
77 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
78 // 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
|
79 m_title_widget = new QWidget (); |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
80 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
81 m_dock_action = new QAction |
31621
0645ea65ca6b
handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents:
31619
diff
changeset
|
82 (settings.icon ("widget-undock", true), "", this); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
83 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
|
84 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
|
85 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
|
86 m_dock_button->setFocusPolicy (Qt::NoFocus); |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30275
diff
changeset
|
87 m_dock_button->setIconSize (QSize (m_icon_size, m_icon_size)); |
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
|
88 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
89 m_close_action = new QAction |
31621
0645ea65ca6b
handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents:
31619
diff
changeset
|
90 (settings.icon ("widget-close", true), "", this); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
91 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
|
92 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
|
93 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
|
94 m_close_button->setFocusPolicy (Qt::NoFocus); |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30275
diff
changeset
|
95 m_close_button->setIconSize (QSize (m_icon_size, m_icon_size)); |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
96 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
97 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
|
98 m_dock_button->setStyleSheet (css_button); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
99 m_close_button->setStyleSheet (css_button); |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
100 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
101 QHBoxLayout *h_layout = new QHBoxLayout (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
102 h_layout->addStretch (100); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
103 h_layout->addWidget (m_dock_button); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
104 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
|
105 h_layout->setSpacing (10); |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30275
diff
changeset
|
106 h_layout->setContentsMargins (5, 2, 2, 2); |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
107 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
108 m_title_widget->setLayout (h_layout); |
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
|
109 |
29895
744bb06fea2a
avoid connecting non existing signals from variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29894
diff
changeset
|
110 if (p && (p->objectName () == gui_obj_name_main_window)) |
29780
d79f65e37e89
provide shortcuts in widgets launched from the cli
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29754
diff
changeset
|
111 { |
d79f65e37e89
provide shortcuts in widgets launched from the cli
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29754
diff
changeset
|
112 // Only connect the when a parent (main window) is given |
d79f65e37e89
provide shortcuts in widgets launched from the cli
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29754
diff
changeset
|
113 // copy & paste handling |
29894
2a14420440b8
fix regression from cset 7f22f024afdf
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29891
diff
changeset
|
114 connect (p, SIGNAL (copyClipboard_signal ()), |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30275
diff
changeset
|
115 this, SLOT (copyClipboard ())); |
29894
2a14420440b8
fix regression from cset 7f22f024afdf
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29891
diff
changeset
|
116 connect (p, SIGNAL (pasteClipboard_signal ()), |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30275
diff
changeset
|
117 this, SLOT (pasteClipboard ())); |
29894
2a14420440b8
fix regression from cset 7f22f024afdf
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29891
diff
changeset
|
118 connect (p, SIGNAL (selectAll_signal ()), |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30275
diff
changeset
|
119 this, SLOT (selectAll ())); |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
120 |
29780
d79f65e37e89
provide shortcuts in widgets launched from the cli
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29754
diff
changeset
|
121 // undo handling |
29894
2a14420440b8
fix regression from cset 7f22f024afdf
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29891
diff
changeset
|
122 connect (p, SIGNAL (undo_signal ()), this, SLOT (do_undo ())); |
29780
d79f65e37e89
provide shortcuts in widgets launched from the cli
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29754
diff
changeset
|
123 } |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
124 } |
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
|
125 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
126 // 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
|
127 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
128 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
|
129 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
130 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
|
131 = 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
|
132 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
|
133 label->setStyleSheet ("background-color: transparent;"); |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30275
diff
changeset
|
134 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
|
135 setTitleBarWidget (m_title_widget); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
136 setWindowTitle (title); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
137 } |
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
|
138 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
139 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
|
140 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
|
141 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
|
142 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
|
143 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
|
144 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
145 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
|
146 "{\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 "%6" |
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 " 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
|
150 " 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
|
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 "\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 "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
|
154 "{\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 " 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
|
156 " 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
|
157 "}\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 "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
|
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 " 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
|
162 "}\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 "\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 "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
|
165 "{\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 " 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
|
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 "\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 "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
|
170 " 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
|
171 "%7" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
172 " 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
|
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 "\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 "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
|
176 "{\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 " 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
|
178 " 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
|
179 "}\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
180 "\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
181 "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
|
182 "{\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
183 " 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
|
184 " 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
|
185 "}\n" |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
186 ).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
|
187 .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
|
188 .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
|
189 .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
|
190 } |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
191 |
27620
45bb5bbaf291
don't use singleton pattern for resource manager in GUI
John W. Eaton <jwe@octave.org>
parents:
27611
diff
changeset
|
192 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
|
193 base_qobject& oct_qobj) |
29754
4c569e386e9b
improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents:
29709
diff
changeset
|
194 : 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
|
195 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
|
196 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
|
197 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
|
198 { |
25355
5bb07f6e3707
fix uninitialized settings of octave dock widgets at startup (bug #53835)
Torsten <mttl@mailbox.org>
parents:
25354
diff
changeset
|
199 setObjectName (obj_name); |
26818
f7b10bd40045
fix dock widget position when being dragged out of the main window (bug #55704)
Torsten <mttl@mailbox.org>
parents:
26452
diff
changeset
|
200 |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
201 // 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
|
202 m_main_window = dynamic_cast<main_window *> (p); |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
203 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
204 m_predecessor_widget = nullptr; |
26818
f7b10bd40045
fix dock widget position when being dragged out of the main window (bug #55704)
Torsten <mttl@mailbox.org>
parents:
26452
diff
changeset
|
205 |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29434
diff
changeset
|
206 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
|
207 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
|
208 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
|
209 this, &octave_dock_widget::handle_visibility); |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
210 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
211 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
|
212 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
213 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
|
214 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
|
215 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
|
216 } |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29434
diff
changeset
|
217 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
|
218 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
|
219 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
|
220 this, [=] () { make_widget (); }, Qt::QueuedConnection); |
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 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
|
223 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
|
224 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
|
225 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
|
226 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
|
227 this, &octave_dock_widget::make_window); |
25384
9b67c2294129
fix missing title bar highlighting when (un)docking a widget
Torsten <mttl@mailbox.org>
parents:
25373
diff
changeset
|
228 |
27937
8dc5b36f1245
include new undock/dock actions into the shortcut manager
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27936
diff
changeset
|
229 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
|
230 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
|
231 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
|
232 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
|
233 this, &octave_dock_widget::change_visibility); |
27089
9326c2258e60
fix visibility of find dialog when editor is docked/undocked (bug #5)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26818
diff
changeset
|
234 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
235 m_close_action->setToolTip (tr ("Hide widget")); |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
236 |
30777
439eb9bd4c04
icon fallback concept without QIcon::fallbackSearchPaths (bug #62106)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30772
diff
changeset
|
237 setStyleSheet (qdockwidget_css ( |
30788
c11d34f72b3c
provide different icon sets for the GUI
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30777
diff
changeset
|
238 global_icon_paths.at (ICON_THEME_OCTAVE) + "widget-close.png", |
30777
439eb9bd4c04
icon fallback concept without QIcon::fallbackSearchPaths (bug #62106)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30772
diff
changeset
|
239 QString ("Close widget"), |
30788
c11d34f72b3c
provide different icon sets for the GUI
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30777
diff
changeset
|
240 global_icon_paths.at (ICON_THEME_OCTAVE) + "widget-undock.png", |
30777
439eb9bd4c04
icon fallback concept without QIcon::fallbackSearchPaths (bug #62106)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30772
diff
changeset
|
241 QString ("Undock widget"), |
439eb9bd4c04
icon fallback concept without QIcon::fallbackSearchPaths (bug #62106)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30772
diff
changeset
|
242 m_icon_size, |
439eb9bd4c04
icon fallback concept without QIcon::fallbackSearchPaths (bug #62106)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30772
diff
changeset
|
243 QString (""), |
439eb9bd4c04
icon fallback concept without QIcon::fallbackSearchPaths (bug #62106)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30772
diff
changeset
|
244 QString (""))); |
25356
1008b4797a6e
fix visibility of dock widgets at startup
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
245 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
246 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
|
247 widget ()->setToolTip (QString ("")); |
29754
4c569e386e9b
improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents:
29709
diff
changeset
|
248 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
249 m_icon_color = ""; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
250 m_title_3d = 50; |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
251 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
252 installEventFilter (this); |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
253 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
254 setFocusPolicy (Qt::StrongFocus); |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
255 |
30275
cf434923aec0
gui: Avoid deprecated enum QDockWidget::AllDockWidgetFeatures.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29895
diff
changeset
|
256 setFeatures (QDockWidget::DockWidgetClosable |
cf434923aec0
gui: Avoid deprecated enum QDockWidget::AllDockWidgetFeatures.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29895
diff
changeset
|
257 | QDockWidget::DockWidgetMovable |
cf434923aec0
gui: Avoid deprecated enum QDockWidget::AllDockWidgetFeatures.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29895
diff
changeset
|
258 | QDockWidget::DockWidgetFloatable); |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
259 |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
260 handle_settings (); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
261 } |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
262 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
263 void |
29199
0b18887bc997
simplify initialization of gui dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29147
diff
changeset
|
264 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
|
265 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
266 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
|
267 } |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
268 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
269 // make the widget floating |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
270 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
|
271 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
|
272 { |
25356
1008b4797a6e
fix visibility of dock widgets at startup
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
273 bool vis = isVisible (); |
1008b4797a6e
fix visibility of dock widgets at startup
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
274 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
275 // 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
|
276 m_waiting_for_mouse_button_release = false; |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
277 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
278 set_focus_predecessor (); // set focus previously active widget if tabbed |
25384
9b67c2294129
fix missing title bar highlighting when (un)docking a widget
Torsten <mttl@mailbox.org>
parents:
25373
diff
changeset
|
279 |
26818
f7b10bd40045
fix dock widget position when being dragged out of the main window (bug #55704)
Torsten <mttl@mailbox.org>
parents:
26452
diff
changeset
|
280 // 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
|
281 QRect geom = geometry (); |
17686
65544374c1cf
restore (un)docking of widgets without reparenting on non-windows systems
Torsten <ttl@justmail.de>
parents:
17090
diff
changeset
|
282 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
283 // 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
|
284 // 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
|
285 // 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
|
286 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
|
287 setFloating (false); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
288 |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
289 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
|
290 { |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
291 // 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
|
292 // 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
|
293 // 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
|
294 // later |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
295 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
|
296 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
297 |
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
|
298 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
|
299 Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint | Qt::Window); |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
300 |
26818
f7b10bd40045
fix dock widget position when being dragged out of the main window (bug #55704)
Torsten <mttl@mailbox.org>
parents:
26452
diff
changeset
|
301 // 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
|
302 // 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
|
303 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
|
304 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
|
305 : 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
|
306 setGeometry (geom); |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
307 |
27937
8dc5b36f1245
include new undock/dock actions into the shortcut manager
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27936
diff
changeset
|
308 // 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
|
309 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
|
310 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
|
311 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
|
312 |
8dc5b36f1245
include new undock/dock actions into the shortcut manager
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27936
diff
changeset
|
313 // 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
|
314 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
|
315 { |
31621
0645ea65ca6b
handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents:
31619
diff
changeset
|
316 gui_settings settings; |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
317 |
31621
0645ea65ca6b
handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents:
31619
diff
changeset
|
318 m_dock_action->setIcon (settings.icon ("widget-dock" + m_icon_color, true)); |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
319 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
|
320 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
321 else |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
322 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
323 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
|
324 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
|
325 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
|
326 } |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
327 |
25384
9b67c2294129
fix missing title bar highlighting when (un)docking a widget
Torsten <mttl@mailbox.org>
parents:
25373
diff
changeset
|
328 raise (); |
9b67c2294129
fix missing title bar highlighting when (un)docking a widget
Torsten <mttl@mailbox.org>
parents:
25373
diff
changeset
|
329 activateWindow (); |
28018
20a9b99d515c
fix restoring floating console widget (bug #56989)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28005
diff
changeset
|
330 |
25356
1008b4797a6e
fix visibility of dock widgets at startup
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
331 if (vis) |
27935
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
332 { |
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
333 show (); |
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
334 setFocus (); |
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
335 set_style (true); |
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
336 } |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
337 |
27089
9326c2258e60
fix visibility of find dialog when editor is docked/undocked (bug #5)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26818
diff
changeset
|
338 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
|
339 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
340 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
341 // dock the widget |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
342 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
|
343 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
|
344 { |
31621
0645ea65ca6b
handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents:
31619
diff
changeset
|
345 gui_settings settings; |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
346 |
25356
1008b4797a6e
fix visibility of dock widgets at startup
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
347 bool vis = isVisible (); |
1008b4797a6e
fix visibility of dock widgets at startup
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
348 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
349 // Since floating widget has no parent, we have to read it |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
350 |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
351 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
|
352 { |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
353 settings.setValue (mw_state.key, m_main_window->saveState ()); |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
354 |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
355 // 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
|
356 // 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
|
357 // saved settings. |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
358 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
|
359 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
|
360 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
|
361 // recover old window states, hide and re-show new added widget |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
362 m_main_window->restoreState (settings.value (mw_state.key).toByteArray ()); |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
363 setFloating (false); |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
364 // 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
|
365 // following this post: |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
366 // 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
|
367 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
|
368 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
369 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
370 // adjust the (un)dock icon |
29754
4c569e386e9b
improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents:
29709
diff
changeset
|
371 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
|
372 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
|
373 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
|
374 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
|
375 { |
31621
0645ea65ca6b
handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents:
31619
diff
changeset
|
376 m_dock_action->setIcon (settings.icon ("widget-undock" + m_icon_color, true)); |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
377 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
|
378 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
379 else |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
380 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
381 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
|
382 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
|
383 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
|
384 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
385 |
25384
9b67c2294129
fix missing title bar highlighting when (un)docking a widget
Torsten <mttl@mailbox.org>
parents:
25373
diff
changeset
|
386 raise (); |
9b67c2294129
fix missing title bar highlighting when (un)docking a widget
Torsten <mttl@mailbox.org>
parents:
25373
diff
changeset
|
387 QApplication::setActiveWindow (this); |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
388 |
25356
1008b4797a6e
fix visibility of dock widgets at startup
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
389 if (vis) |
1008b4797a6e
fix visibility of dock widgets at startup
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
390 { |
1008b4797a6e
fix visibility of dock widgets at startup
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
391 show (); |
27281
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
392 setFocus (); |
25384
9b67c2294129
fix missing title bar highlighting when (un)docking a widget
Torsten <mttl@mailbox.org>
parents:
25373
diff
changeset
|
393 set_style (true); |
25356
1008b4797a6e
fix visibility of dock widgets at startup
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
394 } |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
395 } |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
396 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
397 // 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
|
398 void |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
399 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
|
400 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
401 setFloating (false); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
402 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
403 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
404 // 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
|
405 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
406 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
|
407 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
408 m_predecessor_widget = prev_widget; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
409 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
410 |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
411 void |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
412 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
|
413 { |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
414 m_main_window = mw; |
27665
a1271c5b621a
replace preference literals by symbolic constants for dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
415 |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
416 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
|
417 { |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
418 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
|
419 this, &octave_dock_widget::copyClipboard); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
420 |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
421 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
|
422 this, &octave_dock_widget::pasteClipboard); |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
423 |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
424 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
|
425 this, &octave_dock_widget::selectAll); |
24842
74229798f604
always select suitable icon color for sock widgets depending on title bar color
Torsten <mttl@mailbox.org>
parents:
24836
diff
changeset
|
426 |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
427 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
|
428 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
|
429 } |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
430 } |
24842
74229798f604
always select suitable icon color for sock widgets depending on title bar color
Torsten <mttl@mailbox.org>
parents:
24836
diff
changeset
|
431 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
432 // close event |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
433 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
434 octave_dock_widget::closeEvent (QCloseEvent *e) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
435 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
436 emit active_changed (false); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
437 set_focus_predecessor (); |
28018
20a9b99d515c
fix restoring floating console widget (bug #56989)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28005
diff
changeset
|
438 save_settings (); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
439 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
440 QDockWidget::closeEvent (e); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
441 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
442 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
443 // get focus widget |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
444 QWidget * |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
445 octave_dock_widget::focusWidget (void) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
446 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
447 QWidget *w = QApplication::focusWidget (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
448 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
|
449 return w; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
450 } |
29694
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
451 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
452 bool |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
453 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
|
454 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
455 // 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
|
456 // 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
|
457 if ( (event->type () == QEvent::MouseButtonDblClick && ! isFloating ()) |
27935
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
458 || (event->type () == QEvent::ActivationChange |
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
459 && 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
|
460 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
461 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
|
462 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
|
463 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
464 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
|
465 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
|
466 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
467 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
|
468 } |
26299
c95884eed1cf
make restoring gui more robust to changes of desktop size (bug #53207)
Torsten <mttl@mailbox.org>
parents:
25907
diff
changeset
|
469 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
470 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
|
471 } |
26428
93c4fabb2ead
only reset floating geometry of dock widget when not visible (bug #53207)
Torsten <mttl@mailbox.org>
parents:
26376
diff
changeset
|
472 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
473 void |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
474 octave_dock_widget::handle_settings (void) |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
475 { |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
476 gui_settings settings; |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
477 |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
478 m_focus_follows_mouse = settings.value (dw_focus_follows_mouse).toBool (); |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
479 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
480 m_custom_style |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
481 = settings.value (dw_title_custom_style).toBool (); |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
482 |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
483 m_title_3d = settings.value (dw_title_3d.key, dw_title_3d.def).toInt (); |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
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 |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
486 = settings.value (dw_title_fg_color).value<QColor> (); |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
487 |
27665
a1271c5b621a
replace preference literals by symbolic constants for dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
488 m_fg_color_active |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
489 = settings.value (dw_title_fg_color_active).value<QColor> (); |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
490 |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
491 m_bg_color = settings.value (dw_title_bg_color).value<QColor> (); |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
492 |
27665
a1271c5b621a
replace preference literals by symbolic constants for dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
493 m_bg_color_active |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
494 = settings.value (dw_title_bg_color_active).value<QColor> (); |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
495 |
24842
74229798f604
always select suitable icon color for sock widgets depending on title bar color
Torsten <mttl@mailbox.org>
parents:
24836
diff
changeset
|
496 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
|
497 QColor bcola (m_bg_color_active); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
498 |
24842
74229798f604
always select suitable icon color for sock widgets depending on title bar color
Torsten <mttl@mailbox.org>
parents:
24836
diff
changeset
|
499 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
|
500 { |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
501 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
|
502 bcola = bcol; |
74229798f604
always select suitable icon color for sock widgets depending on title bar color
Torsten <mttl@mailbox.org>
parents:
24836
diff
changeset
|
503 } |
27467
c7a898396151
compacter tool bar and filter bars in dock widgets (bug #53902)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27412
diff
changeset
|
504 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
505 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
|
506 bcol.getRgb (&r, &g, &b); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
507 if (r+g+b < 400) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
508 m_icon_color = "-light"; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
509 else |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
510 m_icon_color = ""; |
27478
9e526393d80a
reduced vertical space in gui with responsive toolbar buttons (bug #53902)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27468
diff
changeset
|
511 |
24842
74229798f604
always select suitable icon color for sock widgets depending on title bar color
Torsten <mttl@mailbox.org>
parents:
24836
diff
changeset
|
512 bcola.getRgb (&r, &g, &b); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
513 if (r+g+b < 400) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
514 m_icon_color_active = "-light"; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
515 else |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
516 m_icon_color_active = ""; |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
517 |
29694
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
518 int x, y, w, h; |
30690
e2c8c852399e
replace use of depreciated QDesktopWidget in GUI
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30626
diff
changeset
|
519 QGuiApplication::primaryScreen ()->availableGeometry ().getRect (&x, &y, &w, &h); |
29694
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
520 QRect default_floating_size = QRect (x+16, y+32, w/3, h/2); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
521 |
29694
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
522 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
|
523 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
|
524 { |
29694
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
525 // 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
|
526 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
|
527 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
|
528 } |
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
529 else |
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 // 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
|
532 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
|
533 } |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
534 |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30275
diff
changeset
|
535 m_recent_float_geom |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
536 = settings.value (dw_float_geometry.key.arg (objectName ()), |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30275
diff
changeset
|
537 default_floating_size).toRect (); |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
538 |
30690
e2c8c852399e
replace use of depreciated QDesktopWidget in GUI
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30626
diff
changeset
|
539 adjust_to_screen (m_recent_float_geom, default_floating_size); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
540 |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30275
diff
changeset
|
541 // The following is required for ensure smooth transition from old |
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30275
diff
changeset
|
542 // saveGeomety to new QRect setting (see comment for restoring size |
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30275
diff
changeset
|
543 // of docked widgets) |
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30275
diff
changeset
|
544 QVariant dock_geom |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
545 = settings.value (dw_dock_geometry.key.arg (objectName ()), |
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
546 default_dock_size); |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30275
diff
changeset
|
547 if (dock_geom.canConvert (QMetaType::QRect)) |
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30275
diff
changeset
|
548 m_recent_dock_geom = dock_geom.toRect (); |
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30275
diff
changeset
|
549 else |
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30275
diff
changeset
|
550 m_recent_dock_geom = dw_dock_geometry.def.toRect (); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
551 |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
552 notice_settings (); // call individual handler |
25355
5bb07f6e3707
fix uninitialized settings of octave dock widgets at startup (bug #53835)
Torsten <mttl@mailbox.org>
parents:
25354
diff
changeset
|
553 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
554 set_style (false); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
555 |
27467
c7a898396151
compacter tool bar and filter bars in dock widgets (bug #53902)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27412
diff
changeset
|
556 // Compacter design |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30275
diff
changeset
|
557 QToolBar *toolbar = findChild <QToolBar *> (); |
27467
c7a898396151
compacter tool bar and filter bars in dock widgets (bug #53902)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27412
diff
changeset
|
558 if (toolbar) |
27560
3fcc650de22f
split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
27478
diff
changeset
|
559 toolbar->setStyleSheet (toolbar->styleSheet () + global_toolbar_style); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
560 |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30275
diff
changeset
|
561 QMenuBar *menubar = findChild <QMenuBar *> (); |
27468
8ba19629d5ef
compacter menu bars in dock widgets (bug #53902)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27467
diff
changeset
|
562 if (menubar) |
27560
3fcc650de22f
split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
27478
diff
changeset
|
563 menubar->setStyleSheet (menubar->styleSheet () + global_menubar_style); |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
564 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
565 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
566 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
567 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
568 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
|
569 octave_dock_widget *w_new) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
570 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
571 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
|
572 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
573 set_style (false); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
574 update (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
575 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
576 |
24828
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_new) |
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 (true); |
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 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
582 } |
29202
66af654b3485
provide focus follows mouse for widgets in the main window (bug #59701)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29199
diff
changeset
|
583 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
584 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
585 octave_dock_widget::save_settings (void) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
586 { |
31621
0645ea65ca6b
handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents:
31619
diff
changeset
|
587 gui_settings settings; |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
588 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
589 // save state of this dock-widget |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
590 QString name = objectName (); |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
591 |
25355
5bb07f6e3707
fix uninitialized settings of octave dock widgets at startup (bug #53835)
Torsten <mttl@mailbox.org>
parents:
25354
diff
changeset
|
592 store_geometry (); |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
593 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
594 // 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
|
595 if (! m_recent_float_geom.isNull ()) |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
596 settings.setValue (dw_float_geometry.key.arg (name), m_recent_float_geom); |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
597 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
598 if (! m_recent_dock_geom.isEmpty ()) |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
599 settings.setValue (dw_dock_geometry.key.arg (name), m_recent_dock_geom); |
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
600 settings.setValue (dw_is_visible.key.arg (name), isVisible ()); // store visibility |
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
601 settings.setValue (dw_is_floating.key.arg (name), isFloating ()); // store floating |
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
602 settings.setValue (dw_is_minimized.key.arg (name), isMinimized ()); // store minimized |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
603 |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
604 settings.sync (); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
605 } |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
606 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
607 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
|
608 { |
29202
66af654b3485
provide focus follows mouse for widgets in the main window (bug #59701)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29199
diff
changeset
|
609 // 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
|
610 if (e->type () == QEvent::NonClientAreaMouseButtonDblClick) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
611 { |
29202
66af654b3485
provide focus follows mouse for widgets in the main window (bug #59701)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29199
diff
changeset
|
612 e->ignore (); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
613 return true; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
614 } |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
615 |
29202
66af654b3485
provide focus follows mouse for widgets in the main window (bug #59701)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29199
diff
changeset
|
616 // 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
|
617 // 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
|
618 // 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
|
619 if (m_focus_follows_mouse && ! isFloating () && (e->type () == QEvent::Enter)) |
30626
171414e74e9b
focus follows mouse event should not raise the window (bug #61770)
Lars Kindermann <lars.kindermann@reglos.de>
parents:
30564
diff
changeset
|
620 setFocus (); |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
621 |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30275
diff
changeset
|
622 return QDockWidget::eventFilter (obj, e); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
623 } |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
624 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
625 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
|
626 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
|
627 { |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
628 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
|
629 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
630 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
|
631 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
|
632 } |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
633 else |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
634 { |
29088
909d68d27892
fix restoring dock widgets geometry in full screen main window
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28018
diff
changeset
|
635 m_recent_dock_geom = geometry (); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
636 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
637 } |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
638 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
639 void |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
640 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
|
641 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
642 store_geometry (); |
27281
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
643 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
644 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
|
645 } |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
646 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
647 void |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
648 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
|
649 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
650 store_geometry (); |
27281
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
651 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
652 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
|
653 } |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
654 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
655 // slot for hiding the widget |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
656 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
657 octave_dock_widget::change_visibility (bool) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
658 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
659 setVisible (false); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
660 emit active_changed (false); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
661 } |
27281
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
662 |
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
663 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
|
664 { |
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
665 if (! isVisible ()) |
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
666 setVisible (true); |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
667 |
27281
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
668 setFocus (); |
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
669 activateWindow (); |
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
670 raise (); |
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
671 } |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
672 |
27281
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
673 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
|
674 { |
29199
0b18887bc997
simplify initialization of gui dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29147
diff
changeset
|
675 if (visible) |
0b18887bc997
simplify initialization of gui dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29147
diff
changeset
|
676 { |
0b18887bc997
simplify initialization of gui dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29147
diff
changeset
|
677 emit active_changed (true); |
0b18887bc997
simplify initialization of gui dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29147
diff
changeset
|
678 if (! isFloating ()) |
0b18887bc997
simplify initialization of gui dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29147
diff
changeset
|
679 setFocus (); |
0b18887bc997
simplify initialization of gui dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29147
diff
changeset
|
680 } |
27281
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
681 } |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
682 |
27935
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
683 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
|
684 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
|
685 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
686 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
|
687 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
|
688 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
689 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
|
690 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
691 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
|
692 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
|
693 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
694 else |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
695 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
696 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
|
697 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
|
698 } |
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 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
|
701 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
702 // 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
|
703 // 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
|
704 // 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
|
705 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
|
706 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
707 // 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
|
708 // 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
|
709 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
|
710 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
|
711 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
712 else |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
713 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
714 // 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
|
715 m_waiting_for_mouse_button_release = false; |
18218
7952fb0435db
improve title bar of dock widgets
Torsten <ttl@justmail.de>
parents:
18180
diff
changeset
|
716 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
717 // 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
|
718 // 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
|
719 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
|
720 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
|
721 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
722 } |
19431
bd27cd403d00
fix errors when building octave for windows (regression from d93293218966)
Torsten <ttl@justmail.de>
parents:
19423
diff
changeset
|
723 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
724 void |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
725 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
|
726 { |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
727 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
|
728 QString css_background; |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
729 QString css_button; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
730 QString dock_icon; |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
731 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
732 QString icon_col = m_icon_color; |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
733 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
734 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
|
735 QString dock_tooltip; |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
736 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
737 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
|
738 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
739 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
|
740 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
|
741 } |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
742 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
|
743 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
744 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
|
745 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
|
746 } |
18180
b3838cedfe04
redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents:
17929
diff
changeset
|
747 |
20794
e870a68742a6
change alignment of dock widget titles for OSX (bug #46592)
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
748 #if defined (Q_OS_MAC) |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
749 QString alignment = "center"; |
20794
e870a68742a6
change alignment of dock widget titles for OSX (bug #46592)
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
750 #else |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
751 QString alignment = "center left"; |
20794
e870a68742a6
change alignment of dock widget titles for OSX (bug #46592)
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
752 #endif |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
753 if (m_custom_style) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
754 { |
18180
b3838cedfe04
redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents:
17929
diff
changeset
|
755 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
756 QColor bg_col, fg_col; |
18218
7952fb0435db
improve title bar of dock widgets
Torsten <ttl@justmail.de>
parents:
18180
diff
changeset
|
757 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
758 if (active) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
759 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
760 bg_col = m_bg_color_active; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
761 fg_col = m_fg_color_active; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
762 icon_col = m_icon_color_active; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
763 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
764 else |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
765 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
766 bg_col = m_bg_color; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
767 fg_col = m_fg_color; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
768 icon_col = m_icon_color; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
769 } |
19913
2a992bd19169
make color gradient of custom title bar adjustable (bug #44435)
Torsten <ttl@justmail.de>
parents:
19911
diff
changeset
|
770 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
771 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
|
772 if (m_title_3d > 0) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
773 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
774 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
|
775 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
|
776 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
777 else |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
778 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
779 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
|
780 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
|
781 } |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
782 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
783 css_foreground = QString (" color: %1;\n").arg (fg_col.name ()); |
18180
b3838cedfe04
redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents:
17929
diff
changeset
|
784 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
785 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
|
786 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
|
787 " 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
|
788 arg (bg_col_top.name ()). |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
789 arg (bg_col.name ()). |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
790 arg (bg_col_bottom.name ()); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
791 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
792 else |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
793 { |
25354
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_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
|
795 css_background = QString (""); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
796 } |
18180
b3838cedfe04
redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents:
17929
diff
changeset
|
797 |
30772
36dc11ee220d
reorganize GUIs icons
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30690
diff
changeset
|
798 QString full_dock_icon = dock_icon + icon_col; |
36dc11ee220d
reorganize GUIs icons
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30690
diff
changeset
|
799 QString full_close_icon = "widget-close" + icon_col; |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
800 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
|
801 { |
31621
0645ea65ca6b
handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents:
31619
diff
changeset
|
802 gui_settings settings; |
19423
d93293218966
custom style of dock widget title bars depending on focus (bug #43837)
Torsten <ttl@justmail.de>
parents:
19360
diff
changeset
|
803 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
804 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
|
805 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
|
806 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
|
807 m_close_button->setStyleSheet (css_button); |
31621
0645ea65ca6b
handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents:
31619
diff
changeset
|
808 m_dock_action->setIcon (settings.icon (full_dock_icon, true)); |
0645ea65ca6b
handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents:
31619
diff
changeset
|
809 m_close_action->setIcon (settings.icon (full_close_icon, true)); |
25354
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 else |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
812 { |
30788
c11d34f72b3c
provide different icon sets for the GUI
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30777
diff
changeset
|
813 setStyleSheet (qdockwidget_css (global_icon_paths.at (ICON_THEME_OCTAVE) + full_close_icon + ".png", |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
814 close_tooltip, |
30788
c11d34f72b3c
provide different icon sets for the GUI
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30777
diff
changeset
|
815 global_icon_paths.at (ICON_THEME_OCTAVE) + full_dock_icon + ".png", |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
816 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
|
817 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
|
818 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
|
819 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
|
820 } |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
821 } |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
822 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
823 // 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
|
824 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
825 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
|
826 { |
25396
75fef3484d12
Prevent hidden predecessor windows appearing when successor is floated (bug #53357)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25384
diff
changeset
|
827 // 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
|
828 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
|
829 m_predecessor_widget->setFocus (); |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
830 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
831 m_predecessor_widget = nullptr; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
832 } |
31646
c6d54dd31a7e
maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
833 |
c6d54dd31a7e
maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
834 OCTAVE_END_NAMESPACE(octave) |