Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Kdenlive
Commits
0a803427
Commit
0a803427
authored
May 17, 2021
by
Julius Künzel
Browse files
Add action to raise Dock Widgets (e.g. with a shortcut)
parent
460b92e7
Pipeline
#62202
passed with stage
in 9 minutes and 4 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/mainwindow.cpp
View file @
0a803427
...
...
@@ -3864,12 +3864,21 @@ void MainWindow::triggerKey(QKeyEvent *ev)
}
}
QDockWidget
*
MainWindow
::
addDock
(
const
QString
&
title
,
const
QString
&
objectName
,
QWidget
*
widget
,
Qt
::
DockWidgetArea
area
)
QDockWidget
*
MainWindow
::
addDock
(
const
QString
&
title
,
const
QString
&
objectName
,
QWidget
*
widget
,
Qt
::
DockWidgetArea
area
,
const
QKeySequence
&
shortcut
)
{
QDockWidget
*
dockWidget
=
new
QDockWidget
(
title
,
this
);
dockWidget
->
setObjectName
(
objectName
);
dockWidget
->
setWidget
(
widget
);
addDockWidget
(
area
,
dockWidget
);
// Add action to raise and focus the Dock (e.g. with a shortcut)
QAction
*
action
=
new
QAction
(
i18n
(
"Raise %1"
,
title
),
this
);
connect
(
action
,
&
QAction
::
triggered
,
this
,
[
dockWidget
](){
dockWidget
->
raise
();
dockWidget
->
setFocus
();
});
addAction
(
"raise_"
+
objectName
,
action
,
shortcut
);
return
dockWidget
;
}
...
...
src/mainwindow.h
View file @
0a803427
...
...
@@ -110,9 +110,10 @@ public:
* @param objectName objectName of the dock widget (required for storing layouts)
* @param widget widget to use in the dock
* @param area area to which the dock should be added to
* @param shortcut default shortcut to raise the dock
* @returns the created dock widget
*/
QDockWidget
*
addDock
(
const
QString
&
title
,
const
QString
&
objectName
,
QWidget
*
widget
,
Qt
::
DockWidgetArea
area
=
Qt
::
TopDockWidgetArea
);
QDockWidget
*
addDock
(
const
QString
&
title
,
const
QString
&
objectName
,
QWidget
*
widget
,
Qt
::
DockWidgetArea
area
=
Qt
::
TopDockWidgetArea
,
const
QKeySequence
&
shortcut
=
QKeySequence
()
);
QUndoGroup
*
m_commandStack
;
QUndoView
*
m_undoView
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment