GNU Octave  6.2.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-2021 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"
40 #include "gui-preferences-global.h"
41 #include "gui-preferences-mw.h"
42 #include "gui-preferences-sc.h"
43 #include "gui-settings.h"
44 #include "octave-dock-widget.h"
45 #include "octave-qobject.h"
46 
47 namespace octave
48 {
50  : QDockWidget (p), m_octave_qobj (oct_qobj),
51  m_default_float_button (nullptr), m_default_close_button (nullptr)
52  {
53  QStyle *st = style ();
54  m_icon_size = 0.75*st->pixelMetric (QStyle::PM_SmallIconSize);
55 
56  // keep track of the original buttons on the default title bar,
57  // the button further left is considered "float"
58  QList<QAbstractButton *> buttonlist = findChildren<QAbstractButton *> ();
59  if (buttonlist.size () == 2)
60  {
61  if (buttonlist.at (0)->x () < buttonlist.at (1)->x ())
62  {
63  m_default_float_button = buttonlist.at (0);
64  m_default_close_button = buttonlist.at (1);
65  }
66  else
67  {
68  m_default_float_button = buttonlist.at (1);
69  m_default_close_button = buttonlist.at (0);
70  }
71  }
72 
73  // the custom (extra) title bar of the widget
74  m_title_widget = new QWidget ();
75 
76  m_dock_action = new QAction
77  (QIcon (":/actions/icons/widget-undock.png"), "", this);
78  m_dock_action->setToolTip (tr ("Undock widget"));
80  m_dock_button->setDefaultAction (m_dock_action);
81  m_dock_button->setFocusPolicy (Qt::NoFocus);
82  m_dock_button->setIconSize (QSize (m_icon_size,m_icon_size));
83 
84  m_close_action = new QAction
85  (QIcon (":/actions/icons/widget-close.png"), "", this);
86  m_close_action->setToolTip (tr ("Close widget"));
88  m_close_button->setDefaultAction (m_close_action);
89  m_close_button->setFocusPolicy (Qt::NoFocus);
90  m_close_button->setIconSize (QSize (m_icon_size,m_icon_size));
91 
92  QString css_button = QString ("QToolButton {background: transparent; border: 0px;}");
93  m_dock_button->setStyleSheet (css_button);
94  m_close_button->setStyleSheet (css_button);
95 
96  QHBoxLayout *h_layout = new QHBoxLayout ();
97  h_layout->addStretch (100);
98  h_layout->addWidget (m_dock_button);
99  h_layout->addWidget (m_close_button);
100  h_layout->setSpacing (10);
101  h_layout->setContentsMargins (5,2,2,2);
102 
103  m_title_widget->setLayout (h_layout);
104 
105  // copy & paste handling
106  connect (p, SIGNAL (copyClipboard_signal ()),
107  this, SLOT (copyClipboard ()));
108  connect (p, SIGNAL (pasteClipboard_signal ()),
109  this, SLOT (pasteClipboard ()));
110  connect (p, SIGNAL (selectAll_signal ()),
111  this, SLOT (selectAll ()));
112 
113  // undo handling
114  connect (p, SIGNAL (undo_signal ()), this, SLOT (do_undo ()));
115  }
116 
117  // set the title in the dockwidgets title bar
118  void
119  label_dock_widget::set_title (const QString& title)
120  {
121  QHBoxLayout *h_layout
122  = static_cast<QHBoxLayout *> (m_title_widget->layout ());
123  QLabel *label = new QLabel (title, m_title_widget);
124  label->setStyleSheet ("background-color: transparent;");
125  h_layout->insertWidget (0,label);
126  setTitleBarWidget (m_title_widget);
127  setWindowTitle (title);
128  }
129 
130 
131  static QString
132  qdockwidget_css (const QString& close_icon, const QString& close_tooltip,
133  const QString& float_icon, const QString& float_tooltip,
134  int icon_size, const QString& titlebar_foreground,
135  const QString& titlebar_background)
136  {
137  return QString ("QDockWidget\n"
138  "{\n"
139  "%6"
140  " border: none;\n"
141  " titlebar-close-icon: url(%1);\n"
142  " titlebar-normal-icon: url(%2);\n"
143  "}\n"
144  "\n"
145  "QDockWidget::close-button, QDockWidget::float-button\n"
146  "{\n"
147  " border: none;\n"
148  " icon-size: %3px;\n"
149  "}\n"
150  "\n"
151  "QAbstractButton#qt_dockwidget_closebutton\n"
152  "{\n"
153  " qproperty-toolTip: \"%4\";\n"
154  "}\n"
155  "\n"
156  "QAbstractButton#qt_dockwidget_floatbutton\n"
157  "{\n"
158  " qproperty-toolTip: \"%5\";\n"
159  "}\n"
160  "\n"
161  "QDockWidget::title {\n"
162  " text-align: left;\n"
163  "%7"
164  " padding-left: 1px;\n"
165  "}\n"
166  "\n"
167  "QDockWidget::close-button\n"
168  "{\n"
169  " right: %8px;\n"
170  " top: 3px;\n"
171  "}\n"
172  "\n"
173  "QDockWidget::float-button\n"
174  "{\n"
175  " right: %9px;\n"
176  " top: 3px;\n"
177  "}\n"
178  ).arg (close_icon).arg (float_icon).arg (icon_size)
179  .arg (close_tooltip).arg (float_tooltip)
180  .arg (titlebar_foreground).arg (titlebar_background)
181  .arg ((icon_size*2)/3).arg((icon_size*7)/3);
182  }
183 
184  octave_dock_widget::octave_dock_widget (const QString& obj_name, QWidget *p,
185  base_qobject& oct_qobj)
186  : label_dock_widget (p, oct_qobj), m_recent_float_geom (),
187  m_recent_dock_geom (), m_waiting_for_mouse_button_release (false)
188  {
189  setObjectName (obj_name);
190 
191  m_parent = static_cast<QMainWindow *> (p); // store main window
192  m_predecessor_widget = nullptr;
193 
194  connect (this, SIGNAL (topLevelChanged (bool)),
195  this, SLOT (toplevel_change (bool)));
196  connect (this, SIGNAL (visibilityChanged (bool)),
197  this, SLOT (handle_visibility_changed (bool)));
198 
199  connect (p, SIGNAL (settings_changed (const gui_settings *)),
200  this, SLOT (handle_settings (const gui_settings *)));
201 
202  connect (p, SIGNAL (active_dock_changed (octave_dock_widget*,
205  octave_dock_widget*)));
206 
207  if (m_default_float_button != nullptr)
208  {
209  disconnect (m_default_float_button, 0, 0, 0);
210  connect (m_default_float_button, SIGNAL (clicked (bool)),
211  this, SLOT (make_window (bool)));
212  }
213  connect (this, SIGNAL (queue_make_window (bool)),
214  this, SLOT (make_window (bool)), Qt::QueuedConnection);
215  connect (this, SIGNAL (queue_make_widget ()),
216  this, SLOT (make_widget ()), Qt::QueuedConnection);
217 
220  m_dock_action->setShortcutContext (Qt::WidgetWithChildrenShortcut);
221  addAction (m_dock_action);
222  connect (m_dock_action, SIGNAL (triggered (bool)),
223  this, SLOT (make_window (bool)));
224 
226  m_close_action->setShortcutContext (Qt::WidgetWithChildrenShortcut);
227  addAction (m_close_action);
228  connect (m_close_action, SIGNAL (triggered (bool)),
229  this, SLOT (change_visibility (bool)));
230 
231  // Any interpreter_event signal from an octave_dock_widget object is
232  // handled the same as for the parent main_window object.
233 
234  connect (this, SIGNAL (interpreter_event (const fcn_callback&)),
235  p, SIGNAL (interpreter_event (const fcn_callback&)));
236 
237  connect (this, SIGNAL (interpreter_event (const meth_callback&)),
238  p, SIGNAL (interpreter_event (const meth_callback&)));
239 
240  m_close_action->setToolTip (tr ("Hide widget"));
241 
242  setStyleSheet (qdockwidget_css (QString (":/actions/icons/widget-close.png"),
243  QString ("Close widget"),
244  QString (":/actions/icons/widget-undock.png"),
245  QString ("Undock widget"),
246  m_icon_size,
247  QString (""),
248  QString ("")));
249  if (widget ())
250  widget ()->setToolTip (QString (""));
251 
252  m_icon_color = "";
253  m_title_3d = 50;
254 
255  installEventFilter (this);
256 
257  setFocusPolicy (Qt::StrongFocus);
258 
259  setFeatures (QDockWidget::AllDockWidgetFeatures);
260 
262  handle_settings (rmgr.get_settings ());
263  }
264 
265  // connect signal visibility changed to related slot (called from main-window)
266  void
268  {
269  connect (this, SIGNAL (visibilityChanged (bool)),
270  this, SLOT (handle_visibility (bool)));
271  emit active_changed (isVisible ()); // emit once for init of window menu
272  }
273 
274  // make the widget floating
275  void
276  octave_dock_widget::make_window (bool widget_was_dragged)
277  {
278  bool vis = isVisible ();
279 
280  // prevent follow-up calls by clearing state variable
282 
283  set_focus_predecessor (); // set focus previously active widget if tabbed
284 
285  // Before unparenting, get current geometry for restoring if dragged
286  QRect geom = geometry ();
287 
288  // the widget has to be reparented (parent = 0), preferably
289  // from a non-toplevel widget otherwise may not have full
290  // decorations, e.g., no taskbar icon and always in front
291  if (isFloating ())
292  setFloating (false);
293 
294  // Before making it a separate (no more parent) floating widget, remove
295  // the dock widget from the main window. This ensures that tabbed widgets
296  // keep their focus when it is re-docked later
297  m_parent->removeDockWidget (this);
298 
299  setParent (0, Qt::CustomizeWindowHint | Qt::WindowTitleHint |
300  Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint | Qt::Window);
301 
302  // restore the last geometry when floating only if we have not dragged
303  // the window outside the main window
304  if (! widget_was_dragged)
305  geom = m_recent_float_geom.isNull () ? QRect (50,100,480,480)
307  setGeometry (geom);
308 
309  // adjust the (un)dock action
310  disconnect (m_dock_action, 0, this, 0);
311  connect (m_dock_action, SIGNAL (triggered (bool)),
312  this, SLOT (make_widget (bool)));
313 
314  // adjust the (un)dock icon
315  if (titleBarWidget ())
316  {
317  m_dock_action->setIcon (QIcon (":/actions/icons/widget-dock"
318  + m_icon_color + ".png"));
319  m_dock_action->setToolTip (tr ("Dock widget"));
320  }
321  else
322  {
323  disconnect (m_default_float_button, 0, this, 0);
324  connect (m_default_float_button, SIGNAL (clicked (bool)),
325  this, SLOT (make_widget (bool)));
326  }
327 
328  raise ();
329  activateWindow ();
330 
331  if (vis)
332  {
333  show ();
334  setFocus ();
335  set_style (true);
336  }
337 
338  emit topLevelChanged (true); // Be sure signal is emitted
339  }
340 
341  // dock the widget
342  void
344  {
345  bool vis = isVisible ();
346 
347  // Since floating widget has no parent, we have to read it
350 
351  settings->setValue (mw_state.key, m_parent->saveState ());
352  // Stay window, otherwise will bounce back to window by default because
353  // there is no layout information for this widget in the saved settings.
354  setParent (m_parent, Qt::Window);
355  m_parent->addDockWidget (Qt::BottomDockWidgetArea, this);
356  // recover old window states, hide and re-show new added widget
357  m_parent->restoreState (settings->value (mw_state.key).toByteArray ());
358  setFloating (false);
359  // restore size using setGeometry instead of restoreGeometry following
360  // 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  // adjust the (un)dock icon
365  connect (m_dock_action, SIGNAL (triggered (bool)),
366  this, SLOT (make_window (bool)));
367  if (titleBarWidget ())
368  {
369  m_dock_action->setIcon (QIcon (":/actions/icons/widget-undock"
370  + m_icon_color + ".png"));
371  m_dock_action->setToolTip (tr ("Undock widget"));
372  }
373  else
374  {
375  disconnect (m_default_float_button, 0, this, 0);
376  connect (m_default_float_button, SIGNAL (clicked (bool)),
377  this, SLOT (make_window (bool)));
378  }
379 
380  raise ();
381  QApplication::setActiveWindow (this);
382 
383  if (vis)
384  {
385  show ();
386  setFocus ();
387  set_style (true);
388  }
389  }
390 
391  // dock the widget
392  void
394  {
395  setFloating (false);
396  }
397 
398  // set the widget which previously had focus when tabified
399  void
401  {
402  m_predecessor_widget = prev_widget;
403  }
404 
405  // close event
406  void
408  {
409  emit active_changed (false);
411  save_settings ();
412 
413  QDockWidget::closeEvent (e);
414  }
415 
416  // get focus widget
417  QWidget *
419  {
420  QWidget *w = QApplication::focusWidget ();
421  if (w && w->focusProxy ()) w = w->focusProxy ();
422  return w;
423  }
424 
425  bool
427  {
428  // low-level check of whether docked-widget became a window via
429  // double-click or via drag-and-drop
430  if ( (event->type () == QEvent::MouseButtonDblClick && ! isFloating ())
431  || (event->type () == QEvent::ActivationChange
433  {
434  bool retval = QDockWidget::event (event);
435  if (isFloating () && parent () != 0)
436  {
438  emit queue_make_window (event->type () != QEvent::MouseButtonDblClick);
439  }
440  return retval;
441  }
442 
443  return QDockWidget::event (event);
444  }
445 
446  void
448  {
450  = settings->value (dw_title_custom_style).toBool ();
451 
452  m_title_3d = settings->value (dw_title_3d.key, dw_title_3d.def).toInt ();
453 
454  m_fg_color
455  = settings->value (dw_title_fg_color).value<QColor> ();
456 
458  = settings->value (dw_title_fg_color_active).value<QColor> ();
459 
460  m_bg_color = settings->value (dw_title_bg_color).value<QColor> ();
461 
463  = settings->value (dw_title_bg_color_active).value<QColor> ();
464 
465  QColor bcol (m_bg_color);
466  QColor bcola (m_bg_color_active);
467 
468  if (! m_custom_style)
469  {
470  bcol = QWidget::palette ().color (m_title_widget->backgroundRole ());
471  bcola = bcol;
472  }
473 
474  int r, g, b;
475  bcol.getRgb (&r, &g, &b);
476  if (r+g+b < 400)
477  m_icon_color = "-light";
478  else
479  m_icon_color = "";
480 
481  bcola.getRgb (&r, &g, &b);
482  if (r+g+b < 400)
483  m_icon_color_active = "-light";
484  else
485  m_icon_color_active = "";
486 
487  QRect available_size = QApplication::desktop ()->availableGeometry (m_parent);
488  int x, y, w, h;
489  available_size.getRect (&x, &y, &w, &h);
490  QRect default_floating_size = QRect (x+16, y+32, w/3, h/2);
491  m_parent->geometry ().getRect (&x, &y, &w, &h);
492  QRect default_dock_size = QRect (x+16, y+32, w/3, h/3);
493 
495  = settings->value (dw_float_geometry.key.arg (objectName ()),
496  default_floating_size).toRect ();
497 
498  QWidget dummy;
499  dummy.setGeometry (m_recent_float_geom);
500 
501  if (QApplication::desktop ()->screenNumber (&dummy) == -1)
502  m_recent_float_geom = default_floating_size;
503 
504  // The following is required for ensure smooth transition from old
505  // saveGeomety to new QRect setting (see comment for restoring size
506  // of docked widgets)
507  QVariant dock_geom
508  = settings->value (dw_dock_geometry.key.arg (objectName ()),
509  default_dock_size);
510 #if defined (QVARIANT_CANCONVERT_ACCEPTS_QMETATYPE_TYPE)
511  QMetaType::Type rect_type = QMetaType::QRect;
512 #else
513  QVariant::Type rect_type = QVariant::Rect;
514 #endif
515  if (dock_geom.canConvert (rect_type))
516  m_recent_dock_geom = dock_geom.toRect ();
517  else
519 
520  notice_settings (settings); // call individual handler
521 
522  set_style (false);
523 
524  // Compacter design
525  QToolBar* toolbar = findChild <QToolBar *> ();
526  if (toolbar)
527  toolbar->setStyleSheet (toolbar->styleSheet () + global_toolbar_style);
528 
529  QMenuBar* menubar = findChild <QMenuBar *> ();
530  if (menubar)
531  menubar->setStyleSheet (menubar->styleSheet () + global_menubar_style);
532 
533  }
534 
535  void
537  octave_dock_widget *w_new)
538  {
539  if (m_custom_style && this == w_old)
540  {
541  set_style (false);
542  update ();
543  }
544 
545  if (m_custom_style && this == w_new)
546  {
547  set_style (true);
548  update ();
549  }
550  }
551 
552  void
554  {
555  // save state of this dock-widget
556  QString name = objectName ();
559 
560  if (! settings)
561  return;
562 
563  store_geometry ();
564 
565  // conditional needed?
566  if (! m_recent_float_geom.isNull ())
568 
569  if (! m_recent_dock_geom.isEmpty ())
571  settings->setValue (dw_is_visible.key.arg (name), isVisible ()); // store visibility
572  settings->setValue (dw_is_floating.key.arg (name), isFloating ()); // store floating
573  settings->setValue (dw_is_minimized.key.arg (name), isMinimized ()); // store minimized
574 
575  settings->sync ();
576  }
577 
579  {
580  if (e->type () == QEvent::NonClientAreaMouseButtonDblClick)
581  {
582  e->ignore (); // ignore double clicks into window decoration elements
583  return true;
584  }
585 
586  return QDockWidget::eventFilter (obj,e);
587  }
588 
589  void
591  {
592  if (isFloating ())
593  {
594  if (! parent ())
595  m_recent_float_geom = geometry ();
596  }
597  else
598  {
599  m_recent_dock_geom = geometry ();
600  }
601  }
602 
603  void
604  octave_dock_widget::moveEvent (QMoveEvent *event)
605  {
606  store_geometry ();
607 
608  QDockWidget::moveEvent (event);
609  }
610 
611  void
612  octave_dock_widget::resizeEvent (QResizeEvent *event)
613  {
614  store_geometry ();
615 
616  QDockWidget::resizeEvent (event);
617  }
618 
619  // slot for hiding the widget
620  void
622  {
623  setVisible (false);
624  emit active_changed (false);
625  }
626 
628  {
629  if (! isVisible ())
630  setVisible (true);
631 
632  setFocus ();
633  activateWindow ();
634  raise ();
635  }
636 
638  {
639  if (visible && ! isFloating ())
640  setFocus ();
641  }
642 
643  void
645  {
646  QObject *dockobj;
647  const char *docksig;
648 
649  if (titleBarWidget ())
650  {
651  dockobj = m_dock_action;
652  docksig = SIGNAL (triggered (bool));
653  }
654  else
655  {
656  dockobj = m_default_float_button;
657  docksig = SIGNAL (clicked (bool));
658  }
659 
660  if (toplevel)
661  {
662  // This is a fallback in case the attempt to create a floated
663  // top-level window fails and the QDockWidget remains a child
664  // of the QMainWindow.
665  connect (dockobj, docksig, this, SLOT (default_dock (bool)));
666 
667  // Could be dragging window, so must wait until there is a
668  // change in focus.
669  if (parent () != 0)
671  }
672  else
673  {
674  // If a drag-and-drop within the QMainWindow occurred, want to remain a widget.
676 
677  // Making into a widget immediately will mangle the double-click
678  // status and cause problems on followup button clicks.
679  if (parent () == 0)
680  emit queue_make_widget ();
681  }
682  }
683 
684  void
686  {
687  QString css_foreground;
688  QString css_background;
689  QString css_button;
690  QString dock_icon;
691 
692  QString icon_col = m_icon_color;
693 
694  QString close_tooltip = "Close widget";
695  QString dock_tooltip;
696 
697  if (isFloating ())
698  {
699  dock_icon = "widget-dock";
700  dock_tooltip = "Dock widget";
701  }
702  else
703  {
704  dock_icon = "widget-undock";
705  dock_tooltip = "Undock widget";
706  }
707 
708 #if defined (Q_OS_MAC)
709  QString alignment = "center";
710 #else
711  QString alignment = "center left";
712 #endif
713  if (m_custom_style)
714  {
715 
716  QColor bg_col, fg_col;
717 
718  if (active)
719  {
720  bg_col = m_bg_color_active;
721  fg_col = m_fg_color_active;
722  icon_col = m_icon_color_active;
723  }
724  else
725  {
726  bg_col = m_bg_color;
727  fg_col = m_fg_color;
728  icon_col = m_icon_color;
729  }
730 
731  QColor bg_col_top, bg_col_bottom;
732  if (m_title_3d > 0)
733  {
734  bg_col_top = bg_col.lighter (100 + m_title_3d);
735  bg_col_bottom = bg_col.darker (100 + m_title_3d);
736  }
737  else
738  {
739  bg_col_top = bg_col.darker (100 - m_title_3d);
740  bg_col_bottom = bg_col.lighter (100 - m_title_3d);
741  }
742 
743  css_foreground = QString (" color: %1;\n").arg (fg_col.name ());
744 
745  css_background =
746  QString (" background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,"
747  " stop: 0 %1, stop: 0.60 %2, stop: 0.95 %2 stop: 1.0 %3);\n").
748  arg (bg_col_top.name ()).
749  arg (bg_col.name ()).
750  arg (bg_col_bottom.name ());
751  }
752  else
753  {
754  css_foreground = QString ("");
755  css_background = QString ("");
756  }
757 
758  QString full_dock_icon = ":/actions/icons/" + dock_icon + icon_col + ".png";
759  QString full_close_icon = ":/actions/icons/widget-close" + icon_col + ".png";
760  if (titleBarWidget ())
761  {
762  titleBarWidget ()->setStyleSheet (css_foreground + css_background);
763  css_button = QString ("QToolButton {background: transparent; border: 0px;}");
764  m_dock_button->setStyleSheet (css_button);
765  m_close_button->setStyleSheet (css_button);
766  m_dock_action->setIcon (QIcon (full_dock_icon));
767  m_close_action->setIcon (QIcon (full_close_icon));
768  }
769  else
770  {
771  setStyleSheet (qdockwidget_css (full_close_icon,
772  close_tooltip,
773  full_dock_icon,
774  dock_tooltip,
775  m_icon_size,
776  css_foreground,
777  css_background));
778  }
779  }
780 
781  // set focus to previously active widget in tabbed widget stack
782  void
784  {
785  // only != 0 if widget was tabbed
786  if (m_predecessor_widget && m_predecessor_widget->isVisible ())
787  m_predecessor_widget->setFocus ();
788 
789  m_predecessor_widget = nullptr;
790 
791  // FIXME: Until cset bda0c5b38bda, the wrong keys "Dockwidget/..." were used
792  // here. This had no effect in Qt4, but does in Qt5. In the following, the
793  // four incorrect keys are updated if still present in the settings files.
794  // The keys are also used in the settings dialog, but
795  // octave_dock_widget::handle_settings is already called at program start.
796  // These tests can be removed in a future version of Octave (version 6).
797 
799 
800  rmgr.update_settings_key ("Dockwidgets/title_bg_color",
802 
803  rmgr.update_settings_key ("Dockwidgets/title_bg_color_active",
805 
806  rmgr.update_settings_key ("Dockwidgets/title_fg_color",
808 
809  rmgr.update_settings_key ("Dockwidgets/title_fg_color_active",
811  }
812 }
Base class for Octave interfaces that use Qt.
resource_manager & get_resource_manager(void)
shortcut_manager & get_shortcut_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 &)
void queue_make_window(bool widget_was_dragged)
void handle_settings(const gui_settings *)
void handle_active_dock_changed(octave_dock_widget *, octave_dock_widget *)
QMainWindow * m_parent
Stores the parent, since we are reparenting to 0.
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.
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.
virtual void handle_visibility_changed(bool visible)
Slot to steer changing visibility from outside.
void resizeEvent(QResizeEvent *event)
void moveEvent(QMoveEvent *event)
virtual void closeEvent(QCloseEvent *e)
void interpreter_event(const fcn_callback &fcn)
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 connect_visibility_changed(void)
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)
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_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_toolbar_style("QToolBar {" "spacing-top: 0px;" "spacing-bottom: 0px;" "margin-top: 0px;" "margin-bottom: 0px;" "padding-top: 0px;" "padding-bottom: 0px;" "border-top: 0px;" "border-bottom: 0px;" "}")
const QString global_menubar_style("QMenuBar {" "spacing-top: 0px;" "spacing-bottom: 0px;" "margin-top: 0px;" "margin-bottom: 0px;" "padding-top: 0px;" "padding-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
T * r
Definition: mx-inlines.cc:773
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)
std::function< void(octave::interpreter &)> meth_callback
Definition: event-manager.h:47
std::function< void(void)> fcn_callback
Definition: event-manager.h:46
octave_value::octave_value(const Array< char > &chm, char type) return retval
Definition: ov.cc:811
const QString key
const QVariant def