Skip to content

Commit 07efb3f

Browse files
committed
Merge #17826: qt: Log Qt related info
a004673 qt: Add LogQtInfo() function (Hennadii Stepanov) Pull request description: This PR adds some info to `debug.log` I found useful for testing (e.g., on Wayland) and debugging issues like #17153: ``` $ ./src/qt/bitcoin-qt -printtoconsole | head -n 6 2020-01-04T14:57:40Z [main] Bitcoin Core version v0.19.99.0-0df287f4e (release build) 2020-01-04T14:57:40Z [main] InitParameterInteraction: parameter interaction: -externalip set -> setting -discover=0 2020-01-04T14:57:40Z [main] Qt 5.9.5 (dynamic), plugin=xcb (dynamic) 2020-01-04T14:57:40Z [main] System: Linux Mint 19.3, x86_64-little_endian-lp64 2020-01-04T14:57:40Z [main] Screen: HDMI-1 1600x1200, pixel ratio=1.0 2020-01-04T14:57:40Z [main] Assuming ancestors of block 00000000000000b7ab6ce61eb6d571003fbe5fe892da4c9b740c49a07542462d have valid signatures. ``` ACKs for top commit: laanwj: ACK a004673 Tree-SHA512: 496bcfd4870a2730eab92b96b3e74989a7904b21369c372b6d4368f4ca2c141e2fdc1348a1fdd18cb68bb144dcea01d3023bb782f9d030e330c187f6a5a1a082
2 parents 6dd982a + a004673 commit 07efb3f

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)