Compare commits

..

1 Commits
master ... wer

Author SHA1 Message Date
Martchus c32996a57d Show error reporting UI for process under Windows 2024-04-07 21:16:41 +02:00
4 changed files with 14 additions and 18 deletions

View File

@ -10,7 +10,7 @@ set(META_APP_DESCRIPTION
"Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models")
set(META_VERSION_MAJOR 6)
set(META_VERSION_MINOR 14)
set(META_VERSION_PATCH 1)
set(META_VERSION_PATCH 0)
set(META_APP_VERSION ${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH})
project(${META_PROJECT_NAME})

View File

@ -88,10 +88,6 @@ QMetaObject::Connection onDarkModeChanged(std::function<void(bool)> &&darkModeCh
return QObject::connect(styleHints, &QStyleHints::colorSchemeChanged, context,
[handler = std::move(darkModeChangedCallback)](Qt::ColorScheme colorScheme) { return handler(colorScheme == Qt::ColorScheme::Dark); });
}
#else
Q_UNUSED(darkModeChangedCallback)
Q_UNUSED(context)
Q_UNUSED(invokeImmediately)
#endif
return QMetaObject::Connection();
}

View File

@ -20,6 +20,11 @@
#include <QCoreApplication>
#endif
#ifdef Q_OS_WINDOWS
#include <windows.h>
#include <werapi.h>
#endif
#include <iostream>
using namespace std;
@ -356,6 +361,14 @@ void setupCommonQtApplicationAttributes()
}
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true);
#endif
// always show error reporting UI for this process (applicable for interactive applications only)
// see https://learn.microsoft.com/en-us/windows/win32/api/werapi/nf-werapi-wersetflags
#ifdef Q_OS_WINDOWS
if (WerSetFlags(WER_FAULT_REPORTING_ALWAYS_SHOW_UI) != S_OK) {
std::cerr << "Unable to initialize error reporting.\n";
}
#endif
}
/*!

View File

@ -16,18 +16,6 @@ QT_FORWARD_DECLARE_CLASS(QSettings)
QT_FORWARD_DECLARE_CLASS(QStringList)
#endif
/*!
* \brief Sets the base name of the desktop entry for this application from buildsystem-provided meta-data.
* \remarks
* - This is done as part of SET_QT_APPLICATION_INFO and thus normally doesn't need to be invoked individually.
* - This macro is still experimental.
*/
#define SET_QT_DESKTOP_FILE_NAME
#if defined(Q_OS_LINUX) && defined(qGuiApp) && defined(APP_ID)
#undef SET_QT_DESKTOP_FILE_NAME
#define SET_QT_DESKTOP_FILE_NAME QGuiApplication::setDesktopFileName(QStringLiteral(APP_ID));
#endif
/*!
* \brief Sets the application meta data in the QCoreApplication singleton and attributes commonly used
* within my applications.
@ -38,7 +26,6 @@ QT_FORWARD_DECLARE_CLASS(QStringList)
QCoreApplication::setOrganizationDomain(QStringLiteral(APP_DOMAIN)); \
QCoreApplication::setApplicationName(QStringLiteral(APP_NAME)); \
QCoreApplication::setApplicationVersion(QStringLiteral(APP_VERSION)); \
SET_QT_DESKTOP_FILE_NAME \
::QtUtilities::setupCommonQtApplicationAttributes()
/*!