fix EMainWindow

This commit is contained in:
2023-08-21 19:51:37 +03:00
parent 60ab744496
commit ca6bcd4944
2 changed files with 17 additions and 10 deletions

View File

@@ -59,15 +59,7 @@ void EMainWindow::setRecentMenu(QMenu * m) {
void EMainWindow::showEvent(QShowEvent * e) {
QWidget::showEvent(e);
initMenus();
if (!first_show) return;
first_show = false;
QList<QDockWidget *> docks(findChildren<QDockWidget *>());
for (QDockWidget * d: docks) {
connect(d, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(changedDock()));
connect(d, SIGNAL(topLevelChanged(bool)), this, SLOT(changedDock()));
connect(d, SIGNAL(visibilityChanged(bool)), this, SLOT(changedDock()));
}
changedDock();
initDocks();
}
@@ -261,6 +253,20 @@ void EMainWindow::initMenus() {
}
void EMainWindow::initDocks() {
QList<QDockWidget *> docks(findChildren<QDockWidget *>());
for (QDockWidget * d: docks) {
static const char * pname = "__edock_inited__";
if (d->property(pname).toBool()) continue;
d->setProperty(pname, true);
connect(d, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(changedDock()));
connect(d, SIGNAL(topLevelChanged(bool)), this, SLOT(changedDock()));
connect(d, SIGNAL(visibilityChanged(bool)), this, SLOT(changedDock()));
}
changedDock();
}
void EMainWindow::initSession() {
connect(&session, SIGNAL(loading(QPIConfig &)), this, SLOT(sessionLoading(QPIConfig &)));
connect(&session, SIGNAL(saving(QPIConfig &)), this, SLOT(sessionSaving(QPIConfig &)));
@@ -288,7 +294,7 @@ void EMainWindow::changedDock() {
QSet<QDockWidget *> invalid_tab_docks;
QList<QTabBar *> tabs(findChildren<QTabBar *>());
QList<QDockWidget *> docks = findChildren<QDockWidget *>();
QRect geom = geometry();
QRect geom = rect();
// qDebug() << "### change" << docks.size() << tabs.size();
for (QTabBar * t: tabs) {
if (!t->objectName().isEmpty() || t->isHidden()) continue;

View File

@@ -120,6 +120,7 @@ protected:
}
void initMenus();
void initDocks();
void initSession();
QAction action_show_all_tools, action_hide_all_tools, action_show_all_docks, action_hide_all_docks;