gui: Remove QT_VERSION fallbacks for Qt < 5
There were surprisingly many `#ifdef` fallbacks for Qt 4. Remiving them simplifies maintenance, as well as adding new GUI functionality.
This commit is contained in:
+1
-31
@@ -53,13 +53,9 @@
|
||||
#include <QSettings>
|
||||
#include <QTextDocument> // for Qt::mightBeRichText
|
||||
#include <QThread>
|
||||
#include <QUrlQuery>
|
||||
#include <QMouseEvent>
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
#include <QUrl>
|
||||
#else
|
||||
#include <QUrlQuery>
|
||||
#endif
|
||||
|
||||
#if QT_VERSION >= 0x50200
|
||||
#include <QFontDatabase>
|
||||
@@ -95,11 +91,7 @@ QFont fixedPitchFont()
|
||||
return QFontDatabase::systemFont(QFontDatabase::FixedFont);
|
||||
#else
|
||||
QFont font("Monospace");
|
||||
#if QT_VERSION >= 0x040800
|
||||
font.setStyleHint(QFont::Monospace);
|
||||
#else
|
||||
font.setStyleHint(QFont::TypeWriter);
|
||||
#endif
|
||||
return font;
|
||||
#endif
|
||||
}
|
||||
@@ -127,12 +119,10 @@ void setupAddressWidget(QValidatedLineEdit *widget, QWidget *parent)
|
||||
parent->setFocusProxy(widget);
|
||||
|
||||
widget->setFont(fixedPitchFont());
|
||||
#if QT_VERSION >= 0x040700
|
||||
// We don't want translators to use own addresses in translations
|
||||
// and this is the only place, where this address is supplied.
|
||||
widget->setPlaceholderText(QObject::tr("Enter a Bitcoin address (e.g. %1)").arg(
|
||||
QString::fromStdString(DummyAddress(Params()))));
|
||||
#endif
|
||||
widget->setValidator(new BitcoinAddressEntryValidator(parent));
|
||||
widget->setCheckValidator(new BitcoinAddressCheckValidator(parent));
|
||||
}
|
||||
@@ -151,12 +141,8 @@ bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out)
|
||||
}
|
||||
rv.amount = 0;
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
QList<QPair<QString, QString> > items = uri.queryItems();
|
||||
#else
|
||||
QUrlQuery uriQuery(uri);
|
||||
QList<QPair<QString, QString> > items = uriQuery.queryItems();
|
||||
#endif
|
||||
for (QList<QPair<QString, QString> >::iterator i = items.begin(); i != items.end(); i++)
|
||||
{
|
||||
bool fShouldReturnFalse = false;
|
||||
@@ -242,11 +228,7 @@ bool isDust(interfaces::Node& node, const QString& address, const CAmount& amoun
|
||||
|
||||
QString HtmlEscape(const QString& str, bool fMultiLine)
|
||||
{
|
||||
#if QT_VERSION < 0x050000
|
||||
QString escaped = Qt::escape(str);
|
||||
#else
|
||||
QString escaped = str.toHtmlEscaped();
|
||||
#endif
|
||||
if(fMultiLine)
|
||||
{
|
||||
escaped = escaped.replace("\n", "<br>\n");
|
||||
@@ -287,11 +269,7 @@ QString getSaveFileName(QWidget *parent, const QString &caption, const QString &
|
||||
QString myDir;
|
||||
if(dir.isEmpty()) // Default to user documents location
|
||||
{
|
||||
#if QT_VERSION < 0x050000
|
||||
myDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
|
||||
#else
|
||||
myDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -337,11 +315,7 @@ QString getOpenFileName(QWidget *parent, const QString &caption, const QString &
|
||||
QString myDir;
|
||||
if(dir.isEmpty()) // Default to user documents location
|
||||
{
|
||||
#if QT_VERSION < 0x050000
|
||||
myDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
|
||||
#else
|
||||
myDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -495,11 +469,7 @@ void TableViewLastColumnResizingFixer::disconnectViewHeadersSignals()
|
||||
// Refactored here for readability.
|
||||
void TableViewLastColumnResizingFixer::setViewHeaderResizeMode(int logicalIndex, QHeaderView::ResizeMode resizeMode)
|
||||
{
|
||||
#if QT_VERSION < 0x050000
|
||||
tableView->horizontalHeader()->setResizeMode(logicalIndex, resizeMode);
|
||||
#else
|
||||
tableView->horizontalHeader()->setSectionResizeMode(logicalIndex, resizeMode);
|
||||
#endif
|
||||
}
|
||||
|
||||
void TableViewLastColumnResizingFixer::resizeColumn(int nColumnIndex, int width)
|
||||
|
||||
Reference in New Issue
Block a user