From c6e2819587f7b135d0f71fc8c666abd00d887227 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sun, 25 Oct 2020 15:25:57 +0200 Subject: [PATCH] Fix Tape crash on Mac OS X. --- ChangeLog.txt | 3 +++ src/app/valentina/mainwindow.cpp | 14 ++++++++++++++ src/app/valentina/mainwindow.h | 1 + src/libs/vwidgets/vabstractmainwindow.cpp | 22 ++++------------------ src/libs/vwidgets/vabstractmainwindow.h | 2 +- 5 files changed, 23 insertions(+), 19 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index e8ad6a007..1211d39e5 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,6 @@ +# Version 0.7.37 (unreleased) +- Fix Tape crash on Mac OS X. + # Version 0.7.36 October 24, 2020 - [#892] Show tooltip for piece node point. - [#894] Quick way to disable a passmark. diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index b78d7de9b..2ab9fc1a7 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -1719,6 +1719,20 @@ void MainWindow::ExportToCSVData(const QString &fileName, bool withHeader, int m csv.toCSV(fileName, error, withHeader, separator, QTextCodec::codecForMib(mib)); } +//--------------------------------------------------------------------------------------------------------------------- +void MainWindow::ToolBarStyle(QToolBar *bar) const +{ + MainWindowsNoGUI::ToolBarStyle(bar); + +#if defined(Q_OS_MAC) + // Temporary fix issue with toolbar black background on mac with OpenGL render + if (qApp->getSceneView() && qApp->getSceneView()->IsOpenGLRender()) + { + bar->setStyle(QStyleFactory::create("fusion")); + } +#endif +} + //--------------------------------------------------------------------------------------------------------------------- void MainWindow::ScaleChanged(qreal scale) { diff --git a/src/app/valentina/mainwindow.h b/src/app/valentina/mainwindow.h index 80ff30eda..6557e7ce8 100644 --- a/src/app/valentina/mainwindow.h +++ b/src/app/valentina/mainwindow.h @@ -111,6 +111,7 @@ protected: virtual void PrepareSceneList(PreviewQuatilty quality) override; virtual void ExportToCSVData(const QString &fileName, bool withHeader, int mib, const QChar &separator) final; + virtual void ToolBarStyle(QToolBar *bar) const override; private slots: void ScaleChanged(qreal scale); void MouseMove(const QPointF &scenePos); diff --git a/src/libs/vwidgets/vabstractmainwindow.cpp b/src/libs/vwidgets/vabstractmainwindow.cpp index 729b95562..6f59a2958 100644 --- a/src/libs/vwidgets/vabstractmainwindow.cpp +++ b/src/libs/vwidgets/vabstractmainwindow.cpp @@ -28,7 +28,7 @@ #include "vabstractmainwindow.h" #include "../vpropertyexplorer/checkablemessagebox.h" -#include "../vmisc/vabstractvalapplication.h" +#include "../vmisc/vabstractapplication.h" #include "../vmisc/compatibility.h" #include "../vmisc/def.h" #include "dialogs/dialogexporttocsv.h" @@ -166,25 +166,11 @@ bool VAbstractMainWindow::ContinueFormatRewrite(const QString ¤tFormatVers } //--------------------------------------------------------------------------------------------------------------------- -void VAbstractMainWindow::ToolBarStyle(QToolBar *bar) +void VAbstractMainWindow::ToolBarStyle(QToolBar *bar) const { SCASSERT(bar != nullptr) - if (qApp->Settings()->GetToolBarStyle()) - { - bar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); - } - else - { - bar->setToolButtonStyle(Qt::ToolButtonIconOnly); - } - -#if defined(Q_OS_MAC) - // Temporary fix issue with toolbar black background on mac with OpenGL render - if (qApp->getSceneView() && qApp->getSceneView()->IsOpenGLRender()) - { - bar->setStyle(QStyleFactory::create("fusion")); - } -#endif + qApp->Settings()->GetToolBarStyle() ? bar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon) + : bar->setToolButtonStyle(Qt::ToolButtonIconOnly); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vwidgets/vabstractmainwindow.h b/src/libs/vwidgets/vabstractmainwindow.h index cb03b38f1..ad0e4e526 100644 --- a/src/libs/vwidgets/vabstractmainwindow.h +++ b/src/libs/vwidgets/vabstractmainwindow.h @@ -62,7 +62,7 @@ protected: QAction *m_separatorAct{nullptr}; bool ContinueFormatRewrite(const QString ¤tFormatVersion, const QString &maxFormatVersion); - void ToolBarStyle(QToolBar *bar); + virtual void ToolBarStyle(QToolBar *bar) const; QString CSVFilePath();