Fix dock widget title bar inconsistencies

CCBUG: 365330
parent f73c65b5
......@@ -23,9 +23,6 @@ HideTitleBars::HideTitleBars(QObject* parent) :
m_switchAction->setChecked(KdenliveSettings::showtitlebars());
pCore->window()->addAction(QStringLiteral("show_titlebars"), m_switchAction);
connect(m_switchAction, SIGNAL(triggered(bool)), SLOT(slotShowTitleBars(bool)));
slotShowTitleBars(KdenliveSettings::showtitlebars());
connect(pCore->window(), SIGNAL(GUISetupDone()), SLOT(slotInstallRightClick()));
}
......@@ -36,17 +33,16 @@ void HideTitleBars::slotInstallRightClick()
tabs.at(i)->setContextMenuPolicy(Qt::CustomContextMenu);
connect(tabs.at(i), SIGNAL(customContextMenuRequested(QPoint)), SLOT(slotSwitchTitleBars()));
}
pCore->window()->updateDockTitleBars();
slotShowTitleBars(KdenliveSettings::showtitlebars());
}
void HideTitleBars::slotShowTitleBars(bool show)
{
return;
QList <QDockWidget *> docks = pCore->window()->findChildren<QDockWidget *>();
for (int i = 0; i < docks.count(); ++i) {
QDockWidget* dock = docks.at(i);
QWidget *bar = dock->titleBarWidget();
if (show) {
QWidget *bar = dock->titleBarWidget();
if (dock->isFloating()) {
if (bar) {
dock->setTitleBarWidget(0);
......@@ -90,7 +86,7 @@ void HideTitleBars::slotShowTitleBars(bool show)
}
#endif
} else {
if (!dock->isFloating() && !dock->titleBarWidget()) {
if (!dock->isFloating() && !bar) {
dock->setTitleBarWidget(new QWidget);
}
}
......
......@@ -647,9 +647,9 @@ MainWindow::MainWindow(const QString &MltPath, const QUrl &Url, const QString &
KdenliveSettings::setDecklink_extension(data.section(';', 1, 1));
}
}
emit GUISetupDone();
pCore->projectManager()->init(Url, clipsToLoad);
QTimer::singleShot(0, pCore->projectManager(), SLOT(slotLoadOnOpen()));
QTimer::singleShot(0, this, SIGNAL(GUISetupDone()));
connect(this, SIGNAL(reloadTheme()), this, SLOT(slotReloadTheme()), Qt::UniqueConnection);
#ifdef USE_JOGSHUTTLE
......@@ -3522,6 +3522,7 @@ QDockWidget *MainWindow::addDock(const QString &title, const QString &objectName
dockWidget->setWidget(widget);
addDockWidget(area, dockWidget);
connect(dockWidget, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(updateDockTitleBars()));
connect(dockWidget, SIGNAL(topLevelChanged(bool)), this, SLOT(updateDockTitleBars(bool)));
return dockWidget;
}
......@@ -3567,8 +3568,10 @@ bool MainWindow::isTabbedWith(QDockWidget *widget, const QString & otherWidget)
return false;
}
void MainWindow::updateDockTitleBars()
void MainWindow::updateDockTitleBars(bool isTopLevel)
{
if (!KdenliveSettings::showtitlebars() || !isTopLevel)
return;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
QList <QDockWidget *> docks = pCore->window()->findChildren<QDockWidget *>();
for (int i = 0; i < docks.count(); ++i) {
......
......@@ -258,7 +258,7 @@ public slots:
void slotTimelineClipSelected(ClipItem* item, bool reloadStack = true, bool raise = true);
/** @brief Reload project profile in config dialog if changed. */
void slotRefreshProfiles();
void updateDockTitleBars();
void updateDockTitleBars(bool isTopLevel = true);
void configureToolbars();
private slots:
......
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