Changeset View
Changeset View
Standalone View
Standalone View
src/qt/guiutil.cpp
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | |||||
#include <QApplication> | #include <QApplication> | ||||
#include <QClipboard> | #include <QClipboard> | ||||
#include <QDateTime> | #include <QDateTime> | ||||
#include <QDesktopServices> | #include <QDesktopServices> | ||||
#include <QDoubleValidator> | #include <QDoubleValidator> | ||||
#include <QFileDialog> | #include <QFileDialog> | ||||
#include <QFont> | #include <QFont> | ||||
#include <QFontDatabase> | #include <QFontDatabase> | ||||
#include <QFontMetrics> | |||||
#include <QKeyEvent> | #include <QKeyEvent> | ||||
#include <QLineEdit> | #include <QLineEdit> | ||||
#include <QMouseEvent> | #include <QMouseEvent> | ||||
#include <QProgressDialog> | |||||
#include <QSettings> | #include <QSettings> | ||||
#include <QTextDocument> // for Qt::mightBeRichText | #include <QTextDocument> // for Qt::mightBeRichText | ||||
#include <QThread> | #include <QThread> | ||||
#include <QUrlQuery> | #include <QUrlQuery> | ||||
#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" | ||||
▲ Show 20 Lines • Show All 906 Lines • ▼ Show 20 Lines | |||||
int TextWidth(const QFontMetrics &fm, const QString &text) { | int TextWidth(const QFontMetrics &fm, const QString &text) { | ||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)) | #if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)) | ||||
return fm.horizontalAdvance(text); | return fm.horizontalAdvance(text); | ||||
#else | #else | ||||
return fm.width(text); | return fm.width(text); | ||||
#endif | #endif | ||||
} | } | ||||
void PolishProgressDialog(QProgressDialog *dialog) { | |||||
#ifdef Q_OS_MAC | |||||
// Workaround for macOS-only Qt bug; see: QTBUG-65750, QTBUG-70357. | |||||
const int margin = dialog->fontMetrics().width("X"); | |||||
dialog->resize(dialog->width() + 2 * margin, dialog->height()); | |||||
dialog->show(); | |||||
#else | |||||
Q_UNUSED(dialog); | |||||
#endif | |||||
} | |||||
} // namespace GUIUtil | } // namespace GUIUtil |