Changeset View
Changeset View
Standalone View
Standalone View
src/qt/guiutil.cpp
Show First 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | |||||
#include <QFontDatabase> | #include <QFontDatabase> | ||||
#endif | #endif | ||||
#if defined(Q_OS_MAC) | #if defined(Q_OS_MAC) | ||||
#pragma GCC diagnostic push | #pragma GCC diagnostic push | ||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" | #pragma GCC diagnostic ignored "-Wdeprecated-declarations" | ||||
#include <CoreServices/CoreServices.h> | #include <CoreServices/CoreServices.h> | ||||
#include <objc/objc-runtime.h> | |||||
void ForceActivation(); | |||||
#endif | #endif | ||||
namespace GUIUtil { | namespace GUIUtil { | ||||
QString dateTimeStr(const QDateTime &date) { | QString dateTimeStr(const QDateTime &date) { | ||||
return date.date().toString(Qt::SystemLocaleShortDate) + QString(" ") + | return date.date().toString(Qt::SystemLocaleShortDate) + QString(" ") + | ||||
date.toString("hh:mm"); | date.toString("hh:mm"); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 296 Lines • ▼ Show 20 Lines | return !(checkPoint(QPoint(0, 0), w) && | ||||
checkPoint(QPoint(w->width() - 1, 0), w) && | checkPoint(QPoint(w->width() - 1, 0), w) && | ||||
checkPoint(QPoint(0, w->height() - 1), w) && | checkPoint(QPoint(0, w->height() - 1), w) && | ||||
checkPoint(QPoint(w->width() - 1, w->height() - 1), w) && | checkPoint(QPoint(w->width() - 1, w->height() - 1), w) && | ||||
checkPoint(QPoint(w->width() / 2, w->height() / 2), w)); | checkPoint(QPoint(w->width() / 2, w->height() / 2), w)); | ||||
} | } | ||||
void bringToFront(QWidget *w) { | void bringToFront(QWidget *w) { | ||||
#ifdef Q_OS_MAC | #ifdef Q_OS_MAC | ||||
// Force application activation on macOS. With Qt 5.4 this is required when | ForceActivation(); | ||||
// an action in the dock menu is triggered. | |||||
id app = objc_msgSend((id)objc_getClass("NSApplication"), | |||||
sel_registerName("sharedApplication")); | |||||
objc_msgSend(app, sel_registerName("activateIgnoringOtherApps:"), YES); | |||||
#endif | #endif | ||||
if (w) { | if (w) { | ||||
// activateWindow() (sometimes) helps with keyboard focus on Windows | // activateWindow() (sometimes) helps with keyboard focus on Windows | ||||
if (w->isMinimized()) { | if (w->isMinimized()) { | ||||
w->showNormal(); | w->showNormal(); | ||||
} else { | } else { | ||||
w->show(); | w->show(); | ||||
▲ Show 20 Lines • Show All 582 Lines • Show Last 20 Lines |