diff libgui/src/octave-dock-widget.cc @ 24858:8ce66fe46f18

Improve fullscreen action for variable editor panes (bug #53275) * octave-dock-widget.cc (label_dock_widget::label_dock_widget): Make m_title_widget the parent of all items placed in the h_layout QHBoxLayout. * variable-editor.cc (variable_dock_widget::variable_dock_widget): Replace member variable m_initial_float with variables m_fullscreen_action, m_full_screen, m_prev_floating. All is pre-processor-conditioned on HAVE_QGUIAPPLICATION. (variable_dock_widget::change_floating): Set the full-screen action tooltip to "Fullscreen" if undocking. If docking, change full-screen action tooltip to "Fullscreen undock" and if in full screen mode restore the non-full-screen size and QAction icon. All is pre-processor-conditioned on HAVE_QGUIAPPLICATION. (variable_dock_widget::toplevel_change): Remove the code that made the initial floating size full screen. (variable_dock_widget::change_fullscreen): New slot/method to undock a panel if it is docked and then set the panel size to fullscreen as well as change the QAction icon to view-restore and if the panel was not undocked set the QAction tooltip to "Restore geometry". If in fullscreen mode, change back to the state, icon and tooltips prior to fullscreen mode. The inside of the function is pre-processor-conditioned on HAVE_QGUIAPPLICATION. * variable-editor.h (variable_dock_widget): Declare new slot change_fullscreen(). Replace member variable m_initial_float with m_fullscreen_action, m_full_screen, m_prev_floating and m_prev_geom. Place just the variables and not the slot within pre-processor-condition of HAVE_QGUIAPPLICATION.
author Daniel J Sebald <daniel.sebald@ieee.org>
date Mon, 05 Mar 2018 22:11:33 -0600
parents 74229798f604
children 5f7b9ee5b878
line wrap: on
line diff
--- a/libgui/src/octave-dock-widget.cc	Fri Mar 09 17:19:15 2018 -0800
+++ b/libgui/src/octave-dock-widget.cc	Mon Mar 05 22:11:33 2018 -0600
@@ -45,10 +45,12 @@
     m_icon_size = 0.75*st->pixelMetric (QStyle::PM_SmallIconSize);
 
     // the custom (extra) title bar of the widget
+    m_title_widget = new QWidget ();
+
     m_dock_action = new QAction
       (QIcon (":/actions/icons/widget-undock.png"), "", this);
     m_dock_action->setToolTip (tr ("Undock widget"));
-    m_dock_button = new QToolButton (this);
+    m_dock_button = new QToolButton (m_title_widget);
     m_dock_button->setDefaultAction (m_dock_action);
     m_dock_button->setFocusPolicy (Qt::NoFocus);
     m_dock_button->setIconSize (QSize (m_icon_size,m_icon_size));
@@ -56,7 +58,7 @@
     m_close_action = new QAction
       (QIcon (":/actions/icons/widget-close.png"), "", this);
     m_close_action->setToolTip (tr ("Close widget"));
-    m_close_button = new QToolButton (this);
+    m_close_button = new QToolButton (m_title_widget);
     m_close_button->setDefaultAction (m_close_action);
     m_close_button->setFocusPolicy (Qt::NoFocus);
     m_close_button->setIconSize (QSize (m_icon_size,m_icon_size));
@@ -72,7 +74,6 @@
     h_layout->setSpacing (0);
     h_layout->setContentsMargins (5,2,2,2);
 
-    m_title_widget = new QWidget ();
     m_title_widget->setLayout (h_layout);
     setTitleBarWidget (m_title_widget);
 
@@ -93,7 +94,7 @@
   {
     QHBoxLayout *h_layout
       = static_cast<QHBoxLayout *> (titleBarWidget ()->layout ());
-    QLabel *label = new QLabel (title);
+    QLabel *label = new QLabel (title, titleBarWidget ());
     label->setStyleSheet ("background: transparent;");
     h_layout->insertWidget (0,label);
     setWindowTitle (title);