Mercurial > octave
changeset 27936:106c8ba2f13c
Add shortcut keys for octave_dock_widget undock, dock and close (bug #54078)
* octave-dock-widget.cc (octave_dock_widget::octave_dock_widget): Supply a
CTRL+ALT+U shortcut key sequence to m_dock_action and add that action to
the label_dock_widget object with Qt::WidgetWithChildrenShortcut context.
Similarly, supply a CTRL+ALT+C shortcut for m_close_action and add to object.
(octave_dock_widget::make_window): Change the m_dock_action key sequence to
CTRL+ALT+D and move the disconnect/connect of new slot so that it is always
run rather than conditionally run.
(octave_dock_widget::make_window): Ditto, except change key sequence to
CTRL+ALT+U.
author | Daniel J Sebald <daniel.sebald@ieee.org> |
---|---|
date | Sun, 10 Jun 2018 01:40:36 -0500 |
parents | f1844e33f621 |
children | 8dc5b36f1245 |
files | libgui/src/octave-dock-widget.cc |
diffstat | 1 files changed, 14 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/octave-dock-widget.cc Sun Jan 12 09:33:21 2020 -0800 +++ b/libgui/src/octave-dock-widget.cc Sun Jun 10 01:40:36 2018 -0500 @@ -213,8 +213,14 @@ connect (this, SIGNAL (queue_make_widget ()), this, SLOT (make_widget ()), Qt::QueuedConnection); + m_dock_action->setShortcut (QKeySequence (Qt::CTRL + Qt::ALT + Qt::Key_U)); + m_dock_action->setShortcutContext (Qt::WidgetWithChildrenShortcut); + addAction (m_dock_action); connect (m_dock_action, SIGNAL (triggered (bool)), this, SLOT (make_window (bool))); + m_close_action->setShortcut (QKeySequence (Qt::CTRL + Qt::ALT + Qt::Key_C)); + m_close_action->setShortcutContext (Qt::WidgetWithChildrenShortcut); + addAction (m_close_action); connect (m_close_action, SIGNAL (triggered (bool)), this, SLOT (change_visibility (bool))); @@ -294,14 +300,15 @@ setGeometry (geom); // adjust the (un)dock icon + m_dock_action->setShortcut (QKeySequence (Qt::CTRL + Qt::ALT + Qt::Key_D)); + disconnect (m_dock_action, 0, this, 0); + connect (m_dock_action, SIGNAL (triggered (bool)), + this, SLOT (make_widget (bool))); if (titleBarWidget ()) { m_dock_action->setIcon (QIcon (":/actions/icons/widget-dock" + m_icon_color + ".png")); m_dock_action->setToolTip (tr ("Dock widget")); - disconnect (m_dock_action, 0, this, 0); - connect (m_dock_action, SIGNAL (triggered (bool)), - this, SLOT (make_widget (bool))); } else { @@ -343,14 +350,15 @@ setFloating (false); // adjust the (un)dock icon + m_dock_action->setShortcut (QKeySequence (Qt::CTRL + Qt::ALT + Qt::Key_U)); + m_dock_action->setShortcutContext (Qt::WidgetWithChildrenShortcut); + connect (m_dock_action, SIGNAL (triggered (bool)), + this, SLOT (make_window (bool))); if (titleBarWidget ()) { m_dock_action->setIcon (QIcon (":/actions/icons/widget-undock" + m_icon_color + ".png")); m_dock_action->setToolTip (tr ("Undock widget")); - disconnect (m_dock_action, 0, this, 0); - connect (m_dock_action, SIGNAL (triggered (bool)), - this, SLOT (make_window (bool))); } else {