Fix docked widgets losing title and decoration when undocked

parent f3686053
......@@ -277,7 +277,7 @@ void MainWindow::init()
m_timelineTabs = new TimelineTabs(this);
ctnLay->addWidget(m_timelineTabs);
// Screen grab widget
QWidget *grabWidget = new QWidget(this);
QVBoxLayout *grabLayout = new QVBoxLayout;
......@@ -3388,17 +3388,20 @@ QDockWidget *MainWindow::addDock(const QString &title, const QString &objectName
dockWidget->setObjectName(objectName);
dockWidget->setWidget(widget);
addDockWidget(area, dockWidget);
connect(dockWidget, &QDockWidget::dockLocationChanged, this, [this](Qt::DockWidgetArea dockLocationArea) {
if (dockLocationArea == Qt::NoDockWidgetArea) {
updateDockTitleBars(false);
} else {
updateDockTitleBars(true);
}
});
connect(dockWidget, &QDockWidget::dockLocationChanged, this, &MainWindow::slotUpdateDockLocation);
connect(dockWidget, &QDockWidget::topLevelChanged, this, &MainWindow::updateDockTitleBars);
return dockWidget;
}
void MainWindow::slotUpdateDockLocation(Qt::DockWidgetArea dockLocationArea)
{
if (dockLocationArea == Qt::NoDockWidgetArea) {
updateDockTitleBars(false);
} else {
updateDockTitleBars(true);
}
}
void MainWindow::slotUpdateMonitorOverlays(int id, int code)
{
QMenu *monitorOverlay = static_cast<QMenu *>(factory()->container(QStringLiteral("monitor_config_overlay"), this));
......@@ -3453,11 +3456,13 @@ void MainWindow::updateDockTitleBars(bool isTopLevel)
if (!KdenliveSettings::showtitlebars() || !isTopLevel) {
return;
}
QList<QDockWidget *> docks = pCore->window()->findChildren<QDockWidget *>();
QList<QDockWidget *> docks = findChildren<QDockWidget *>();
//qDebug()<<"=== FOUND DOCKS: "<<docks.count();
for (int i = 0; i < docks.count(); ++i) {
QDockWidget *dock = docks.at(i);
QWidget *bar = dock->titleBarWidget();
if (dock->isFloating()) {
//qDebug()<<"==== FOUND FLOATING: "<<dock->objectName();
if (bar) {
dock->setTitleBarWidget(nullptr);
delete bar;
......
......@@ -286,6 +286,8 @@ private slots:
/** @brief Shows the shortcut dialog. */
void slotEditKeys();
void loadDockActions();
/** @brief Add/remove Dock tile bar depending on state (tabbed, floating, ...) */
void slotUpdateDockLocation(Qt::DockWidgetArea dockLocationArea);
/** @brief Reflects setting changes to the GUI. */
void updateConfiguration();
void slotConnectMonitors();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment