GNU Octave 7.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
octave-dock-widget.cc
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 2012-2022 The Octave Project Developers
4//
5// See the file COPYRIGHT.md in the top-level directory of this
6// distribution or <https://octave.org/copyright/>.
7//
8// This file is part of Octave.
9//
10// Octave is free software: you can redistribute it and/or modify it
11// under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// Octave is distributed in the hope that it will be useful, but
16// WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18// GNU General Public License for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with Octave; see the file COPYING. If not, see
22// <https://www.gnu.org/licenses/>.
23//
24////////////////////////////////////////////////////////////////////////
25
26#if defined (HAVE_CONFIG_H)
27# include "config.h"
28#endif
29
30#include <QAction>
31#include <QApplication>
32#include <QDesktopWidget>
33#include <QHBoxLayout>
34#include <QLabel>
35#include <QStyle>
36#include <QToolBar>
37#include <QMenuBar>
38
39#include "gui-preferences-dw.h"
41#include "gui-preferences-mw.h"
42#include "gui-preferences-sc.h"
43#include "gui-settings.h"
44#include "main-window.h"
45#include "octave-dock-widget.h"
46#include "octave-qobject.h"
47
48namespace octave
49{
51 : QDockWidget (p), m_octave_qobj (oct_qobj),
52 m_default_float_button (nullptr), m_default_close_button (nullptr)
53 {
54 QStyle *st = style ();
55 m_icon_size = 0.75*st->pixelMetric (QStyle::PM_SmallIconSize);
56
57 // keep track of the original buttons on the default title bar,
58 // the button further left is considered "float"
59 QList<QAbstractButton *> buttonlist = findChildren<QAbstractButton *> ();
60 if (buttonlist.size () == 2)
61 {
62 if (buttonlist.at (0)->x () < buttonlist.at (1)->x ())
63 {
64 m_default_float_button = buttonlist.at (0);
65 m_default_close_button = buttonlist.at (1);
66 }
67 else
68 {
69 m_default_float_button = buttonlist.at (1);
70 m_default_close_button = buttonlist.at (0);
71 }
72 }
73
74 // the custom (extra) title bar of the widget
75 m_title_widget = new QWidget ();
76
77 m_dock_action = new QAction
78 (QIcon (":/actions/icons/widget-undock.png"), "", this);
79 m_dock_action->setToolTip (tr ("Undock widget"));
81 m_dock_button->setDefaultAction (m_dock_action);
82 m_dock_button->setFocusPolicy (Qt::NoFocus);
83 m_dock_button->setIconSize (QSize (m_icon_size, m_icon_size));
84
85 m_close_action = new QAction
86 (QIcon (":/actions/icons/widget-close.png"), "", this);
87 m_close_action->setToolTip (tr ("Close widget"));
89 m_close_button->setDefaultAction (m_close_action);
90 m_close_button->setFocusPolicy (Qt::NoFocus);
91 m_close_button->setIconSize (QSize (m_icon_size, m_icon_size));
92
93 QString css_button = QString ("QToolButton {background: transparent; border: 0px;}");
94 m_dock_button->setStyleSheet (css_button);
95 m_close_button->setStyleSheet (css_button);
96
97 QHBoxLayout *h_layout = new QHBoxLayout ();
98 h_layout->addStretch (100);
99 h_layout->addWidget (m_dock_button);
100 h_layout->addWidget (m_close_button);
101 h_layout->setSpacing (10);
102 h_layout->setContentsMargins (5, 2, 2, 2);
103
104 m_title_widget->setLayout (h_layout);
105
106 if (p && (p->objectName () == gui_obj_name_main_window))
107 {
108 // Only connect the when a parent (main window) is given
109 // copy & paste handling
110 connect (p, SIGNAL (copyClipboard_signal ()),
111 this, SLOT (copyClipboard ()));
112 connect (p, SIGNAL (pasteClipboard_signal ()),
113 this, SLOT (pasteClipboard ()));
114 connect (p, SIGNAL (selectAll_signal ()),
115 this, SLOT (selectAll ()));
116
117 // undo handling
118 connect (p, SIGNAL (undo_signal ()), this, SLOT (do_undo ()));
119 }
120 }
121
122 // set the title in the dockwidgets title bar
123 void
124 label_dock_widget::set_title (const QString& title)
125 {
126 QHBoxLayout *h_layout
127 = static_cast<QHBoxLayout *> (m_title_widget->layout ());
128 QLabel *label = new QLabel (title, m_title_widget);
129 label->setStyleSheet ("background-color: transparent;");
130 h_layout->insertWidget (0, label);
131 setTitleBarWidget (m_title_widget);
132 setWindowTitle (title);
133 }
134
135
136 static QString
137 qdockwidget_css (const QString& close_icon, const QString& close_tooltip,
138 const QString& float_icon, const QString& float_tooltip,
139 int icon_size, const QString& titlebar_foreground,
140 const QString& titlebar_background)
141 {
142 return QString ("QDockWidget\n"
143 "{\n"
144 "%6"
145 " border: none;\n"
146 " titlebar-close-icon: url(%1);\n"
147 " titlebar-normal-icon: url(%2);\n"
148 "}\n"
149 "\n"
150 "QDockWidget::close-button, QDockWidget::float-button\n"
151 "{\n"
152 " border: none;\n"
153 " icon-size: %3px;\n"
154 "}\n"
155 "\n"
156 "QAbstractButton#qt_dockwidget_closebutton\n"
157 "{\n"
158 " qproperty-toolTip: \"%4\";\n"
159 "}\n"
160 "\n"
161 "QAbstractButton#qt_dockwidget_floatbutton\n"
162 "{\n"
163 " qproperty-toolTip: \"%5\";\n"
164 "}\n"
165 "\n"
166 "QDockWidget::title {\n"
167 " text-align: left;\n"
168 "%7"
169 " padding-left: 1px;\n"
170 "}\n"
171 "\n"
172 "QDockWidget::close-button\n"
173 "{\n"
174 " right: %8px;\n"
175 " top: 3px;\n"
176 "}\n"
177 "\n"
178 "QDockWidget::float-button\n"
179 "{\n"
180 " right: %9px;\n"
181 " top: 3px;\n"
182 "}\n"
183 ).arg (close_icon).arg (float_icon).arg (icon_size)
184 .arg (close_tooltip).arg (float_tooltip)
185 .arg (titlebar_foreground).arg (titlebar_background)
186 .arg ((icon_size*2)/3).arg((icon_size*7)/3);
187 }
188
190 base_qobject& oct_qobj)
191 : label_dock_widget (p, oct_qobj), m_adopted (false),
192 m_custom_style (false), m_focus_follows_mouse (false),
193 m_recent_float_geom (), m_recent_dock_geom (),
194 m_waiting_for_mouse_button_release (false)
195 {
196 setObjectName (obj_name);
197
198 // FIXME: Can we avoid the cast here?
199 m_main_window = dynamic_cast<main_window *> (p);
200
201 m_predecessor_widget = nullptr;
202
203 connect (this, &octave_dock_widget::topLevelChanged,
205 connect (this, &octave_dock_widget::visibilityChanged,
207
208 if (m_default_float_button != nullptr)
209 {
210 disconnect (m_default_float_button, 0, 0, 0);
211 connect (m_default_float_button, &QAbstractButton::clicked,
213 }
215 this, &octave_dock_widget::make_window, Qt::QueuedConnection);
217 this, [=] () { make_widget (); }, Qt::QueuedConnection);
218
221 m_dock_action->setShortcutContext (Qt::WidgetWithChildrenShortcut);
222 addAction (m_dock_action);
223 connect (m_dock_action, &QAction::triggered,
225
226 scmgr.set_shortcut (m_close_action, sc_dock_widget_close);
227 m_close_action->setShortcutContext (Qt::WidgetWithChildrenShortcut);
228 addAction (m_close_action);
229 connect (m_close_action, &QAction::triggered,
231
232 m_close_action->setToolTip (tr ("Hide widget"));
233
234 setStyleSheet (qdockwidget_css (QString (":/actions/icons/widget-close.png"),
235 QString ("Close widget"),
236 QString (":/actions/icons/widget-undock.png"),
237 QString ("Undock widget"),
239 QString (""),
240 QString ("")));
241 if (widget ())
242 widget ()->setToolTip (QString (""));
243
244 m_icon_color = "";
245 m_title_3d = 50;
246
247 installEventFilter (this);
248
249 setFocusPolicy (Qt::StrongFocus);
250
251 setFeatures (QDockWidget::DockWidgetClosable
252 | QDockWidget::DockWidgetMovable
253 | QDockWidget::DockWidgetFloatable);
254
257 }
258
259 void
261 {
262 emit active_changed (isVisible ()); // emit once for init of window menu
263 }
264
265 // make the widget floating
266 void
267 octave_dock_widget::make_window (bool widget_was_dragged)
268 {
269 bool vis = isVisible ();
270
271 // prevent follow-up calls by clearing state variable
273
274 set_focus_predecessor (); // set focus previously active widget if tabbed
275
276 // Before unparenting, get current geometry for restoring if dragged
277 QRect geom = geometry ();
278
279 // the widget has to be reparented (parent = 0), preferably
280 // from a non-toplevel widget otherwise may not have full
281 // decorations, e.g., no taskbar icon and always in front
282 if (isFloating ())
283 setFloating (false);
284
285 if (m_main_window)
286 {
287 // Before making it a separate (no more parent) floating widget,
288 // remove the dock widget from the main window. This ensures
289 // that tabbed widgets keep their focus when it is re-docked
290 // later
291 m_main_window->removeDockWidget (this);
292 }
293
294 setParent (0, Qt::CustomizeWindowHint | Qt::WindowTitleHint |
295 Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint | Qt::Window);
296
297 // restore the last geometry when floating only if we have not dragged
298 // the window outside the main window
299 if (! widget_was_dragged)
300 geom = m_recent_float_geom.isNull () ? QRect (50,100,480,480)
302 setGeometry (geom);
303
304 // adjust the (un)dock action
305 disconnect (m_dock_action, 0, this, 0);
306 connect (m_dock_action, &QAction::triggered,
308
309 // adjust the (un)dock icon
310 if (titleBarWidget ())
311 {
312 m_dock_action->setIcon (QIcon (":/actions/icons/widget-dock"
313 + m_icon_color + ".png"));
314 m_dock_action->setToolTip (tr ("Dock widget"));
315 }
316 else
317 {
318 disconnect (m_default_float_button, 0, this, 0);
319 connect (m_default_float_button, &QAbstractButton::clicked,
321 }
322
323 raise ();
324 activateWindow ();
325
326 if (vis)
327 {
328 show ();
329 setFocus ();
330 set_style (true);
331 }
332
333 emit topLevelChanged (true); // Be sure signal is emitted
334 }
335
336 // dock the widget
337 void
339 {
340 bool vis = isVisible ();
341
342 // Since floating widget has no parent, we have to read it
345
346 if (m_main_window)
347 {
348 settings->setValue (mw_state.key, m_main_window->saveState ());
349
350 // Stay window, otherwise will bounce back to window by default
351 // because there is no layout information for this widget in the
352 // saved settings.
353 setParent (m_main_window, Qt::Window);
354 m_main_window->addDockWidget (Qt::BottomDockWidgetArea, this);
355 m_adopted = false;
356 // recover old window states, hide and re-show new added widget
357 m_main_window->restoreState (settings->value (mw_state.key).toByteArray ());
358 setFloating (false);
359 // restore size using setGeometry instead of restoreGeometry
360 // following this post:
361 // https://forum.qt.io/topic/79326/qdockwidget-restoregeometry-not-working-correctly-when-qmainwindow-is-maximized/5
362 setGeometry (m_recent_dock_geom);
363 }
364
365 // adjust the (un)dock icon
366 disconnect (m_dock_action, 0, this, 0);
367 connect (m_dock_action, &QAction::triggered,
369 if (titleBarWidget ())
370 {
371 m_dock_action->setIcon (QIcon (":/actions/icons/widget-undock"
372 + m_icon_color + ".png"));
373 m_dock_action->setToolTip (tr ("Undock widget"));
374 }
375 else
376 {
377 disconnect (m_default_float_button, 0, this, 0);
378 connect (m_default_float_button, &QAbstractButton::clicked,
380 }
381
382 raise ();
383 QApplication::setActiveWindow (this);
384
385 if (vis)
386 {
387 show ();
388 setFocus ();
389 set_style (true);
390 }
391 }
392
393 // dock the widget
394 void
396 {
397 setFloating (false);
398 }
399
400 // set the widget which previously had focus when tabified
401 void
403 {
404 m_predecessor_widget = prev_widget;
405 }
406
407 void
409 {
410 m_main_window = mw;
411
412 if (m_main_window)
413 {
416
419
422
425 }
426 }
427
428 // close event
429 void
431 {
432 emit active_changed (false);
434 save_settings ();
435
436 QDockWidget::closeEvent (e);
437 }
438
439 // get focus widget
440 QWidget *
442 {
443 QWidget *w = QApplication::focusWidget ();
444 if (w && w->focusProxy ()) w = w->focusProxy ();
445 return w;
446 }
447
448 bool
450 {
451 // low-level check of whether docked-widget became a window via
452 // double-click or via drag-and-drop
453 if ( (event->type () == QEvent::MouseButtonDblClick && ! isFloating ())
454 || (event->type () == QEvent::ActivationChange
456 {
457 bool retval = QDockWidget::event (event);
458 if (isFloating () && parent () != 0)
459 {
461 emit queue_make_window (event->type () != QEvent::MouseButtonDblClick);
462 }
463 return retval;
464 }
465
466 return QDockWidget::event (event);
467 }
468
469 void
471 {
472 if (! settings)
473 return;
474
476
478 = settings->value (dw_title_custom_style).toBool ();
479
480 m_title_3d = settings->value (dw_title_3d.key, dw_title_3d.def).toInt ();
481
483 = settings->value (dw_title_fg_color).value<QColor> ();
484
486 = settings->value (dw_title_fg_color_active).value<QColor> ();
487
488 m_bg_color = settings->value (dw_title_bg_color).value<QColor> ();
489
491 = settings->value (dw_title_bg_color_active).value<QColor> ();
492
493 QColor bcol (m_bg_color);
494 QColor bcola (m_bg_color_active);
495
496 if (! m_custom_style)
497 {
498 bcol = QWidget::palette ().color (m_title_widget->backgroundRole ());
499 bcola = bcol;
500 }
501
502 int r, g, b;
503 bcol.getRgb (&r, &g, &b);
504 if (r+g+b < 400)
505 m_icon_color = "-light";
506 else
507 m_icon_color = "";
508
509 bcola.getRgb (&r, &g, &b);
510 if (r+g+b < 400)
511 m_icon_color_active = "-light";
512 else
514
515
516 QWidget *ref_widget = m_main_window;
517 if (! ref_widget)
518 ref_widget = this;
519
520 int x, y, w, h;
521 QApplication::desktop ()->availableGeometry (ref_widget).getRect (&x, &y, &w, &h);
522 QRect default_floating_size = QRect (x+16, y+32, w/3, h/2);
523
524 QRect default_dock_size;
525 if (m_main_window)
526 {
527 // We have a main window, dock size depends on size of main window
528 m_main_window->geometry ().getRect (&x, &y, &w, &h);
529 default_dock_size = QRect (x+16, y+32, w/3, h/3);
530 }
531 else
532 {
533 // No main window, default dock size should never be used
534 default_dock_size = QRect (0, 0, w/10, h/10);
535 }
536
538 = settings->value (dw_float_geometry.key.arg (objectName ()),
539 default_floating_size).toRect ();
540
541 QWidget dummy;
542 dummy.setGeometry (m_recent_float_geom);
543
544 if (QApplication::desktop ()->screenNumber (&dummy) == -1)
545 m_recent_float_geom = default_floating_size;
546
547 // The following is required for ensure smooth transition from old
548 // saveGeomety to new QRect setting (see comment for restoring size
549 // of docked widgets)
550 QVariant dock_geom
551 = settings->value (dw_dock_geometry.key.arg (objectName ()),
552 default_dock_size);
553 if (dock_geom.canConvert (QMetaType::QRect))
554 m_recent_dock_geom = dock_geom.toRect ();
555 else
557
558 notice_settings (settings); // call individual handler
559
560 set_style (false);
561
562 // Compacter design
563 QToolBar *toolbar = findChild <QToolBar *> ();
564 if (toolbar)
565 toolbar->setStyleSheet (toolbar->styleSheet () + global_toolbar_style);
566
567 QMenuBar *menubar = findChild <QMenuBar *> ();
568 if (menubar)
569 menubar->setStyleSheet (menubar->styleSheet () + global_menubar_style);
570
571 }
572
573 void
575 octave_dock_widget *w_new)
576 {
577 if (m_custom_style && this == w_old)
578 {
579 set_style (false);
580 update ();
581 }
582
583 if (m_custom_style && this == w_new)
584 {
585 set_style (true);
586 update ();
587 }
588 }
589
590 void
592 {
593 // save state of this dock-widget
594 QString name = objectName ();
597
598 if (! settings)
599 return;
600
602
603 // conditional needed?
604 if (! m_recent_float_geom.isNull ())
606
607 if (! m_recent_dock_geom.isEmpty ())
609 settings->setValue (dw_is_visible.key.arg (name), isVisible ()); // store visibility
610 settings->setValue (dw_is_floating.key.arg (name), isFloating ()); // store floating
611 settings->setValue (dw_is_minimized.key.arg (name), isMinimized ()); // store minimized
612
613 settings->sync ();
614 }
615
617 {
618 // Ignore double clicks into window decoration elements
619 if (e->type () == QEvent::NonClientAreaMouseButtonDblClick)
620 {
621 e->ignore ();
622 return true;
623 }
624
625 // Detect mouse enter events if "focus follows mouse" is desired
626 // for widgets docked to the main window (non floating) and activate
627 // the widget currently under the mouse
628 if (m_focus_follows_mouse && ! isFloating () && (e->type () == QEvent::Enter))
629 setFocus ();
630
631 return QDockWidget::eventFilter (obj, e);
632 }
633
634 void
636 {
637 if (isFloating ())
638 {
639 if (! parent ())
640 m_recent_float_geom = geometry ();
641 }
642 else
643 {
644 m_recent_dock_geom = geometry ();
645 }
646 }
647
648 void
650 {
652
653 QDockWidget::moveEvent (event);
654 }
655
656 void
658 {
660
661 QDockWidget::resizeEvent (event);
662 }
663
664 // slot for hiding the widget
665 void
667 {
668 setVisible (false);
669 emit active_changed (false);
670 }
671
673 {
674 if (! isVisible ())
675 setVisible (true);
676
677 setFocus ();
678 activateWindow ();
679 raise ();
680 }
681
683 {
684 if (visible)
685 {
686 emit active_changed (true);
687 if (! isFloating ())
688 setFocus ();
689 }
690 }
691
692 void
694 {
695 QObject *dockobj;
696 const char *docksig;
697
698 if (titleBarWidget ())
699 {
700 dockobj = m_dock_action;
701 docksig = SIGNAL (triggered (bool));
702 }
703 else
704 {
705 dockobj = m_default_float_button;
706 docksig = SIGNAL (clicked (bool));
707 }
708
709 if (toplevel)
710 {
711 // This is a fallback in case the attempt to create a floated
712 // top-level window fails and the QDockWidget remains a child
713 // of the QMainWindow.
714 connect (dockobj, docksig, this, SLOT (default_dock (bool)));
715
716 // Could be dragging window, so must wait until there is a
717 // change in focus.
718 if (parent () != 0)
720 }
721 else
722 {
723 // If a drag-and-drop within the QMainWindow occurred, want to remain a widget.
725
726 // Making into a widget immediately will mangle the double-click
727 // status and cause problems on followup button clicks.
728 if (parent () == 0)
729 emit queue_make_widget ();
730 }
731 }
732
733 void
735 {
736 QString css_foreground;
737 QString css_background;
738 QString css_button;
739 QString dock_icon;
740
741 QString icon_col = m_icon_color;
742
743 QString close_tooltip = "Close widget";
744 QString dock_tooltip;
745
746 if (isFloating ())
747 {
748 dock_icon = "widget-dock";
749 dock_tooltip = "Dock widget";
750 }
751 else
752 {
753 dock_icon = "widget-undock";
754 dock_tooltip = "Undock widget";
755 }
756
757#if defined (Q_OS_MAC)
758 QString alignment = "center";
759#else
760 QString alignment = "center left";
761#endif
762 if (m_custom_style)
763 {
764
765 QColor bg_col, fg_col;
766
767 if (active)
768 {
769 bg_col = m_bg_color_active;
770 fg_col = m_fg_color_active;
771 icon_col = m_icon_color_active;
772 }
773 else
774 {
775 bg_col = m_bg_color;
776 fg_col = m_fg_color;
777 icon_col = m_icon_color;
778 }
779
780 QColor bg_col_top, bg_col_bottom;
781 if (m_title_3d > 0)
782 {
783 bg_col_top = bg_col.lighter (100 + m_title_3d);
784 bg_col_bottom = bg_col.darker (100 + m_title_3d);
785 }
786 else
787 {
788 bg_col_top = bg_col.darker (100 - m_title_3d);
789 bg_col_bottom = bg_col.lighter (100 - m_title_3d);
790 }
791
792 css_foreground = QString (" color: %1;\n").arg (fg_col.name ());
793
794 css_background =
795 QString (" background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,"
796 " stop: 0 %1, stop: 0.60 %2, stop: 0.95 %2 stop: 1.0 %3);\n").
797 arg (bg_col_top.name ()).
798 arg (bg_col.name ()).
799 arg (bg_col_bottom.name ());
800 }
801 else
802 {
803 css_foreground = QString ("");
804 css_background = QString ("");
805 }
806
807 QString full_dock_icon = ":/actions/icons/" + dock_icon + icon_col + ".png";
808 QString full_close_icon = ":/actions/icons/widget-close" + icon_col + ".png";
809 if (titleBarWidget ())
810 {
811 titleBarWidget ()->setStyleSheet (css_foreground + css_background);
812 css_button = QString ("QToolButton {background: transparent; border: 0px;}");
813 m_dock_button->setStyleSheet (css_button);
814 m_close_button->setStyleSheet (css_button);
815 m_dock_action->setIcon (QIcon (full_dock_icon));
816 m_close_action->setIcon (QIcon (full_close_icon));
817 }
818 else
819 {
820 setStyleSheet (qdockwidget_css (full_close_icon,
821 close_tooltip,
822 full_dock_icon,
823 dock_tooltip,
825 css_foreground,
826 css_background));
827 }
828 }
829
830 // set focus to previously active widget in tabbed widget stack
831 void
833 {
834 // only != 0 if widget was tabbed
835 if (m_predecessor_widget && m_predecessor_widget->isVisible ())
836 m_predecessor_widget->setFocus ();
837
838 m_predecessor_widget = nullptr;
839
840 // FIXME: Until cset bda0c5b38bda, the wrong keys "Dockwidget/..." were used
841 // here. This had no effect in Qt4, but does in Qt5. In the following, the
842 // four incorrect keys are updated if still present in the settings files.
843 // The keys are also used in the settings dialog, but
844 // octave_dock_widget::handle_settings is already called at program start.
845 // These tests can be removed in a future version of Octave (version 6).
846
848
849 rmgr.update_settings_key ("Dockwidgets/title_bg_color",
851
852 rmgr.update_settings_key ("Dockwidgets/title_bg_color_active",
854
855 rmgr.update_settings_key ("Dockwidgets/title_fg_color",
857
858 rmgr.update_settings_key ("Dockwidgets/title_fg_color_active",
860 }
861}
Base class for Octave interfaces that use Qt.
shortcut_manager & get_shortcut_manager(void)
resource_manager & get_resource_manager(void)
QAbstractButton * m_default_close_button
QAbstractButton * m_default_float_button
virtual void selectAll(void)
Slots to handle copy & paste.
label_dock_widget(QWidget *p, base_qobject &oct_qobj)
virtual void copyClipboard(void)
Slots to handle copy & paste.
virtual void do_undo(void)
Slot to handle undo.
virtual void pasteClipboard(void)
Slots to handle copy & paste.
void set_title(const QString &)
Represents the main window.
Definition: main-window.h:73
void undo_signal(void)
void pasteClipboard_signal(void)
void selectAll_signal(void)
void copyClipboard_signal(void)
void queue_make_window(bool widget_was_dragged)
void set_main_window(main_window *mw)
void handle_settings(const gui_settings *)
void handle_active_dock_changed(octave_dock_widget *, octave_dock_widget *)
void make_window(bool widget_was_dragged=false)
octave_dock_widget * m_predecessor_widget
bool eventFilter(QObject *obj, QEvent *e)
Event filter for double clicks into the window decoration elements.
main_window * m_main_window
Stores the parent, since we are reparenting to 0.
virtual void toplevel_change(bool)
void make_widget(bool not_used=false)
void set_predecessor_widget(octave_dock_widget *prev_widget)
void active_changed(bool active)
Custom signal that tells whether a user has clicked away that dock widget, i.e.
void resizeEvent(QResizeEvent *event)
void moveEvent(QMoveEvent *event)
virtual void closeEvent(QCloseEvent *e)
virtual void save_settings(void)
octave_dock_widget(const QString &obj_name, QWidget *p, base_qobject &oct_qobj)
virtual void handle_visibility(bool visible)
void default_dock(bool not_used=false)
virtual void notice_settings(const gui_settings *)
gui_settings * get_settings(void) const
bool update_settings_key(const QString &new_key, const QString &old_key)
void set_shortcut(QAction *action, const sc_pref &scpref, bool enable=true)
const gui_pref dw_title_bg_color("DockWidgets/title_bg_color", QVariant(QColor(255, 255, 255)))
const gui_pref dw_title_fg_color("DockWidgets/title_fg_color", QVariant(QColor(0, 0, 0)))
const gui_pref dw_title_3d("DockWidgets/widget_title_3d", QVariant(50))
const gui_pref dw_title_fg_color_active("DockWidgets/title_fg_color_active", QVariant(QColor(0, 0, 0)))
const gui_pref dw_is_floating("DockWidgets/%1Floating", QVariant(false))
const gui_pref dw_focus_follows_mouse("DockWidgets/focus_follows_mouse", QVariant(false))
const gui_pref dw_dock_geometry("DockWidgets/%1", QVariant(QRect(10, 10, 240, 320)))
const gui_pref dw_is_visible("DockWidgets/%1Visible", QVariant(true))
const gui_pref dw_is_minimized("DockWidgets/%1_minimized", QVariant(false))
const gui_pref dw_title_bg_color_active("DockWidgets/title_bg_color_active", QVariant(QColor(192, 192, 192)))
QString name
const gui_pref dw_title_custom_style("DockWidgets/widget_title_custom_style", QVariant(false))
const gui_pref dw_float_geometry("DockWidgets/%1_floating_geometry", QVariant(QRect(50, 50, 480, 640)))
const QString global_menubar_style("QMenuBar {" "margin-top: 0px;" "margin-bottom: 0px;" "padding-top: 0px;" "padding-bottom: 0px;" "}")
const QString gui_obj_name_main_window
const QString global_toolbar_style("QToolBar {" "margin-top: 0px;" "margin-bottom: 0px;" "padding-top: 0px;" "padding-bottom: 0px;" "border-top: 0px;" "border-bottom: 0px;" "}")
const gui_pref mw_state("MainWindow/windowState", QVariant(QByteArray()))
const sc_pref sc_dock_widget_dock(sc_dock_widget+":dock", CTRL_ALT+Qt::Key_D)
const sc_pref sc_dock_widget_close(sc_dock_widget+":close", CTRL_ALT+Qt::Key_C)
F77_RET_T const F77_DBLE * x
std::complex< double > w(std::complex< double > z, double relerr=0)
static QString qdockwidget_css(const QString &close_icon, const QString &close_tooltip, const QString &float_icon, const QString &float_tooltip, int icon_size, const QString &titlebar_foreground, const QString &titlebar_background)
const QString key
const QVariant def