diff --git a/assets/qml/PlatformDependent/CustomWindow.qml b/assets/qml/PlatformDependent/CustomWindow.qml index 63616aec..ec34436a 100644 --- a/assets/qml/PlatformDependent/CustomWindow.qml +++ b/assets/qml/PlatformDependent/CustomWindow.qml @@ -40,7 +40,8 @@ Window { property bool firstChange: true property bool windowMaximized: false property alias fullScreen: border.fullScreen - readonly property int customFlags: Qt.Window | Qt.CustomizeWindowHint + readonly property int customFlags: Qt.Dialog | + Qt.FramelessWindowHint // // Toggle fullscreen state @@ -199,6 +200,18 @@ Window { } } + // + // Background color implementation + // + Rectangle { + z: 100 + border.width: 0 + color: "transparent" + border.color: "#000" + radius: root.radius + anchors.fill: parent + } + // // Bottom resize handle // diff --git a/libs/qwt/src/qwt_plot_vectorfield.cpp b/libs/qwt/src/qwt_plot_vectorfield.cpp index d9737bc1..65bc6ed3 100644 --- a/libs/qwt/src/qwt_plot_vectorfield.cpp +++ b/libs/qwt/src/qwt_plot_vectorfield.cpp @@ -181,7 +181,9 @@ namespace m_x1 = m_x0 + m_numColumns * m_dx; m_y1 = m_y0 + m_numRows * m_dy; - m_entries = ( Entry* )::calloc( m_numRows * m_numColumns, sizeof( Entry ) ); + size_t r = static_cast(m_numRows); + size_t c = static_cast(m_numColumns); + m_entries = ( Entry* )::calloc( r * c, sizeof( Entry ) ); if ( m_entries == NULL ) { qWarning() << "QwtPlotVectorField: raster for filtering too fine - running out of memory"; diff --git a/libs/qwt/src/qwt_widget_overlay.cpp b/libs/qwt/src/qwt_widget_overlay.cpp index 546c0a39..56bf3268 100644 --- a/libs/qwt/src/qwt_widget_overlay.cpp +++ b/libs/qwt/src/qwt_widget_overlay.cpp @@ -220,8 +220,9 @@ void QwtWidgetOverlay::updateMask() // A fresh buffer from calloc() is usually faster // than reinitializing an existing one with // QImage::fill( 0 ) or memset() - - m_data->rgbaBuffer = ( uchar* )::calloc( width() * height(), 4 ); + size_t w = static_cast(width()); + size_t h = static_cast(width()); + m_data->rgbaBuffer = ( uchar* )::calloc( w * h, 4 ); QImage image( m_data->rgbaBuffer, width(), height(), qwtMaskImageFormat() ); diff --git a/src/Misc/ModuleManager.cpp b/src/Misc/ModuleManager.cpp index 68323ae5..81eb8a84 100644 --- a/src/Misc/ModuleManager.cpp +++ b/src/Misc/ModuleManager.cpp @@ -287,6 +287,7 @@ void Misc::ModuleManager::initializeQmlInterface() // Load main.qml setSplashScreenMessage(tr("Loading user interface...")); engine()->load(QUrl(QStringLiteral("qrc:/qml/main.qml"))); + qApp->processEvents(); // Warning! Do not call setSplashScreenMessage() after loading QML user interface } @@ -358,15 +359,7 @@ void Misc::ModuleManager::setRenderingEngine(const int engine) // Restart application if (ans == QMessageBox::Yes) - { -#ifdef Q_OS_MAC - auto bundle = qApp->applicationDirPath() + "/../../"; - QProcess::startDetached("open", { "-n", "-a", bundle }); -#else - QProcess::startDetached(qApp->arguments()[0], qApp->arguments()); -#endif - qApp->exit(); - } + Misc::Utilities::rebootApplication(); } } diff --git a/src/Misc/ThemeManager.cpp b/src/Misc/ThemeManager.cpp index 35c8dee1..6c8b385a 100644 --- a/src/Misc/ThemeManager.cpp +++ b/src/Misc/ThemeManager.cpp @@ -96,15 +96,7 @@ void ThemeManager::setTheme(const int id) // Restart application if (ans == QMessageBox::Yes) - { -#ifdef Q_OS_MAC - auto bundle = qApp->applicationDirPath() + "/../../"; - QProcess::startDetached("open", { "-n", "-a", bundle }); -#else - QProcess::startDetached(qApp->arguments()[0], qApp->arguments()); -#endif - qApp->exit(); - } + Utilities::rebootApplication(); } /** diff --git a/src/Misc/Utilities.cpp b/src/Misc/Utilities.cpp index 349fbb57..24dabbf2 100644 --- a/src/Misc/Utilities.cpp +++ b/src/Misc/Utilities.cpp @@ -45,13 +45,29 @@ Utilities *Utilities::getInstance() return UTILITIES; } +void Utilities::rebootApplication() +{ +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + qApp->exit(); + QProcess::startDetached(qApp->arguments()[0], qApp->arguments()); +#else +#ifdef Q_OS_MAC + auto bundle = qApp->applicationDirPath() + "/../../"; + QProcess::startDetached("open", { "-n", "-a", bundle }); +#else + QProcess::startDetached(qApp->arguments()[0], qApp->arguments()); +#endif + qApp->exit(); +#endif +} + bool Utilities::askAutomaticUpdates() { const int result = showMessageBox(tr("Check for updates automatically?"), tr("Should %1 automatically check for updates? " "You can always check for updates manually from " "the \"Help\" menu") - .arg(APP_NAME), + .arg(APP_NAME), APP_NAME, QMessageBox::Yes | QMessageBox::No); return result == QMessageBox::Yes; } @@ -108,7 +124,7 @@ void Utilities::revealFile(const QString &pathToReveal) scriptArgs << QLatin1String("-e") << QString::fromLatin1( "tell application \"Finder\" to reveal POSIX file \"%1\"") - .arg(pathToReveal); + .arg(pathToReveal); QProcess::execute(QLatin1String("/usr/bin/osascript"), scriptArgs); scriptArgs.clear(); scriptArgs << QLatin1String("-e") diff --git a/src/Misc/Utilities.h b/src/Misc/Utilities.h index c4467e81..17443b73 100644 --- a/src/Misc/Utilities.h +++ b/src/Misc/Utilities.h @@ -44,6 +44,7 @@ class Utilities : public QObject public: // clang-format off static Utilities* getInstance(); + static void rebootApplication(); Q_INVOKABLE bool askAutomaticUpdates(); static int showMessageBox(QString text, QString informativeText,