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
4d5a3658
Commit
4d5a3658
authored
Feb 06, 2022
by
Jean-Baptiste Mardelle
Browse files
Don't update dock title bars several times on layout change
parent
a6b0ac90
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/docktitlebarmanager.cpp
View file @
4d5a3658
...
...
@@ -35,13 +35,23 @@ void DockTitleBarManager::slotInstallRightClick()
connect
(
tab
,
&
QWidget
::
customContextMenuRequested
,
this
,
&
DockTitleBarManager
::
slotSwitchTitleBars
);
}
connectDocks
(
true
);
slotUpdateTitleBars
();
}
void
DockTitleBarManager
::
connectDocks
(
bool
doConnect
)
{
// connect
QList
<
QDockWidget
*>
docks
=
pCore
->
window
()
->
findChildren
<
QDockWidget
*>
();
for
(
QDockWidget
*
dock
:
qAsConst
(
docks
))
{
connect
(
dock
,
&
QDockWidget
::
dockLocationChanged
,
this
,
&
DockTitleBarManager
::
slotUpdateDockLocation
);
connect
(
dock
,
&
QDockWidget
::
topLevelChanged
,
this
,
&
DockTitleBarManager
::
slotUpdateTitleBars
);
if
(
doConnect
)
{
connect
(
dock
,
&
QDockWidget
::
dockLocationChanged
,
this
,
&
DockTitleBarManager
::
slotUpdateDockLocation
);
connect
(
dock
,
&
QDockWidget
::
topLevelChanged
,
this
,
&
DockTitleBarManager
::
slotUpdateTitleBars
);
}
else
{
disconnect
(
dock
,
&
QDockWidget
::
dockLocationChanged
,
this
,
&
DockTitleBarManager
::
slotUpdateDockLocation
);
disconnect
(
dock
,
&
QDockWidget
::
topLevelChanged
,
this
,
&
DockTitleBarManager
::
slotUpdateTitleBars
);
}
}
slotUpdateTitleBars
();
}
void
DockTitleBarManager
::
slotUpdateDockLocation
(
Qt
::
DockWidgetArea
dockLocationArea
)
...
...
src/docktitlebarmanager.h
View file @
4d5a3658
...
...
@@ -25,6 +25,8 @@ public:
public
slots
:
/** @brief Correctly hide/show dock widget title bars depending on position (floating, tabbed, docked) */
void
slotUpdateTitleBars
(
bool
isTopLevel
=
true
);
/** @brief Connect/disconnect signals to update title bars on dock location changed */
void
connectDocks
(
bool
doConnect
);
private:
QAction
*
m_switchAction
;
...
...
src/layoutmanagement.cpp
View file @
4d5a3658
...
...
@@ -221,6 +221,7 @@ bool LayoutManagement::loadLayout(const QString &layoutId, bool selectButton)
// Error, layout not found
return
false
;
}
emit
connectDocks
(
false
);
QByteArray
state
=
QByteArray
::
fromBase64
(
layouts
.
readEntry
(
layoutId
).
toLatin1
());
bool
timelineVisible
=
true
;
if
(
state
.
startsWith
(
"NO-TL"
))
{
...
...
@@ -230,6 +231,7 @@ bool LayoutManagement::loadLayout(const QString &layoutId, bool selectButton)
pCore
->
window
()
->
centralWidget
()
->
setHidden
(
!
timelineVisible
);
pCore
->
window
()
->
processRestoreState
(
state
);
pCore
->
window
()
->
tabifyBins
();
emit
connectDocks
(
true
);
if
(
selectButton
)
{
// Activate layout button
QList
<
QAbstractButton
*>
buttons
=
m_containerGrp
->
buttons
();
...
...
src/layoutmanagement.h
View file @
4d5a3658
...
...
@@ -60,6 +60,8 @@ private:
signals:
/** @brief Layout changed, ensure title bars are correctly displayed. */
void
updateTitleBars
();
/** @brief Connect/disconnect stuff to update titlebars on dock location changed. */
void
connectDocks
(
bool
doConnect
);
};
#endif
src/mainwindow.cpp
View file @
4d5a3658
...
...
@@ -509,6 +509,7 @@ void MainWindow::init(const QString &mltPath)
auto
*
titleBars
=
new
DockTitleBarManager
(
this
);
connect
(
layoutManager
,
&
LayoutManagement
::
updateTitleBars
,
titleBars
,
[
&
]
()
{
titleBars
->
slotUpdateTitleBars
();
});
connect
(
layoutManager
,
&
LayoutManagement
::
connectDocks
,
titleBars
,
&
DockTitleBarManager
::
connectDocks
);
m_extraFactory
=
new
KXMLGUIClient
(
this
);
buildDynamicActions
();
...
...
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