Skip to content

Commit 4b36ab3

Browse files
committed
qt, refactor: Remove outdated Qt version-specific code
Since bitcoin/bitcoin#30997, the minimum supported Qt version is 6.2.
1 parent 639279e commit 4b36ab3

File tree

8 files changed

+0
-56
lines changed

8 files changed

+0
-56
lines changed

src/qt/addressbookpage.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@
1515
#include <QMenu>
1616
#include <QMessageBox>
1717
#include <QSortFilterProxyModel>
18-
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
1918
#include <QRegularExpression>
20-
#else
21-
#include <QRegExp>
22-
#endif
2319

2420
class AddressBookSortFilterProxyModel final : public QSortFilterProxyModel
2521
{
@@ -47,11 +43,7 @@ class AddressBookSortFilterProxyModel final : public QSortFilterProxyModel
4743

4844
auto address = model->index(row, AddressTableModel::Address, parent);
4945

50-
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
5146
const auto pattern = filterRegularExpression();
52-
#else
53-
const auto pattern = filterRegExp();
54-
#endif
5547
return (model->data(address).toString().contains(pattern) ||
5648
model->data(label).toString().contains(pattern));
5749
}

src/qt/bitcoin.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,7 @@ static void RegisterMetaTypes()
9090
qRegisterMetaType<std::function<void()>>("std::function<void()>");
9191
qRegisterMetaType<QMessageBox::Icon>("QMessageBox::Icon");
9292
qRegisterMetaType<interfaces::BlockAndHeaderTipInfo>("interfaces::BlockAndHeaderTipInfo");
93-
94-
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
95-
qRegisterMetaTypeStreamOperators<BitcoinUnit>("BitcoinUnit");
96-
#else
9793
qRegisterMetaType<BitcoinUnit>("BitcoinUnit");
98-
#endif
9994
}
10095

10196
static QString GetLangTerritory()
@@ -134,11 +129,7 @@ static void initTranslations(QTranslator &qtTranslatorBase, QTranslator &qtTrans
134129
// - First load the translator for the base language, without territory
135130
// - Then load the more specific locale translator
136131

137-
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
138-
const QString translation_path{QLibraryInfo::location(QLibraryInfo::TranslationsPath)};
139-
#else
140132
const QString translation_path{QLibraryInfo::path(QLibraryInfo::TranslationsPath)};
141-
#endif
142133
// Load e.g. qt_de.qm
143134
if (qtTranslatorBase.load("qt_" + lang, translation_path)) {
144135
QApplication::installTranslator(&qtTranslatorBase);
@@ -508,12 +499,6 @@ int GuiMain(int argc, char* argv[])
508499
Q_INIT_RESOURCE(bitcoin);
509500
Q_INIT_RESOURCE(bitcoin_locale);
510501

511-
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
512-
// Generate high-dpi pixmaps
513-
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
514-
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
515-
#endif
516-
517502
#if defined(QT_QPA_PLATFORM_ANDROID)
518503
QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar);
519504
QApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);

src/qt/guiutil.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -954,20 +954,12 @@ void PopupMenu(QMenu* menu, const QPoint& point, QAction* at_action)
954954

955955
QDateTime StartOfDay(const QDate& date)
956956
{
957-
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
958957
return date.startOfDay();
959-
#else
960-
return QDateTime(date);
961-
#endif
962958
}
963959

964960
bool HasPixmap(const QLabel* label)
965961
{
966-
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
967962
return !label->pixmap(Qt::ReturnByValue).isNull();
968-
#else
969-
return label->pixmap() != nullptr;
970-
#endif
971963
}
972964

973965
QImage GetImage(const QLabel* label)
@@ -976,11 +968,7 @@ QImage GetImage(const QLabel* label)
976968
return QImage();
977969
}
978970

979-
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
980971
return label->pixmap(Qt::ReturnByValue).toImage();
981-
#else
982-
return label->pixmap()->toImage();
983-
#endif
984972
}
985973

986974
QString MakeHtmlLink(const QString& source, const QString& link)

src/qt/guiutil.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -362,11 +362,7 @@ namespace GUIUtil
362362
template <typename SeparatorType>
363363
QStringList SplitSkipEmptyParts(const QString& string, const SeparatorType& separator)
364364
{
365-
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
366365
return string.split(separator, Qt::SkipEmptyParts);
367-
#else
368-
return string.split(separator, QString::SkipEmptyParts);
369-
#endif
370366
}
371367

372368

src/qt/optionsdialog.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,7 @@ OptionsDialog::OptionsDialog(QWidget* parent, bool enableWallet)
164164
{
165165
/** display language strings as "native language - native country/territory (locale name)", e.g. "Deutsch - Deutschland (de)" */
166166
ui->lang->addItem(locale.nativeLanguageName() + QString(" - ") +
167-
#if (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
168167
locale.nativeTerritoryName() +
169-
#else
170-
locale.nativeCountryName() +
171-
#endif
172168
QString(" (") + langStr + QString(")"), QVariant(langStr));
173169

174170
}

src/qt/sendcoinsdialog.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,13 +178,8 @@ void SendCoinsDialog::setModel(WalletModel *_model)
178178
connect(ui->confTargetSelector, qOverload<int>(&QComboBox::currentIndexChanged), this, &SendCoinsDialog::updateSmartFeeLabel);
179179
connect(ui->confTargetSelector, qOverload<int>(&QComboBox::currentIndexChanged), this, &SendCoinsDialog::coinControlUpdateLabels);
180180

181-
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
182181
connect(ui->groupFee, &QButtonGroup::idClicked, this, &SendCoinsDialog::updateFeeSectionControls);
183182
connect(ui->groupFee, &QButtonGroup::idClicked, this, &SendCoinsDialog::coinControlUpdateLabels);
184-
#else
185-
connect(ui->groupFee, qOverload<int>(&QButtonGroup::buttonClicked), this, &SendCoinsDialog::updateFeeSectionControls);
186-
connect(ui->groupFee, qOverload<int>(&QButtonGroup::buttonClicked), this, &SendCoinsDialog::coinControlUpdateLabels);
187-
#endif
188183

189184
connect(ui->customFee, &BitcoinAmountField::valueChanged, this, &SendCoinsDialog::coinControlUpdateLabels);
190185
#if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))

src/qt/winshutdownmonitor.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,7 @@
1212

1313
// If we don't want a message to be processed by Qt, return true and set result to
1414
// the value that the window procedure should return. Otherwise return false.
15-
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
1615
bool WinShutdownMonitor::nativeEventFilter(const QByteArray &eventType, void *pMessage, qintptr *pnResult)
17-
#else
18-
bool WinShutdownMonitor::nativeEventFilter(const QByteArray &eventType, void *pMessage, long *pnResult)
19-
#endif
2016
{
2117
Q_UNUSED(eventType);
2218

src/qt/winshutdownmonitor.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,7 @@ class WinShutdownMonitor : public QAbstractNativeEventFilter
2020
WinShutdownMonitor(std::function<void()> shutdown_fn) : m_shutdown_fn{std::move(shutdown_fn)} {}
2121

2222
/** Implements QAbstractNativeEventFilter interface for processing Windows messages */
23-
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
2423
bool nativeEventFilter(const QByteArray &eventType, void *pMessage, qintptr *pnResult) override;
25-
#else
26-
bool nativeEventFilter(const QByteArray &eventType, void *pMessage, long *pnResult) override;
27-
#endif
2824

2925
/** Register the reason for blocking shutdown on Windows to allow clean client exit */
3026
static void registerShutdownBlockReason(const QString& strReason, const HWND& mainWinId);

0 commit comments

Comments
 (0)