Mercurial > octave
annotate libgui/src/octave-dock-widget.cc @ 24696:344832a898ad
Use proper stylesheet syntax to avoid tooltip black background (bug #44554).
* octave-dock-widget.cc (octave_dock_widget::set_style): Place "QToolButton{}"
around the css_button style description so that the style only affects
QToolButton objects and not QToolTip objects.
author | Daniel J Sebald <daniel.sebald@ieee.org> |
---|---|
date | Mon, 05 Feb 2018 14:44:39 -0600 |
parents | c9aab297130e |
children | ed9ba20d6ed3 |
rev | line source |
---|---|
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
1 /* |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
2 |
23219
3ac9f9ecfae5
maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents:
23083
diff
changeset
|
3 Copyright (C) 2012-2017 Richard Crozier |
22323
bac0d6f07a3e
maint: Update copyright notices for 2016.
John W. Eaton <jwe@octave.org>
parents:
22177
diff
changeset
|
4 Copyright (C) 2013-2016 Torsten <ttl@justmail.de> |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
5 |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
6 This file is part of Octave. |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
7 |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24318
diff
changeset
|
8 Octave is free software: you can redistribute it and/or modify it |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22599
diff
changeset
|
9 under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24318
diff
changeset
|
10 the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22599
diff
changeset
|
11 (at your option) any later version. |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
12 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22599
diff
changeset
|
13 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22599
diff
changeset
|
14 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22599
diff
changeset
|
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22599
diff
changeset
|
16 GNU General Public License for more details. |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
17 |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
18 You should have received a copy of the GNU General Public License |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
19 along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24318
diff
changeset
|
20 <https://www.gnu.org/licenses/>. |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
21 |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
22 */ |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
23 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
24 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21203
diff
changeset
|
25 # include "config.h" |
17923
b602014eeb54
* octave-dock-widget.cc: Include config.h.
John W. Eaton <jwe@octave.org>
parents:
17899
diff
changeset
|
26 #endif |
b602014eeb54
* octave-dock-widget.cc: Include config.h.
John W. Eaton <jwe@octave.org>
parents:
17899
diff
changeset
|
27 |
16881
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16865
diff
changeset
|
28 #include <QApplication> |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
29 #include <QToolBar> |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
30 #include <QAction> |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
31 #include <QHBoxLayout> |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
32 #include <QLabel> |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
33 #include <QSettings> |
19918
66928b4546ab
dock-/undock- and close-icons with variable size (bug #41938)
Torsten <ttl@justmail.de>
parents:
19913
diff
changeset
|
34 #include <QStyle> |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
35 |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
36 #include "resource-manager.h" |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
37 #include "octave-dock-widget.h" |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
38 |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
39 |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
40 octave_dock_widget::octave_dock_widget (QWidget *p) |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17686
diff
changeset
|
41 : QDockWidget (p) |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
42 { |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
43 m_parent = static_cast<QMainWindow *> (p); // store main window |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
44 m_floating = false; |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
45 m_predecessor_widget = nullptr; |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
46 |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
47 connect (this, SIGNAL (visibilityChanged (bool)), |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
48 this, SLOT (handle_visibility_changed (bool))); |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
49 |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
50 connect (p, SIGNAL (settings_changed (const QSettings*)), |
18180
b3838cedfe04
redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents:
17929
diff
changeset
|
51 this, SLOT (handle_settings (const QSettings*))); |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
52 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
53 connect (p, SIGNAL (active_dock_changed (octave_dock_widget*, |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
54 octave_dock_widget*)), |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
55 this, SLOT (handle_active_dock_changed (octave_dock_widget*, |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
56 octave_dock_widget*))); |
19423
d93293218966
custom style of dock widget title bars depending on focus (bug #43837)
Torsten <ttl@justmail.de>
parents:
19360
diff
changeset
|
57 |
19918
66928b4546ab
dock-/undock- and close-icons with variable size (bug #41938)
Torsten <ttl@justmail.de>
parents:
19913
diff
changeset
|
58 QStyle *st = style (); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
59 m_icon_size = 0.75*st->pixelMetric (QStyle::PM_SmallIconSize); |
19918
66928b4546ab
dock-/undock- and close-icons with variable size (bug #41938)
Torsten <ttl@justmail.de>
parents:
19913
diff
changeset
|
60 |
24318
a17862b28f0d
handle floating widgets on all platforms as done on windows (bug #52378)
Torsten <mttl@mailbox.org>
parents:
24290
diff
changeset
|
61 // add an extra title bar that persists when floating |
17686
65544374c1cf
restore (un)docking of widgets without reparenting on non-windows systems
Torsten <ttl@justmail.de>
parents:
17090
diff
changeset
|
62 |
65544374c1cf
restore (un)docking of widgets without reparenting on non-windows systems
Torsten <ttl@justmail.de>
parents:
17090
diff
changeset
|
63 setFeatures (QDockWidget::DockWidgetMovable); // not floatable or closeable |
65544374c1cf
restore (un)docking of widgets without reparenting on non-windows systems
Torsten <ttl@justmail.de>
parents:
17090
diff
changeset
|
64 |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
65 // the custom (extra) title bar of the widget |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
66 m_dock_action = new QAction |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
67 (QIcon (":/actions/icons/widget-undock.png"), "", this); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
68 m_dock_action-> setToolTip (tr ("Undock widget")); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
69 connect (m_dock_action, SIGNAL (triggered (bool)), |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
70 this, SLOT (change_floating (bool))); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
71 m_dock_button = new QToolButton (this); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
72 m_dock_button->setDefaultAction (m_dock_action); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
73 m_dock_button->setFocusPolicy (Qt::NoFocus); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
74 m_dock_button->setIconSize (QSize (m_icon_size,m_icon_size)); |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
75 |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
76 m_close_action = new QAction |
18678
6113e0c6920b
maint: Clean up extra spaces before/after parentheses.
Rik <rik@octave.org>
parents:
18555
diff
changeset
|
77 (QIcon (":/actions/icons/widget-close.png"), "", this); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
78 m_close_action-> setToolTip (tr ("Hide widget")); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
79 connect (m_close_action, SIGNAL (triggered (bool)), |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
80 this, SLOT (change_visibility (bool))); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
81 m_close_button = new QToolButton (this); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
82 m_close_button->setDefaultAction (m_close_action); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
83 m_close_button->setFocusPolicy (Qt::NoFocus); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
84 m_close_button->setIconSize (QSize (m_icon_size,m_icon_size)); |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
85 |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
86 m_icon_color = ""; |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
87 m_title_3d = 50; |
18218
7952fb0435db
improve title bar of dock widgets
Torsten <ttl@justmail.de>
parents:
18180
diff
changeset
|
88 |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
89 QHBoxLayout *h_layout = new QHBoxLayout (); |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
90 h_layout->addStretch (100); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
91 h_layout->addWidget (m_dock_button); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
92 h_layout->addWidget (m_close_button); |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
93 h_layout->setSpacing (0); |
18180
b3838cedfe04
redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents:
17929
diff
changeset
|
94 h_layout->setContentsMargins (5,2,2,2); |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
95 |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
96 m_title_widget = new QWidget (); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
97 m_title_widget->setLayout (h_layout); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
98 setTitleBarWidget (m_title_widget); |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
99 |
16881
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16865
diff
changeset
|
100 // copy & paste handling |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17686
diff
changeset
|
101 connect (p, SIGNAL (copyClipboard_signal ()), |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17686
diff
changeset
|
102 this, SLOT (copyClipboard ())); |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17686
diff
changeset
|
103 connect (p, SIGNAL (pasteClipboard_signal ()), |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17686
diff
changeset
|
104 this, SLOT (pasteClipboard ())); |
18555
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
18218
diff
changeset
|
105 connect (p, SIGNAL (selectAll_signal ()), |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
18218
diff
changeset
|
106 this, SLOT (selectAll ())); |
19945
f7a805f02723
link undo in main window to editor if the latter has focus (bug #44402)
Torsten <ttl@justmail.de>
parents:
19918
diff
changeset
|
107 // undo handling |
f7a805f02723
link undo in main window to editor if the latter has focus (bug #44402)
Torsten <ttl@justmail.de>
parents:
19918
diff
changeset
|
108 connect (p, SIGNAL (undo_signal ()), this, SLOT (do_undo ())); |
19360
2f9d9663b6b0
fix double clicks into the borders of floating dock widgets (bug #43662)
Torsten <ttl@justmail.de>
parents:
18555
diff
changeset
|
109 |
2f9d9663b6b0
fix double clicks into the borders of floating dock widgets (bug #43662)
Torsten <ttl@justmail.de>
parents:
18555
diff
changeset
|
110 installEventFilter (this); |
2f9d9663b6b0
fix double clicks into the borders of floating dock widgets (bug #43662)
Torsten <ttl@justmail.de>
parents:
18555
diff
changeset
|
111 |
20630
802dc52d4d46
improve focus detection of gui (bug #45306)
Torsten <ttl@justmail.de>
parents:
20186
diff
changeset
|
112 setFocusPolicy (Qt::StrongFocus); |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
113 } |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
114 |
16809
84505f200e05
fix checked state of window menu entries at startup (bug #39322)
Torsten <ttl@justmail.de>
parents:
16798
diff
changeset
|
115 // connect signal visibility changed to related slot (called from main-window) |
84505f200e05
fix checked state of window menu entries at startup (bug #39322)
Torsten <ttl@justmail.de>
parents:
16798
diff
changeset
|
116 void |
84505f200e05
fix checked state of window menu entries at startup (bug #39322)
Torsten <ttl@justmail.de>
parents:
16798
diff
changeset
|
117 octave_dock_widget::connect_visibility_changed (void) |
84505f200e05
fix checked state of window menu entries at startup (bug #39322)
Torsten <ttl@justmail.de>
parents:
16798
diff
changeset
|
118 { |
84505f200e05
fix checked state of window menu entries at startup (bug #39322)
Torsten <ttl@justmail.de>
parents:
16798
diff
changeset
|
119 connect (this, SIGNAL (visibilityChanged (bool)), |
84505f200e05
fix checked state of window menu entries at startup (bug #39322)
Torsten <ttl@justmail.de>
parents:
16798
diff
changeset
|
120 this, SLOT (handle_visibility (bool))); |
84505f200e05
fix checked state of window menu entries at startup (bug #39322)
Torsten <ttl@justmail.de>
parents:
16798
diff
changeset
|
121 emit active_changed (isVisible ()); // emit once for init of window menu |
84505f200e05
fix checked state of window menu entries at startup (bug #39322)
Torsten <ttl@justmail.de>
parents:
16798
diff
changeset
|
122 } |
84505f200e05
fix checked state of window menu entries at startup (bug #39322)
Torsten <ttl@justmail.de>
parents:
16798
diff
changeset
|
123 |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
124 // make the widget floating |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
125 void |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
126 octave_dock_widget::make_window (void) |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
127 { |
24318
a17862b28f0d
handle floating widgets on all platforms as done on windows (bug #52378)
Torsten <mttl@mailbox.org>
parents:
24290
diff
changeset
|
128 // the widget has to be reparented (parent = 0) |
17686
65544374c1cf
restore (un)docking of widgets without reparenting on non-windows systems
Torsten <ttl@justmail.de>
parents:
17090
diff
changeset
|
129 |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
130 QSettings *settings = resource_manager::get_settings (); |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
131 |
17899
14c427b5c5c1
Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
132 // save the docking area and geometry for later redocking |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
133 // FIXME: dockWidgetArea always returns 2 |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
134 settings->setValue ("DockWidgets/" + objectName () + "_dock_area", |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
135 m_parent->dockWidgetArea (this)); |
17899
14c427b5c5c1
Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
136 settings->setValue ("DockWidgets/" + objectName (), saveGeometry ()); |
16819
94c19dfb4ab1
* octave-dock-widget.cc: add missing sync () after writing to settings
Torsten <ttl@justmail.de>
parents:
16818
diff
changeset
|
137 settings->sync (); |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
138 |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
139 // remove parent and adjust the (un)dock icon |
24570
c9aab297130e
make floating dock widgets resizable in KDE Oxygen (bug #52797)
Torsten <mttl@mailbox.org>
parents:
24534
diff
changeset
|
140 setTitleBarWidget (0); |
c9aab297130e
make floating dock widgets resizable in KDE Oxygen (bug #52797)
Torsten <mttl@mailbox.org>
parents:
24534
diff
changeset
|
141 setParent (0, Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint | |
c9aab297130e
make floating dock widgets resizable in KDE Oxygen (bug #52797)
Torsten <mttl@mailbox.org>
parents:
24534
diff
changeset
|
142 Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint); |
c9aab297130e
make floating dock widgets resizable in KDE Oxygen (bug #52797)
Torsten <mttl@mailbox.org>
parents:
24534
diff
changeset
|
143 setTitleBarWidget (m_title_widget); |
c9aab297130e
make floating dock widgets resizable in KDE Oxygen (bug #52797)
Torsten <mttl@mailbox.org>
parents:
24534
diff
changeset
|
144 setParent (0, Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint | |
c9aab297130e
make floating dock widgets resizable in KDE Oxygen (bug #52797)
Torsten <mttl@mailbox.org>
parents:
24534
diff
changeset
|
145 Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint); |
c9aab297130e
make floating dock widgets resizable in KDE Oxygen (bug #52797)
Torsten <mttl@mailbox.org>
parents:
24534
diff
changeset
|
146 |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
147 m_dock_action->setIcon (QIcon (":/actions/icons/widget-dock" |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
148 + m_icon_color + ".png")); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
149 m_dock_action->setToolTip (tr ("Dock widget")); |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
150 |
18678
6113e0c6920b
maint: Clean up extra spaces before/after parentheses.
Rik <rik@octave.org>
parents:
18555
diff
changeset
|
151 // restore the last geometry when floating |
17899
14c427b5c5c1
Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
152 setGeometry (settings->value ("DockWidgets/" + objectName () |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
153 + "_floating_geometry", |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
154 QRect (50,100,480,480)).toRect ()); |
17686
65544374c1cf
restore (un)docking of widgets without reparenting on non-windows systems
Torsten <ttl@justmail.de>
parents:
17090
diff
changeset
|
155 |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
156 m_floating = true; |
19983
643de08e524c
save and restore previously active widget in a tabbed stack (bug #42980)
Torsten <ttl@justmail.de>
parents:
19945
diff
changeset
|
157 |
643de08e524c
save and restore previously active widget in a tabbed stack (bug #42980)
Torsten <ttl@justmail.de>
parents:
19945
diff
changeset
|
158 set_focus_predecessor (); // set focus previously active widget if tabbed |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
159 } |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
160 |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
161 // dock the widget |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
162 void |
19431
bd27cd403d00
fix errors when building octave for windows (regression from d93293218966)
Torsten <ttl@justmail.de>
parents:
19423
diff
changeset
|
163 octave_dock_widget::make_widget (bool dock) |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
164 { |
24318
a17862b28f0d
handle floating widgets on all platforms as done on windows (bug #52378)
Torsten <mttl@mailbox.org>
parents:
24290
diff
changeset
|
165 // Since floating widget has no parent, we have to read it |
17686
65544374c1cf
restore (un)docking of widgets without reparenting on non-windows systems
Torsten <ttl@justmail.de>
parents:
17090
diff
changeset
|
166 |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
167 QSettings *settings = resource_manager::get_settings (); |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
168 |
17899
14c427b5c5c1
Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
169 // save last floating geometry if widget really was floating |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
170 if (m_floating) |
17899
14c427b5c5c1
Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
171 settings->setValue ("DockWidgets/" + objectName () + "_floating_geometry", |
14c427b5c5c1
Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
172 geometry ()); |
16819
94c19dfb4ab1
* octave-dock-widget.cc: add missing sync () after writing to settings
Torsten <ttl@justmail.de>
parents:
16818
diff
changeset
|
173 settings->sync (); |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
174 |
17090
1d544ac39369
show correct undock-button of widgets when window layout is resetted
Torsten <ttl@justmail.de>
parents:
16953
diff
changeset
|
175 if (dock) |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17686
diff
changeset
|
176 { |
24275
e9fe31118542
improve re-docking of a floating widget under windows
Torsten <mttl@mailbox.org>
parents:
24226
diff
changeset
|
177 settings->setValue ("MainWindow/windowState", m_parent->saveState ()); |
e9fe31118542
improve re-docking of a floating widget under windows
Torsten <mttl@mailbox.org>
parents:
24226
diff
changeset
|
178 m_parent->addDockWidget (Qt::TopDockWidgetArea, this); |
e9fe31118542
improve re-docking of a floating widget under windows
Torsten <mttl@mailbox.org>
parents:
24226
diff
changeset
|
179 // recover old window states, hide and re-show new added widget |
e9fe31118542
improve re-docking of a floating widget under windows
Torsten <mttl@mailbox.org>
parents:
24226
diff
changeset
|
180 m_parent->restoreState (settings->value ("MainWindow/windowState").toByteArray ()); |
e9fe31118542
improve re-docking of a floating widget under windows
Torsten <mttl@mailbox.org>
parents:
24226
diff
changeset
|
181 focus (); |
e9fe31118542
improve re-docking of a floating widget under windows
Torsten <mttl@mailbox.org>
parents:
24226
diff
changeset
|
182 QApplication::setActiveWindow (this); |
17090
1d544ac39369
show correct undock-button of widgets when window layout is resetted
Torsten <ttl@justmail.de>
parents:
16953
diff
changeset
|
183 } |
1d544ac39369
show correct undock-button of widgets when window layout is resetted
Torsten <ttl@justmail.de>
parents:
16953
diff
changeset
|
184 else // only reparent, no docking |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
185 setParent (m_parent); |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
186 |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
187 // adjust the (un)dock icon |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
188 m_dock_action->setIcon (QIcon (":/actions/icons/widget-undock" |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
189 + m_icon_color + ".png")); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
190 m_dock_action->setToolTip (tr ("Undock widget")); |
17686
65544374c1cf
restore (un)docking of widgets without reparenting on non-windows systems
Torsten <ttl@justmail.de>
parents:
17090
diff
changeset
|
191 |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
192 m_floating = false; |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
193 } |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
194 |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
195 // set the title in the dockwidgets title bar |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
196 void |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
197 octave_dock_widget::set_title (const QString& title) |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
198 { |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
199 QHBoxLayout *h_layout |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
200 = static_cast<QHBoxLayout *> (titleBarWidget ()->layout ()); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
201 QLabel *label = new QLabel (title); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
202 label->setStyleSheet ("background: transparent;"); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
203 h_layout->insertWidget (0,label); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
204 setWindowTitle (title); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
205 } |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
206 |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
207 // set the widget which previously had focus when tabified |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
208 void |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
209 octave_dock_widget::set_predecessor_widget (octave_dock_widget *prev_widget) |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
210 { |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
211 m_predecessor_widget = prev_widget; |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
212 } |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
213 |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
214 // close event |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
215 void |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
216 octave_dock_widget::closeEvent (QCloseEvent *e) |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
217 { |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
218 emit active_changed (false); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
219 set_focus_predecessor (); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
220 QDockWidget::closeEvent (e); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
221 } |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
222 |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
223 // get focus widget |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
224 QWidget * |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
225 octave_dock_widget::focusWidget (void) |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
226 { |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
227 QWidget *w = QApplication::focusWidget (); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
228 if (w && w->focusProxy ()) w = w->focusProxy (); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
229 return w; |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
230 } |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
231 |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
232 void |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
233 octave_dock_widget::handle_settings (const QSettings *settings) |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
234 { |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
235 m_custom_style |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
236 = settings->value ("DockWidgets/widget_title_custom_style",false).toBool (); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
237 |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
238 m_title_3d |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
239 = settings->value ("DockWidgets/widget_title_3d",50).toInt (); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
240 |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
241 QColor default_var = QColor (0,0,0); |
24226
dc85329e6778
consistent case of settings keys in the settings file (important for qt5)
Torsten <mttl@mailbox.org>
parents:
24014
diff
changeset
|
242 m_fg_color = settings->value ("DockWidgets/title_fg_color", |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
243 default_var).value<QColor> (); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
244 default_var = QColor (0,0,0); |
24226
dc85329e6778
consistent case of settings keys in the settings file (important for qt5)
Torsten <mttl@mailbox.org>
parents:
24014
diff
changeset
|
245 m_fg_color_active = settings->value ("DockWidgets/title_fg_color_active", |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
246 default_var).value<QColor> (); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
247 |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
248 default_var = QColor (255,255,255); |
24226
dc85329e6778
consistent case of settings keys in the settings file (important for qt5)
Torsten <mttl@mailbox.org>
parents:
24014
diff
changeset
|
249 m_bg_color = settings->value ("DockWidgets/title_bg_color", |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
250 default_var).value<QColor> (); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
251 default_var = QColor (192,192,192); |
24226
dc85329e6778
consistent case of settings keys in the settings file (important for qt5)
Torsten <mttl@mailbox.org>
parents:
24014
diff
changeset
|
252 m_bg_color_active = settings->value ("DockWidgets/title_bg_color_active", |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
253 default_var).value<QColor> (); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
254 |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
255 int r, g, b; |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
256 m_bg_color.getRgb (&r, &g, &b); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
257 if (r+g+b < 400) |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
258 m_icon_color = "-light"; |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
259 else |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
260 m_icon_color = ""; |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
261 |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
262 m_bg_color_active.getRgb (&r, &g, &b); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
263 if (r+g+b < 400) |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
264 m_icon_color_active = "-light"; |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
265 else |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
266 m_icon_color_active = ""; |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
267 |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
268 notice_settings (settings); // call individual handler |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
269 |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
270 set_style (false); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
271 } |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
272 |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
273 void |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
274 octave_dock_widget::handle_active_dock_changed (octave_dock_widget *w_old, |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
275 octave_dock_widget *w_new) |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
276 { |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
277 if (m_custom_style && this == w_old) |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
278 { |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
279 set_style (false); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
280 update (); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
281 } |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
282 |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
283 if (m_custom_style && this == w_new) |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
284 { |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
285 set_style (true); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
286 update (); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
287 } |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
288 } |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
289 |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
290 void |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
291 octave_dock_widget::save_settings (void) |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
292 { |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
293 // save state of this dock-widget |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
294 QString name = objectName (); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
295 QSettings *settings = resource_manager::get_settings (); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
296 |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
297 if (! settings) |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
298 return; |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
299 |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
300 settings->beginGroup ("DockWidgets"); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
301 |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
302 if (m_floating) // widget is floating (windows), save actual floating geometry |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
303 settings->setValue (name+"_floating_geometry", geometry ()); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
304 else // not floating save docked (normal) geometry |
24318
a17862b28f0d
handle floating widgets on all platforms as done on windows (bug #52378)
Torsten <mttl@mailbox.org>
parents:
24290
diff
changeset
|
305 settings->setValue (name, saveGeometry ()); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
306 |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
307 settings->setValue (name+"Visible", isVisible ()); // store visibility |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
308 settings->setValue (name+"Floating", m_floating); // store visibility |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
309 settings->setValue (name+"_minimized", isMinimized ()); // store minimized |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
310 |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
311 settings->endGroup (); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
312 settings->sync (); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
313 } |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
314 |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
315 bool octave_dock_widget::eventFilter (QObject *obj, QEvent *e) |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
316 { |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
317 if (e->type () == QEvent::NonClientAreaMouseButtonDblClick) |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
318 { |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
319 e->ignore (); // ignore double clicks into window decoration elements |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
320 return true; |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
321 } |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
322 |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
323 return QDockWidget::eventFilter (obj,e); |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
324 } |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
325 |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
326 // slot for (un)dock action |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
327 void |
17899
14c427b5c5c1
Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
328 octave_dock_widget::change_floating (bool) |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17686
diff
changeset
|
329 { |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
330 if (m_floating) |
17899
14c427b5c5c1
Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
331 make_widget (); |
14c427b5c5c1
Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
332 else |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
333 { |
16818
caf3d2a45da0
clean up some code for undocking and docking widgets
Torsten <ttl@justmail.de>
parents:
16809
diff
changeset
|
334 make_window (); |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
335 focus (); |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
336 } |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
337 } |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
338 |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
339 // slot for hiding the widget |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
340 void |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
341 octave_dock_widget::change_visibility (bool) |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
342 { |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
343 setVisible (false); |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
344 emit active_changed (false); |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
345 } |
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
diff
changeset
|
346 |
18180
b3838cedfe04
redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents:
17929
diff
changeset
|
347 void |
19423
d93293218966
custom style of dock widget title bars depending on focus (bug #43837)
Torsten <ttl@justmail.de>
parents:
19360
diff
changeset
|
348 octave_dock_widget::set_style (bool active) |
18180
b3838cedfe04
redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents:
17929
diff
changeset
|
349 { |
b3838cedfe04
redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents:
17929
diff
changeset
|
350 QString css; |
b3838cedfe04
redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents:
17929
diff
changeset
|
351 QString css_button; |
b3838cedfe04
redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents:
17929
diff
changeset
|
352 QString dock_icon; |
18218
7952fb0435db
improve title bar of dock widgets
Torsten <ttl@justmail.de>
parents:
18180
diff
changeset
|
353 |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
354 QString icon_col = m_icon_color; |
19431
bd27cd403d00
fix errors when building octave for windows (regression from d93293218966)
Torsten <ttl@justmail.de>
parents:
19423
diff
changeset
|
355 |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
356 if (m_floating) |
18218
7952fb0435db
improve title bar of dock widgets
Torsten <ttl@justmail.de>
parents:
18180
diff
changeset
|
357 dock_icon = "widget-dock"; |
18180
b3838cedfe04
redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents:
17929
diff
changeset
|
358 else |
18218
7952fb0435db
improve title bar of dock widgets
Torsten <ttl@justmail.de>
parents:
18180
diff
changeset
|
359 dock_icon = "widget-undock"; |
18180
b3838cedfe04
redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents:
17929
diff
changeset
|
360 |
20794
e870a68742a6
change alignment of dock widget titles for OSX (bug #46592)
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
361 #if defined (Q_OS_MAC) |
e870a68742a6
change alignment of dock widget titles for OSX (bug #46592)
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
362 QString alignment = "center"; |
e870a68742a6
change alignment of dock widget titles for OSX (bug #46592)
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
363 #else |
e870a68742a6
change alignment of dock widget titles for OSX (bug #46592)
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
364 QString alignment = "center left"; |
e870a68742a6
change alignment of dock widget titles for OSX (bug #46592)
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
365 #endif |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
366 if (m_custom_style) |
18180
b3838cedfe04
redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents:
17929
diff
changeset
|
367 { |
b3838cedfe04
redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents:
17929
diff
changeset
|
368 |
19423
d93293218966
custom style of dock widget title bars depending on focus (bug #43837)
Torsten <ttl@justmail.de>
parents:
19360
diff
changeset
|
369 QColor bg_col, fg_col; |
18180
b3838cedfe04
redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents:
17929
diff
changeset
|
370 |
19423
d93293218966
custom style of dock widget title bars depending on focus (bug #43837)
Torsten <ttl@justmail.de>
parents:
19360
diff
changeset
|
371 if (active) |
d93293218966
custom style of dock widget title bars depending on focus (bug #43837)
Torsten <ttl@justmail.de>
parents:
19360
diff
changeset
|
372 { |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
373 bg_col = m_bg_color_active; |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
374 fg_col = m_fg_color_active; |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
375 icon_col = m_icon_color_active; |
19423
d93293218966
custom style of dock widget title bars depending on focus (bug #43837)
Torsten <ttl@justmail.de>
parents:
19360
diff
changeset
|
376 } |
18218
7952fb0435db
improve title bar of dock widgets
Torsten <ttl@justmail.de>
parents:
18180
diff
changeset
|
377 else |
19423
d93293218966
custom style of dock widget title bars depending on focus (bug #43837)
Torsten <ttl@justmail.de>
parents:
19360
diff
changeset
|
378 { |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
379 bg_col = m_bg_color; |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
380 fg_col = m_fg_color; |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
381 icon_col = m_icon_color; |
19423
d93293218966
custom style of dock widget title bars depending on focus (bug #43837)
Torsten <ttl@justmail.de>
parents:
19360
diff
changeset
|
382 } |
18218
7952fb0435db
improve title bar of dock widgets
Torsten <ttl@justmail.de>
parents:
18180
diff
changeset
|
383 |
19913
2a992bd19169
make color gradient of custom title bar adjustable (bug #44435)
Torsten <ttl@justmail.de>
parents:
19911
diff
changeset
|
384 QColor bg_col_top, bg_col_bottom; |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
385 if (m_title_3d > 0) |
19913
2a992bd19169
make color gradient of custom title bar adjustable (bug #44435)
Torsten <ttl@justmail.de>
parents:
19911
diff
changeset
|
386 { |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
387 bg_col_top = bg_col.lighter (100 + m_title_3d); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
388 bg_col_bottom = bg_col.darker (100 + m_title_3d); |
19913
2a992bd19169
make color gradient of custom title bar adjustable (bug #44435)
Torsten <ttl@justmail.de>
parents:
19911
diff
changeset
|
389 } |
2a992bd19169
make color gradient of custom title bar adjustable (bug #44435)
Torsten <ttl@justmail.de>
parents:
19911
diff
changeset
|
390 else |
2a992bd19169
make color gradient of custom title bar adjustable (bug #44435)
Torsten <ttl@justmail.de>
parents:
19911
diff
changeset
|
391 { |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
392 bg_col_top = bg_col.darker (100 - m_title_3d); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
393 bg_col_bottom = bg_col.lighter (100 - m_title_3d); |
19913
2a992bd19169
make color gradient of custom title bar adjustable (bug #44435)
Torsten <ttl@justmail.de>
parents:
19911
diff
changeset
|
394 } |
2a992bd19169
make color gradient of custom title bar adjustable (bug #44435)
Torsten <ttl@justmail.de>
parents:
19911
diff
changeset
|
395 |
18218
7952fb0435db
improve title bar of dock widgets
Torsten <ttl@justmail.de>
parents:
18180
diff
changeset
|
396 QString background = |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
397 QString ("background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1," |
19913
2a992bd19169
make color gradient of custom title bar adjustable (bug #44435)
Torsten <ttl@justmail.de>
parents:
19911
diff
changeset
|
398 " stop: 0 %1, stop: 0.60 %2, stop: 0.95 %2 stop: 1.0 %3);"). |
2a992bd19169
make color gradient of custom title bar adjustable (bug #44435)
Torsten <ttl@justmail.de>
parents:
19911
diff
changeset
|
399 arg (bg_col_top.name ()). |
2a992bd19169
make color gradient of custom title bar adjustable (bug #44435)
Torsten <ttl@justmail.de>
parents:
19911
diff
changeset
|
400 arg (bg_col.name ()). |
2a992bd19169
make color gradient of custom title bar adjustable (bug #44435)
Torsten <ttl@justmail.de>
parents:
19911
diff
changeset
|
401 arg (bg_col_bottom.name ()); |
18180
b3838cedfe04
redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents:
17929
diff
changeset
|
402 |
19423
d93293218966
custom style of dock widget title bars depending on focus (bug #43837)
Torsten <ttl@justmail.de>
parents:
19360
diff
changeset
|
403 css = background + QString (" color: %1 ;").arg (fg_col.name ()); |
18180
b3838cedfe04
redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents:
17929
diff
changeset
|
404 } |
b3838cedfe04
redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents:
17929
diff
changeset
|
405 else |
b3838cedfe04
redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents:
17929
diff
changeset
|
406 { |
b3838cedfe04
redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents:
17929
diff
changeset
|
407 css = QString (""); |
b3838cedfe04
redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents:
17929
diff
changeset
|
408 } |
b3838cedfe04
redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents:
17929
diff
changeset
|
409 |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
410 m_title_widget->setStyleSheet (css); |
24696
344832a898ad
Use proper stylesheet syntax to avoid tooltip black background (bug #44554).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24570
diff
changeset
|
411 css_button = QString ("QToolButton {background: transparent; border: 0px;}"); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
412 m_dock_button->setStyleSheet (css_button); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
413 m_close_button->setStyleSheet (css_button); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
414 m_dock_action->setIcon (QIcon (":/actions/icons/" + dock_icon + icon_col + |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
415 ".png")); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
416 m_close_action->setIcon (QIcon (":/actions/icons/widget-close" + icon_col + |
19911
2b5cbea8f442
fix missing close icon of dock widgets in windows (bug #44441)
Torsten <ttl@justmail.de>
parents:
19861
diff
changeset
|
417 ".png")); |
19423
d93293218966
custom style of dock widget title bars depending on focus (bug #43837)
Torsten <ttl@justmail.de>
parents:
19360
diff
changeset
|
418 } |
d93293218966
custom style of dock widget title bars depending on focus (bug #43837)
Torsten <ttl@justmail.de>
parents:
19360
diff
changeset
|
419 |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
420 // set focus to previously active widget in tabbed widget stack |
19423
d93293218966
custom style of dock widget title bars depending on focus (bug #43837)
Torsten <ttl@justmail.de>
parents:
19360
diff
changeset
|
421 void |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
422 octave_dock_widget::set_focus_predecessor (void) |
19423
d93293218966
custom style of dock widget title bars depending on focus (bug #43837)
Torsten <ttl@justmail.de>
parents:
19360
diff
changeset
|
423 { |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
424 if (m_predecessor_widget) // only != 0 if widget was tabbed |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
425 m_predecessor_widget->focus (); |
19423
d93293218966
custom style of dock widget title bars depending on focus (bug #43837)
Torsten <ttl@justmail.de>
parents:
19360
diff
changeset
|
426 |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
427 m_predecessor_widget = nullptr; |
24290 | 428 // FIXME: Until cset bda0c5b38bda, the wrong keys "Dockwidget/..." were used |
429 // here. This had no effect in Qt4, but does in Qt5. In the following, the | |
430 // four incorrect keys are updated if still present in the settings files. | |
431 // The keys are also used in the settings dialog, but | |
432 // octave_dock_widget::handle_settings is already called at program start. | |
433 // These tests can be removed in a future version of Octave (version 4.8). | |
24282
a669809df612
update wrong setting keys accidentally introduced into the settings file
Torsten <mttl@mailbox.org>
parents:
24280
diff
changeset
|
434 resource_manager::update_settings_key ("Dockwidgets/title_bg_color", |
a669809df612
update wrong setting keys accidentally introduced into the settings file
Torsten <mttl@mailbox.org>
parents:
24280
diff
changeset
|
435 "DockWidgets/title_bg_color"); |
a669809df612
update wrong setting keys accidentally introduced into the settings file
Torsten <mttl@mailbox.org>
parents:
24280
diff
changeset
|
436 resource_manager::update_settings_key ("Dockwidgets/title_bg_color_active", |
a669809df612
update wrong setting keys accidentally introduced into the settings file
Torsten <mttl@mailbox.org>
parents:
24280
diff
changeset
|
437 "DockWidgets/title_bg_color_active"); |
a669809df612
update wrong setting keys accidentally introduced into the settings file
Torsten <mttl@mailbox.org>
parents:
24280
diff
changeset
|
438 resource_manager::update_settings_key ("Dockwidgets/title_fg_color", |
a669809df612
update wrong setting keys accidentally introduced into the settings file
Torsten <mttl@mailbox.org>
parents:
24280
diff
changeset
|
439 "DockWidgets/title_fg_color"); |
a669809df612
update wrong setting keys accidentally introduced into the settings file
Torsten <mttl@mailbox.org>
parents:
24280
diff
changeset
|
440 resource_manager::update_settings_key ("Dockwidgets/title_fg_color_active", |
a669809df612
update wrong setting keys accidentally introduced into the settings file
Torsten <mttl@mailbox.org>
parents:
24280
diff
changeset
|
441 "DockWidgets/title_fg_color_active"); |
18180
b3838cedfe04
redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents:
17929
diff
changeset
|
442 } |