Commit 45f88cca authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix docked widgets losing title and decoration when undocked

parent f3686053
...@@ -277,7 +277,7 @@ void MainWindow::init() ...@@ -277,7 +277,7 @@ void MainWindow::init()
m_timelineTabs = new TimelineTabs(this); m_timelineTabs = new TimelineTabs(this);
ctnLay->addWidget(m_timelineTabs); ctnLay->addWidget(m_timelineTabs);
// Screen grab widget // Screen grab widget
QWidget *grabWidget = new QWidget(this); QWidget *grabWidget = new QWidget(this);
QVBoxLayout *grabLayout = new QVBoxLayout; QVBoxLayout *grabLayout = new QVBoxLayout;
...@@ -3388,17 +3388,20 @@ QDockWidget *MainWindow::addDock(const QString &title, const QString &objectName ...@@ -3388,17 +3388,20 @@ QDockWidget *MainWindow::addDock(const QString &title, const QString &objectName
dockWidget->setObjectName(objectName); dockWidget->setObjectName(objectName);
dockWidget->setWidget(widget); dockWidget->setWidget(widget);
addDockWidget(area, dockWidget); addDockWidget(area, dockWidget);
connect(dockWidget, &QDockWidget::dockLocationChanged, this, [this](Qt::DockWidgetArea dockLocationArea) { connect(dockWidget, &QDockWidget::dockLocationChanged, this, &MainWindow::slotUpdateDockLocation);
if (dockLocationArea == Qt::NoDockWidgetArea) {
updateDockTitleBars(false);
} else {
updateDockTitleBars(true);
}
});
connect(dockWidget, &QDockWidget::topLevelChanged, this, &MainWindow::updateDockTitleBars); connect(dockWidget, &QDockWidget::topLevelChanged, this, &MainWindow::updateDockTitleBars);
return dockWidget; return dockWidget;
} }
void MainWindow::slotUpdateDockLocation(Qt::DockWidgetArea dockLocationArea)
{
if (dockLocationArea == Qt::NoDockWidgetArea) {
updateDockTitleBars(false);
} else {
updateDockTitleBars(true);
}
}
void MainWindow::slotUpdateMonitorOverlays(int id, int code) void MainWindow::slotUpdateMonitorOverlays(int id, int code)
{ {
QMenu *monitorOverlay = static_cast<QMenu *>(factory()->container(QStringLiteral("monitor_config_overlay"), this)); QMenu *monitorOverlay = static_cast<QMenu *>(factory()->container(QStringLiteral("monitor_config_overlay"), this));
...@@ -3453,11 +3456,13 @@ void MainWindow::updateDockTitleBars(bool isTopLevel) ...@@ -3453,11 +3456,13 @@ void MainWindow::updateDockTitleBars(bool isTopLevel)
if (!KdenliveSettings::showtitlebars() || !isTopLevel) { if (!KdenliveSettings::showtitlebars() || !isTopLevel) {
return; 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) { for (int i = 0; i < docks.count(); ++i) {
QDockWidget *dock = docks.at(i); QDockWidget *dock = docks.at(i);
QWidget *bar = dock->titleBarWidget(); QWidget *bar = dock->titleBarWidget();
if (dock->isFloating()) { if (dock->isFloating()) {
//qDebug()<<"==== FOUND FLOATING: "<<dock->objectName();
if (bar) { if (bar) {
dock->setTitleBarWidget(nullptr); dock->setTitleBarWidget(nullptr);
delete bar; delete bar;
......
...@@ -286,6 +286,8 @@ private slots: ...@@ -286,6 +286,8 @@ private slots:
/** @brief Shows the shortcut dialog. */ /** @brief Shows the shortcut dialog. */
void slotEditKeys(); void slotEditKeys();
void loadDockActions(); 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. */ /** @brief Reflects setting changes to the GUI. */
void updateConfiguration(); void updateConfiguration();
void slotConnectMonitors(); 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