Mercurial > octave
annotate libgui/src/octave-dock-widget.cc @ 31692:2422fb7f1e6c
move shortcut setting functions to gui_settings from shortcut_manager
* gui-settings.h, gui-settings.cc (gui_settings::set_shortcut,
gui_settings::shortcut): Move here from shortcut-manager.h and
shortcut-manager.cc.
* documentation-bookmarks.cc, documentation.cc, dw-main-window.cc,
file-editor.cc, octave-qscintilla.cc, main-window.cc,
octave-dock-widget.cc, variable-editor.cc: Change all uses of
set_shortcut and shortcut. Only include shortcut-manager.h where
necessary.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sun, 25 Dec 2022 12:46:53 -0500 |
parents | deb553ac2c54 |
children | 88119be1f926 |
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 |
31692
2422fb7f1e6c
move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents:
31649
diff
changeset
|
222 gui_settings settings; |
2422fb7f1e6c
move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents:
31649
diff
changeset
|
223 |
2422fb7f1e6c
move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents:
31649
diff
changeset
|
224 settings.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
|
225 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
|
226 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
|
227 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
|
228 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
|
229 |
31692
2422fb7f1e6c
move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents:
31649
diff
changeset
|
230 settings.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
|
231 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
|
232 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
|
233 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
|
234 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
|
235 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
236 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
|
237 |
30777
439eb9bd4c04
icon fallback concept without QIcon::fallbackSearchPaths (bug #62106)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30772
diff
changeset
|
238 setStyleSheet (qdockwidget_css ( |
30788
c11d34f72b3c
provide different icon sets for the GUI
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30777
diff
changeset
|
239 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
|
240 QString ("Close widget"), |
30788
c11d34f72b3c
provide different icon sets for the GUI
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30777
diff
changeset
|
241 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
|
242 QString ("Undock widget"), |
439eb9bd4c04
icon fallback concept without QIcon::fallbackSearchPaths (bug #62106)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30772
diff
changeset
|
243 m_icon_size, |
439eb9bd4c04
icon fallback concept without QIcon::fallbackSearchPaths (bug #62106)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30772
diff
changeset
|
244 QString (""), |
439eb9bd4c04
icon fallback concept without QIcon::fallbackSearchPaths (bug #62106)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30772
diff
changeset
|
245 QString (""))); |
25356
1008b4797a6e
fix visibility of dock widgets at startup
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
246 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
247 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
|
248 widget ()->setToolTip (QString ("")); |
29754
4c569e386e9b
improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents:
29709
diff
changeset
|
249 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
250 m_icon_color = ""; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
251 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
|
252 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
253 installEventFilter (this); |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
254 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
255 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
|
256 |
30275
cf434923aec0
gui: Avoid deprecated enum QDockWidget::AllDockWidgetFeatures.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29895
diff
changeset
|
257 setFeatures (QDockWidget::DockWidgetClosable |
cf434923aec0
gui: Avoid deprecated enum QDockWidget::AllDockWidgetFeatures.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29895
diff
changeset
|
258 | QDockWidget::DockWidgetMovable |
cf434923aec0
gui: Avoid deprecated enum QDockWidget::AllDockWidgetFeatures.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29895
diff
changeset
|
259 | QDockWidget::DockWidgetFloatable); |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
260 |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
261 handle_settings (); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
262 } |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
263 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
264 void |
29199
0b18887bc997
simplify initialization of gui dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29147
diff
changeset
|
265 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
|
266 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
267 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
|
268 } |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
269 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
270 // make the widget floating |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
271 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
|
272 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
|
273 { |
25356
1008b4797a6e
fix visibility of dock widgets at startup
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
274 bool vis = isVisible (); |
1008b4797a6e
fix visibility of dock widgets at startup
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
275 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
276 // 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
|
277 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
|
278 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
279 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
|
280 |
26818
f7b10bd40045
fix dock widget position when being dragged out of the main window (bug #55704)
Torsten <mttl@mailbox.org>
parents:
26452
diff
changeset
|
281 // 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
|
282 QRect geom = geometry (); |
17686
65544374c1cf
restore (un)docking of widgets without reparenting on non-windows systems
Torsten <ttl@justmail.de>
parents:
17090
diff
changeset
|
283 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
284 // 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
|
285 // 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
|
286 // 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
|
287 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
|
288 setFloating (false); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
289 |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
290 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
|
291 { |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
292 // 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
|
293 // 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
|
294 // 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
|
295 // later |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
296 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
|
297 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
298 |
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
|
299 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
|
300 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
|
301 |
26818
f7b10bd40045
fix dock widget position when being dragged out of the main window (bug #55704)
Torsten <mttl@mailbox.org>
parents:
26452
diff
changeset
|
302 // 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
|
303 // 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
|
304 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
|
305 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
|
306 : 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
|
307 setGeometry (geom); |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
308 |
27937
8dc5b36f1245
include new undock/dock actions into the shortcut manager
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27936
diff
changeset
|
309 // adjust the (un)dock 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
|
310 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
|
311 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
|
312 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
|
313 |
8dc5b36f1245
include new undock/dock actions into the shortcut manager
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27936
diff
changeset
|
314 // 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
|
315 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
|
316 { |
31621
0645ea65ca6b
handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents:
31619
diff
changeset
|
317 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
|
318 |
31621
0645ea65ca6b
handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents:
31619
diff
changeset
|
319 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
|
320 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
|
321 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
322 else |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
323 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
324 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
|
325 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
|
326 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
|
327 } |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
328 |
25384
9b67c2294129
fix missing title bar highlighting when (un)docking a widget
Torsten <mttl@mailbox.org>
parents:
25373
diff
changeset
|
329 raise (); |
9b67c2294129
fix missing title bar highlighting when (un)docking a widget
Torsten <mttl@mailbox.org>
parents:
25373
diff
changeset
|
330 activateWindow (); |
28018
20a9b99d515c
fix restoring floating console widget (bug #56989)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28005
diff
changeset
|
331 |
25356
1008b4797a6e
fix visibility of dock widgets at startup
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
332 if (vis) |
27935
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
333 { |
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
334 show (); |
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
335 setFocus (); |
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
336 set_style (true); |
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
337 } |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
338 |
27089
9326c2258e60
fix visibility of find dialog when editor is docked/undocked (bug #5)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26818
diff
changeset
|
339 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
|
340 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
341 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
342 // dock the widget |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
343 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
|
344 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
|
345 { |
31621
0645ea65ca6b
handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents:
31619
diff
changeset
|
346 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
|
347 |
25356
1008b4797a6e
fix visibility of dock widgets at startup
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
348 bool vis = isVisible (); |
1008b4797a6e
fix visibility of dock widgets at startup
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
349 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
350 // 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
|
351 |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
352 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
|
353 { |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
354 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
|
355 |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
356 // 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
|
357 // 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
|
358 // saved settings. |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
359 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
|
360 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
|
361 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
|
362 // 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
|
363 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
|
364 setFloating (false); |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
365 // 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
|
366 // following this post: |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
367 // 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
|
368 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
|
369 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
370 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
371 // adjust the (un)dock icon |
29754
4c569e386e9b
improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents:
29709
diff
changeset
|
372 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
|
373 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
|
374 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
|
375 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
|
376 { |
31621
0645ea65ca6b
handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents:
31619
diff
changeset
|
377 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
|
378 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
|
379 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
380 else |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
381 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
382 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
|
383 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
|
384 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
|
385 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
386 |
25384
9b67c2294129
fix missing title bar highlighting when (un)docking a widget
Torsten <mttl@mailbox.org>
parents:
25373
diff
changeset
|
387 raise (); |
9b67c2294129
fix missing title bar highlighting when (un)docking a widget
Torsten <mttl@mailbox.org>
parents:
25373
diff
changeset
|
388 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
|
389 |
25356
1008b4797a6e
fix visibility of dock widgets at startup
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
390 if (vis) |
1008b4797a6e
fix visibility of dock widgets at startup
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
391 { |
1008b4797a6e
fix visibility of dock widgets at startup
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
392 show (); |
27281
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
393 setFocus (); |
25384
9b67c2294129
fix missing title bar highlighting when (un)docking a widget
Torsten <mttl@mailbox.org>
parents:
25373
diff
changeset
|
394 set_style (true); |
25356
1008b4797a6e
fix visibility of dock widgets at startup
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
395 } |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
396 } |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
397 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
398 // 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
|
399 void |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
400 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
|
401 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
402 setFloating (false); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
403 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
404 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
405 // 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
|
406 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
407 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
|
408 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
409 m_predecessor_widget = prev_widget; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
410 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
411 |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
412 void |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
413 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
|
414 { |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
415 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
|
416 |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
417 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
|
418 { |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
419 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
|
420 this, &octave_dock_widget::copyClipboard); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
421 |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
422 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
|
423 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
|
424 |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
425 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
|
426 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
|
427 |
29613
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
428 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
|
429 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
|
430 } |
9367cba2a6d5
allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents:
29612
diff
changeset
|
431 } |
24842
74229798f604
always select suitable icon color for sock widgets depending on title bar color
Torsten <mttl@mailbox.org>
parents:
24836
diff
changeset
|
432 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
433 // close event |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
434 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
435 octave_dock_widget::closeEvent (QCloseEvent *e) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
436 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
437 emit active_changed (false); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
438 set_focus_predecessor (); |
28018
20a9b99d515c
fix restoring floating console widget (bug #56989)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28005
diff
changeset
|
439 save_settings (); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
440 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
441 QDockWidget::closeEvent (e); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
442 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
443 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
444 // get focus widget |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
445 QWidget * |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
446 octave_dock_widget::focusWidget (void) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
447 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
448 QWidget *w = QApplication::focusWidget (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
449 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
|
450 return w; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
451 } |
29694
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
452 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
453 bool |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
454 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
|
455 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
456 // 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
|
457 // 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
|
458 if ( (event->type () == QEvent::MouseButtonDblClick && ! isFloating ()) |
27935
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
459 || (event->type () == QEvent::ActivationChange |
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
460 && 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
|
461 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
462 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
|
463 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
|
464 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
465 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
|
466 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
|
467 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
468 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
|
469 } |
26299
c95884eed1cf
make restoring gui more robust to changes of desktop size (bug #53207)
Torsten <mttl@mailbox.org>
parents:
25907
diff
changeset
|
470 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
471 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
|
472 } |
26428
93c4fabb2ead
only reset floating geometry of dock widget when not visible (bug #53207)
Torsten <mttl@mailbox.org>
parents:
26376
diff
changeset
|
473 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
474 void |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
475 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
|
476 { |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
477 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
|
478 |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
479 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
|
480 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
481 m_custom_style |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
482 = 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
|
483 |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
484 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
|
485 |
27665
a1271c5b621a
replace preference literals by symbolic constants for dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
486 m_fg_color |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
487 = 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
|
488 |
27665
a1271c5b621a
replace preference literals by symbolic constants for dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
489 m_fg_color_active |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
490 = 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
|
491 |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
492 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
|
493 |
27665
a1271c5b621a
replace preference literals by symbolic constants for dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
494 m_bg_color_active |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
495 = 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
|
496 |
24842
74229798f604
always select suitable icon color for sock widgets depending on title bar color
Torsten <mttl@mailbox.org>
parents:
24836
diff
changeset
|
497 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
|
498 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
|
499 |
24842
74229798f604
always select suitable icon color for sock widgets depending on title bar color
Torsten <mttl@mailbox.org>
parents:
24836
diff
changeset
|
500 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
|
501 { |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
502 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
|
503 bcola = bcol; |
74229798f604
always select suitable icon color for sock widgets depending on title bar color
Torsten <mttl@mailbox.org>
parents:
24836
diff
changeset
|
504 } |
27467
c7a898396151
compacter tool bar and filter bars in dock widgets (bug #53902)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27412
diff
changeset
|
505 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
506 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
|
507 bcol.getRgb (&r, &g, &b); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
508 if (r+g+b < 400) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
509 m_icon_color = "-light"; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
510 else |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
511 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
|
512 |
24842
74229798f604
always select suitable icon color for sock widgets depending on title bar color
Torsten <mttl@mailbox.org>
parents:
24836
diff
changeset
|
513 bcola.getRgb (&r, &g, &b); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
514 if (r+g+b < 400) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
515 m_icon_color_active = "-light"; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
516 else |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
517 m_icon_color_active = ""; |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
518 |
29694
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
519 int x, y, w, h; |
30690
e2c8c852399e
replace use of depreciated QDesktopWidget in GUI
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30626
diff
changeset
|
520 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
|
521 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
|
522 |
29694
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
523 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
|
524 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
|
525 { |
29694
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
526 // 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
|
527 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
|
528 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
|
529 } |
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
530 else |
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
531 { |
54c0eb5548ee
restore previous widget geometry when invoked from cli (bug #60630)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29613
diff
changeset
|
532 // 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
|
533 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
|
534 } |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
535 |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30275
diff
changeset
|
536 m_recent_float_geom |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
537 = 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
|
538 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
|
539 |
30690
e2c8c852399e
replace use of depreciated QDesktopWidget in GUI
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30626
diff
changeset
|
540 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
|
541 |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30275
diff
changeset
|
542 // 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
|
543 // 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
|
544 // 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
|
545 QVariant dock_geom |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
546 = 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
|
547 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
|
548 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
|
549 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
|
550 else |
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30275
diff
changeset
|
551 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
|
552 |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
553 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
|
554 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
555 set_style (false); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
556 |
27467
c7a898396151
compacter tool bar and filter bars in dock widgets (bug #53902)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27412
diff
changeset
|
557 // 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
|
558 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
|
559 if (toolbar) |
27560
3fcc650de22f
split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
27478
diff
changeset
|
560 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
|
561 |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30275
diff
changeset
|
562 QMenuBar *menubar = findChild <QMenuBar *> (); |
27468
8ba19629d5ef
compacter menu bars in dock widgets (bug #53902)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27467
diff
changeset
|
563 if (menubar) |
27560
3fcc650de22f
split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
27478
diff
changeset
|
564 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
|
565 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
566 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
567 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
568 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
569 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
|
570 octave_dock_widget *w_new) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
571 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
572 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
|
573 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
574 set_style (false); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
575 update (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
576 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
577 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
578 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
|
579 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
580 set_style (true); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
581 update (); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
582 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
583 } |
29202
66af654b3485
provide focus follows mouse for widgets in the main window (bug #59701)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29199
diff
changeset
|
584 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
585 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
586 octave_dock_widget::save_settings (void) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
587 { |
31621
0645ea65ca6b
handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents:
31619
diff
changeset
|
588 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
|
589 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
590 // save state of this dock-widget |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
591 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
|
592 |
25355
5bb07f6e3707
fix uninitialized settings of octave dock widgets at startup (bug #53835)
Torsten <mttl@mailbox.org>
parents:
25354
diff
changeset
|
593 store_geometry (); |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
594 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
595 // 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
|
596 if (! m_recent_float_geom.isNull ()) |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
597 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
|
598 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
599 if (! m_recent_dock_geom.isEmpty ()) |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
600 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
|
601 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
|
602 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
|
603 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
|
604 |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
605 settings.sync (); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
606 } |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
607 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
608 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
|
609 { |
29202
66af654b3485
provide focus follows mouse for widgets in the main window (bug #59701)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29199
diff
changeset
|
610 // 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
|
611 if (e->type () == QEvent::NonClientAreaMouseButtonDblClick) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
612 { |
29202
66af654b3485
provide focus follows mouse for widgets in the main window (bug #59701)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29199
diff
changeset
|
613 e->ignore (); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
614 return true; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
615 } |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
616 |
29202
66af654b3485
provide focus follows mouse for widgets in the main window (bug #59701)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29199
diff
changeset
|
617 // 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
|
618 // 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
|
619 // 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
|
620 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
|
621 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
|
622 |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30275
diff
changeset
|
623 return QDockWidget::eventFilter (obj, e); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
624 } |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
625 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
626 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
|
627 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
|
628 { |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
629 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
|
630 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
631 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
|
632 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
|
633 } |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
634 else |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
635 { |
29088
909d68d27892
fix restoring dock widgets geometry in full screen main window
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28018
diff
changeset
|
636 m_recent_dock_geom = geometry (); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
637 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
638 } |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
639 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
640 void |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
641 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
|
642 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
643 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
|
644 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
645 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
|
646 } |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
647 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
648 void |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
649 octave_dock_widget::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
|
650 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
651 store_geometry (); |
27281
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
652 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
653 QDockWidget::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
|
654 } |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
655 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
656 // slot for hiding the widget |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
657 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
658 octave_dock_widget::change_visibility (bool) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
659 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
660 setVisible (false); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
661 emit active_changed (false); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
662 } |
27281
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
663 |
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
664 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
|
665 { |
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
666 if (! isVisible ()) |
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
667 setVisible (true); |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
668 |
27281
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
669 setFocus (); |
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
670 activateWindow (); |
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
671 raise (); |
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
672 } |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
673 |
27281
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
674 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
|
675 { |
29199
0b18887bc997
simplify initialization of gui dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29147
diff
changeset
|
676 if (visible) |
0b18887bc997
simplify initialization of gui dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29147
diff
changeset
|
677 { |
0b18887bc997
simplify initialization of gui dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29147
diff
changeset
|
678 emit active_changed (true); |
0b18887bc997
simplify initialization of gui dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29147
diff
changeset
|
679 if (! isFloating ()) |
0b18887bc997
simplify initialization of gui dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29147
diff
changeset
|
680 setFocus (); |
0b18887bc997
simplify initialization of gui dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29147
diff
changeset
|
681 } |
27281
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27255
diff
changeset
|
682 } |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
683 |
27935
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
684 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
|
685 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
|
686 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
687 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
|
688 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
|
689 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
690 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
|
691 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
692 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
|
693 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
|
694 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
695 else |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
696 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
697 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
|
698 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
|
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 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
701 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
|
702 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
703 // 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
|
704 // 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
|
705 // 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
|
706 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
|
707 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
708 // 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
|
709 // 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
|
710 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
|
711 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
|
712 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
713 else |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
714 { |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
715 // 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
|
716 m_waiting_for_mouse_button_release = false; |
18218
7952fb0435db
improve title bar of dock widgets
Torsten <ttl@justmail.de>
parents:
18180
diff
changeset
|
717 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
718 // 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
|
719 // 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
|
720 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
|
721 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
|
722 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
723 } |
19431
bd27cd403d00
fix errors when building octave for windows (regression from d93293218966)
Torsten <ttl@justmail.de>
parents:
19423
diff
changeset
|
724 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
725 void |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
726 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
|
727 { |
25354
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_foreground; |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
729 QString css_background; |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
730 QString css_button; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
731 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
|
732 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
733 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
|
734 |
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 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
|
736 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
|
737 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
738 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
|
739 { |
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_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
|
741 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
|
742 } |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
743 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
|
744 { |
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_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
|
746 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
|
747 } |
18180
b3838cedfe04
redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents:
17929
diff
changeset
|
748 |
20794
e870a68742a6
change alignment of dock widget titles for OSX (bug #46592)
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
749 #if defined (Q_OS_MAC) |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
750 QString alignment = "center"; |
20794
e870a68742a6
change alignment of dock widget titles for OSX (bug #46592)
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
751 #else |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
752 QString alignment = "center left"; |
20794
e870a68742a6
change alignment of dock widget titles for OSX (bug #46592)
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
753 #endif |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
754 if (m_custom_style) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
755 { |
18180
b3838cedfe04
redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents:
17929
diff
changeset
|
756 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
757 QColor bg_col, fg_col; |
18218
7952fb0435db
improve title bar of dock widgets
Torsten <ttl@justmail.de>
parents:
18180
diff
changeset
|
758 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
759 if (active) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
760 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
761 bg_col = m_bg_color_active; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
762 fg_col = m_fg_color_active; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
763 icon_col = m_icon_color_active; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
764 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
765 else |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
766 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
767 bg_col = m_bg_color; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
768 fg_col = m_fg_color; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
769 icon_col = m_icon_color; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
770 } |
19913
2a992bd19169
make color gradient of custom title bar adjustable (bug #44435)
Torsten <ttl@justmail.de>
parents:
19911
diff
changeset
|
771 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
772 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
|
773 if (m_title_3d > 0) |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
774 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
775 bg_col_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
|
776 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
|
777 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
778 else |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
779 { |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
780 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
|
781 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
|
782 } |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
783 |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
784 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
|
785 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
786 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
|
787 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
|
788 " 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
|
789 arg (bg_col_top.name ()). |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
790 arg (bg_col.name ()). |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
791 arg (bg_col_bottom.name ()); |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
792 } |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
793 else |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
794 { |
25354
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_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
|
796 css_background = QString (""); |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
797 } |
18180
b3838cedfe04
redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents:
17929
diff
changeset
|
798 |
30772
36dc11ee220d
reorganize GUIs icons
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30690
diff
changeset
|
799 QString full_dock_icon = dock_icon + icon_col; |
36dc11ee220d
reorganize GUIs icons
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30690
diff
changeset
|
800 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
|
801 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
|
802 { |
31621
0645ea65ca6b
handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents:
31619
diff
changeset
|
803 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
|
804 |
25354
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
805 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
|
806 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
|
807 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
|
808 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
|
809 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
|
810 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
|
811 } |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
812 else |
05a690606fd5
Use default title bar to preserve GUI float decorations (bug #53276)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25172
diff
changeset
|
813 { |
30788
c11d34f72b3c
provide different icon sets for the GUI
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30777
diff
changeset
|
814 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
|
815 close_tooltip, |
30788
c11d34f72b3c
provide different icon sets for the GUI
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30777
diff
changeset
|
816 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
|
817 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
|
818 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
|
819 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
|
820 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
|
821 } |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
822 } |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
823 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
824 // 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
|
825 void |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
826 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
|
827 { |
25396
75fef3484d12
Prevent hidden predecessor windows appearing when successor is floated (bug #53357)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25384
diff
changeset
|
828 // 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
|
829 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
|
830 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
|
831 |
24828
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
832 m_predecessor_widget = nullptr; |
0f6a261ab144
move some GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24812
diff
changeset
|
833 } |
31646
c6d54dd31a7e
maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
834 |
c6d54dd31a7e
maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents:
30788
diff
changeset
|
835 OCTAVE_END_NAMESPACE(octave) |