diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp index 653818556..a7105b8ca 100644 --- a/profile-widget/profilewidget2.cpp +++ b/profile-widget/profilewidget2.cpp @@ -919,7 +919,7 @@ void ProfileWidget2::setEmptyState() setBackgroundBrush(getColor(::BACKGROUND, isGrayscale)); dataModel->clear(); currentState = EMPTY; - MainWindow::instance()->setEnabledToolbar(false); + emit enableToolbar(false); fixBackgroundPos(); background->setVisible(true); @@ -974,7 +974,7 @@ void ProfileWidget2::setProfileState() MainWindow::instance()->enableShortcuts(); currentState = PROFILE; - MainWindow::instance()->setEnabledToolbar(true); + emit enableToolbar(true); toolTipItem->readPos(); setBackgroundBrush(getColor(::BACKGROUND, isGrayscale)); diff --git a/profile-widget/profilewidget2.h b/profile-widget/profilewidget2.h index ce3fda083..812787b2d 100644 --- a/profile-widget/profilewidget2.h +++ b/profile-widget/profilewidget2.h @@ -88,6 +88,7 @@ public: signals: void fontPrintScaleChanged(double scale); + void enableToolbar(bool enable); public slots: // Necessary to call from QAction's signals. diff --git a/subsurface-desktop-main.cpp b/subsurface-desktop-main.cpp index e7259c3f3..a40edda1b 100644 --- a/subsurface-desktop-main.cpp +++ b/subsurface-desktop-main.cpp @@ -9,6 +9,7 @@ #include "qt-gui.h" #include "subsurfacestartup.h" #include "desktop-widgets/mainwindow.h" +#include "profile-widget/profilewidget2.h" #include "desktop-widgets/diveplanner.h" #include "subsurface-core/color.h" #include "qthelper.h" @@ -82,6 +83,8 @@ int main(int argc, char **argv) // in case something has gone wrong make sure we show the error message m->showError(); + // now let's set up some connections + QObject::connect(m->graphics(), &ProfileWidget2::enableToolbar ,m, &MainWindow::setEnabledToolbar, Qt::AutoConnection); if (verbose > 0) print_files(); if (!quit)