Skip to content

Commit a004673

Browse files
committed
qt: Add LogQtInfo() function
1 parent b931f61 commit a004673

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

src/qt/bitcoin.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,7 @@ int GuiMain(int argc, char* argv[])
556556
qInstallMessageHandler(DebugMessageHandler);
557557
// Allow parameter interaction before we create the options model
558558
app.parameterSetup();
559+
GUIUtil::LogQtInfo();
559560
// Load GUI settings from QSettings
560561
app.createOptionsModel(gArgs.GetBoolArg("-resetguisettings", false));
561562

src/qt/guiutil.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,20 @@
4444
#include <QFont>
4545
#include <QFontDatabase>
4646
#include <QFontMetrics>
47+
#include <QGuiApplication>
4748
#include <QKeyEvent>
4849
#include <QLineEdit>
50+
#include <QList>
4951
#include <QMouseEvent>
5052
#include <QProgressDialog>
53+
#include <QScreen>
5154
#include <QSettings>
55+
#include <QSize>
56+
#include <QString>
5257
#include <QTextDocument> // for Qt::mightBeRichText
5358
#include <QThread>
5459
#include <QUrlQuery>
60+
#include <QtGlobal>
5561

5662
#if defined(Q_OS_MAC)
5763

@@ -879,4 +885,23 @@ int TextWidth(const QFontMetrics& fm, const QString& text)
879885
#endif
880886
}
881887

888+
void LogQtInfo()
889+
{
890+
#ifdef QT_STATIC
891+
const std::string qt_link{"static"};
892+
#else
893+
const std::string qt_link{"dynamic"};
894+
#endif
895+
#ifdef QT_STATICPLUGIN
896+
const std::string plugin_link{"static"};
897+
#else
898+
const std::string plugin_link{"dynamic"};
899+
#endif
900+
LogPrintf("Qt %s (%s), plugin=%s (%s)\n", qVersion(), qt_link, QGuiApplication::platformName().toStdString(), plugin_link);
901+
LogPrintf("System: %s, %s\n", QSysInfo::prettyProductName().toStdString(), QSysInfo::buildAbi().toStdString());
902+
for (const QScreen* s : QGuiApplication::screens()) {
903+
LogPrintf("Screen: %s %dx%d, pixel ratio=%.1f\n", s->name().toStdString(), s->size().width(), s->size().height(), s->devicePixelRatio());
904+
}
905+
}
906+
882907
} // namespace GUIUtil

src/qt/guiutil.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,11 @@ namespace GUIUtil
265265
* In Qt 5.11 the QFontMetrics::horizontalAdvance() was introduced.
266266
*/
267267
int TextWidth(const QFontMetrics& fm, const QString& text);
268+
269+
/**
270+
* Writes to debug.log short info about the used Qt and the host system.
271+
*/
272+
void LogQtInfo();
268273
} // namespace GUIUtil
269274

270275
#endif // BITCOIN_QT_GUIUTIL_H

0 commit comments

Comments
 (0)