Commit 2769c21c authored by Boudewijn Rempt's avatar Boudewijn Rempt

Remove obsolete checks for versions of Qt < 5.9

I also wanted to enable deprecations for newer versions of Qt,
but what with the removal of QSignalMapper, deprecation of much
of QDesktopWidget, that's just not feasible -- it'll be a project
that will take weeks.
parent 51dfe74a
......@@ -447,7 +447,22 @@ add_definitions(
-DQT_USE_FAST_OPERATOR_PLUS
)
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x50900)
#if (${Qt5_VERSION} VERSION_GREATER "5.14.0" )
# add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x50F00)
#elseif (${Qt5_VERSION} VERSION_GREATER "5.13.0" )
# add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x50E00)
#elseif (${Qt5_VERSION} VERSION_GREATER "5.12.0" )
# add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x50D00)
#elseif (${Qt5_VERSION} VERSION_GREATER "5.11.0" )
# add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x50C00)
#if(${Qt5_VERSION} VERSION_GREATER "5.10.0" )
# add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x50B00)
#if(${Qt5_VERSION} VERSION_GREATER "5.9.0" )
# add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x50A00)
#else()
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x50900)
#endif()
add_definitions(-DTRANSLATION_DOMAIN=\"krita\")
......
......@@ -34,9 +34,7 @@
#include <QMessageBox>
#include <QThread>
#if QT_VERSION >= 0x050900
#include <QOperatingSystemVersion>
#endif
#include <time.h>
......@@ -160,9 +158,7 @@ extern "C" int main(int argc, char **argv)
QCoreApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings, true);
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true);
#if QT_VERSION >= 0x050900
QCoreApplication::setAttribute(Qt::AA_DisableShaderDiskCache, true);
#endif
#ifdef HAVE_HIGH_DPI_SCALE_FACTOR_ROUNDING_POLICY
// This rounding policy depends on a series of patches to Qt related to
......@@ -439,7 +435,6 @@ extern "C" int main(int argc, char **argv)
#if defined Q_OS_WIN
KisConfig cfg(false);
bool supportedWindowsVersion = true;
#if QT_VERSION >= 0x050900
QOperatingSystemVersion osVersion = QOperatingSystemVersion::current();
if (osVersion.type() == QOperatingSystemVersion::Windows) {
if (osVersion.majorVersion() >= QOperatingSystemVersion::Windows7.majorVersion()) {
......@@ -458,7 +453,6 @@ extern "C" int main(int argc, char **argv)
}
}
}
#endif
#ifndef USE_QT_TABLET_WINDOWS
{
if (cfg.useWin8PointerInput() && !KisTabletSupportWin8::isAvailable()) {
......@@ -514,9 +508,7 @@ extern "C" int main(int argc, char **argv)
return 1;
}
#if QT_VERSION >= 0x050700
app.setAttribute(Qt::AA_CompressHighFrequencyEvents, false);
#endif
// Set up remote arguments.
QObject::connect(&app, SIGNAL(messageReceived(QByteArray,QObject*)),
......
......@@ -190,7 +190,11 @@ void KoImageData::setImage(const QImage &image, KoImageCollection *collection)
d->temporaryFile = 0;
d->clear();
d->suffix = "png"; // good default for non-lossy storage.
#if QT_VERSION >= QT_VERSION_CHECK(5,10,0)
if (image.sizeInBytes() > MAX_MEMORY_IMAGESIZE) {
#else
if (image.byteCount() > MAX_MEMORY_IMAGESIZE) {
#endif
// store image
QBuffer buffer;
buffer.open(QIODevice::WriteOnly);
......
......@@ -382,7 +382,7 @@ private:
KIS_SAFE_ASSERT_RECOVER_NOOP(skippedChar.isSpace() || !skippedChar.isPrint());
QFontMetrics metrics(format.font());
return metrics.width(skippedChar);
return metrics.horizontalAdvance(skippedChar);
}
static QTextCharFormat formatForPos(int pos, const QVector<QTextLayout::FormatRange> &formats)
......
......@@ -68,8 +68,6 @@ extern const KRITAGLOBAL_EXPORT QLoggingCategory &_41016();
#define dbgOpenGL qCDebug(_41015)
#define dbgMetaData qCDebug(_41016)
// Defined in Qt 5.6
#if QT_VERSION >= 0x050600
#define infoResources qCInfo(_30009)
#define infoKrita qCInfo(_41000)
#define infoImage qCInfo(_41001)
......@@ -88,7 +86,7 @@ extern const KRITAGLOBAL_EXPORT QLoggingCategory &_41016();
#define infoTablet qCDebug(_41014)
#define infoOpenGL qCDebug(_41015)
#define infoMetaData qCDebug(_41016)
#endif
#define warnResources qCWarning(_30009)
#define warnKrita qCWarning(_41000)
......
......@@ -171,7 +171,11 @@ void KisFixedPaintDevice::convertFromQImage(const QImage& _image, const QString
// Don't convert if not no profile is given and both paint dev and qimage are rgba.
if (srcProfileName.isEmpty() && colorSpace()->id() == "RGBA") {
#if QT_VERSION >= QT_VERSION_CHECK(5,10,0)
memcpy(data(), image.constBits(), image.sizeInBytes());
#else
memcpy(data(), image.constBits(), image.byteCount());
#endif
} else {
KoColorSpaceRegistry::instance()
->colorSpace( RGBAColorModelID.id(), Integer8BitsColorDepthID.id(), srcProfileName)
......
......@@ -127,11 +127,7 @@ void TestDocument::testThumbnail()
// it makes it 10x10 empty, then puts 8x8 pixels in there... Not a bug in the Node class
for (int i = 0; i < 8; ++i) {
for (int j = 0; j < 8; ++j) {
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
QVERIFY(thumb.pixelColor(i, j) == QColor(Qt::red));
#else
QVERIFY(QColor(thumb.pixel(i, j)) == QColor(Qt::red));
#endif
}
}
KisPart::instance()->removeDocument(kisdoc);
......
......@@ -132,11 +132,7 @@ void TestNode::testThumbnail()
// it makes it 10x10 empty, then puts 8x8 pixels in there... Not a bug in the Node class
for (int i = 0; i < 8; ++i) {
for (int j = 0; j < 8; ++j) {
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
QVERIFY(thumb.pixelColor(i, j) == QColor(Qt::gray));
#else
QVERIFY(QColor(thumb.pixel(i, j)) == QColor(Qt::gray));
#endif
}
}
}
......
......@@ -700,26 +700,12 @@ void KisCanvas2::setProofingOptions(bool softProof, bool gamutCheck)
m_d->proofingConfig = cfg.defaultProofingconfiguration();
}
KoColorConversionTransformation::ConversionFlags conversionFlags = m_d->proofingConfig->conversionFlags;
#if QT_VERSION >= 0x050700
if (this->image()->colorSpace()->colorDepthId().id().contains("U")) {
conversionFlags.setFlag(KoColorConversionTransformation::SoftProofing, softProof);
if (softProof) {
conversionFlags.setFlag(KoColorConversionTransformation::GamutCheck, gamutCheck);
}
}
#else
if (this->image()->colorSpace()->colorDepthId().id().contains("U")) {
conversionFlags |= KoColorConversionTransformation::SoftProofing;
} else {
conversionFlags = conversionFlags & ~KoColorConversionTransformation::SoftProofing;
}
if (gamutCheck && softProof && this->image()->colorSpace()->colorDepthId().id().contains("U")) {
conversionFlags |= KoColorConversionTransformation::GamutCheck;
} else {
conversionFlags = conversionFlags & ~KoColorConversionTransformation::GamutCheck;
}
#endif
m_d->proofingConfig->conversionFlags = conversionFlags;
m_d->proofingConfigUpdated = true;
......
......@@ -163,14 +163,7 @@ void KisDlgImageProperties::setProofingConfig()
m_proofingConfig->conversionFlags = KoColorConversionTransformation::HighQuality;
#if QT_VERSION >= 0x050700
m_proofingConfig->conversionFlags.setFlag(KoColorConversionTransformation::BlackpointCompensation, m_page->ckbBlackPointComp->isChecked());
#else
m_page->ckbBlackPointComp->isChecked() ?
m_proofingConfig->conversionFlags |= KoColorConversionTransformation::BlackpointCompensation
: m_proofingConfig->conversionFlags = m_proofingConfig->conversionFlags & ~KoColorConversionTransformation::BlackpointCompensation;
#endif
m_proofingConfig->intent = (KoColorConversionTransformation::Intent)m_page->cmbIntent->currentIndex();
m_proofingConfig->proofingProfile = m_page->proofSpaceSelector->currentColorSpace()->profile()->name();
m_proofingConfig->proofingModel = m_page->proofSpaceSelector->currentColorSpace()->colorModelId().id();
......
......@@ -381,7 +381,7 @@ bool KisInputManager::Private::ProximityNotifier::eventFilter(QObject* object, Q
* To avoid this problem we should explicitly ignore all the tablet events.
*/
#if defined Q_OS_LINUX && \
QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) && \
QT_VERSION >= QT_VERSION_CHECK(5, 9, 0) && \
QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
if (event->type() == QEvent::TabletMove ||
......
......@@ -191,11 +191,7 @@ bool KisScreenColorPicker::handleColorPickingMouseButtonRelease(QMouseEvent *e)
bool KisScreenColorPicker::handleColorPickingKeyPress(QKeyEvent *e)
{
#if QT_VERSION >= 0x050600
if (e->matches(QKeySequence::Cancel)) {
#else
if (e->key() == Qt::Key_Escape) {
#endif
releaseColorPicking();
setCurrentColor(m_d->beforeScreenColorPicking);
} else if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) {
......
......@@ -24,6 +24,8 @@
#include "KoDialog_p.h"
#include <QApplication>
#include <QScreen>
#include <QGuiApplication>
#include <QDesktopWidget>
#include <QDialogButtonBox>
#include <QHBoxLayout>
......@@ -157,10 +159,8 @@ void KoDialogPrivate::appendButton(KoDialog::ButtonCode key, const KGuiItem &ite
mButtonBox->addButton(button, role);
mButtonList.insert(key, button);
mButtonSignalMapper.setMapping(button, key);
QObject::connect(button, SIGNAL(clicked()),
&mButtonSignalMapper, SLOT(map()));
QObject::connect(button, &QPushButton::clicked, [=] { q->slotButtonClicked(key); });
if (key == mDefaultButton) {
// Now that it exists, set it as default
......@@ -177,8 +177,6 @@ void KoDialogPrivate::init(KoDialog *q)
q->setButtons(KoDialog::Ok | KoDialog::Cancel);
q->setDefaultButton(KoDialog::Ok);
q->connect(&mButtonSignalMapper, SIGNAL(mapped(int)), q, SLOT(slotButtonClicked(int)));
q->setPlainCaption(qApp->applicationDisplayName()); // set appropriate initial window title for case it gets not set later
}
......
/* This file is part of the KDE Libraries
/* This file is part of the KDE Librariesfsignals
* Copyright (C) 1998 Thomas Tanghus (tanghus@earthling.net)
* Additions 1999-2000 by Espen Sand (espen@kde.org)
* and Holger Freyther <freyther@kde.org>
......
......@@ -76,7 +76,6 @@ protected:
QDialogButtonBox *mButtonBox;
QHash<int, QPushButton *> mButtonList;
QSignalMapper mButtonSignalMapper;
protected Q_SLOTS:
void queuedLayoutUpdate();
......
......@@ -90,8 +90,7 @@ QSize KisSqueezedComboBox::sizeHint() const
{
ensurePolished();
QFontMetrics fm = fontMetrics();
int maxW = count() ? 18 : 7 * fm.width(QChar('x')) + 18;
int maxW = count() ? 18 : 7 * fm.boundingRect(QChar('x')).width() + 18;
int maxH = qMax(fm.lineSpacing(), 14) + 2;
QStyleOptionComboBox options;
......@@ -151,14 +150,14 @@ QString KisSqueezedComboBox::squeezeText(const QString& original, const QWidget
QFontMetrics fm(widget->fontMetrics());
// If we can fit the full text, return that.
if (fm.width(original) < widgetSize)
if (fm.boundingRect(original).width() < widgetSize)
return(original);
// We need to squeeze.
QString sqItem = original; // prevent empty return value;
widgetSize = widgetSize - fm.width("...");
widgetSize = widgetSize - fm.boundingRect("...").width();
for (int i = 0 ; i != original.length(); ++i) {
if ((int)fm.width(original.right(i)) > widgetSize) {
if ((int)fm.boundingRect(original.right(i)).width() > widgetSize) {
sqItem = QString("..." + original.right(--i));
break;
}
......
......@@ -29,10 +29,11 @@
#include "krecentfilesaction_p.h"
#include <QFile>
#include <QDesktopWidget>
#include <QGuiApplication>
#include <QDir>
#include <QMenu>
#include <QComboBox>
#include <QScreen>
#include <kconfig.h>
#include <kconfiggroup.h>
......@@ -123,19 +124,18 @@ static QString titleWithSensibleWidth(const QString &nameValue, const QString &v
// action titles to be bigger than that
// Since we do not know in which screen we are going to show
// we choose the min of all the screens
const QDesktopWidget desktopWidget;
int maxWidthForTitles = INT_MAX;
for (int i = 0; i < desktopWidget.screenCount(); ++i) {
maxWidthForTitles = qMin(maxWidthForTitles, desktopWidget.availableGeometry(i).width() * 3 / 4);
Q_FOREACH(const QScreen *screen, QGuiApplication::screens()) {
maxWidthForTitles = qMin(maxWidthForTitles, screen->availableGeometry().width() * 3 / 4);
}
const QFontMetrics fontMetrics = QFontMetrics(QFont());
QString title = nameValue + " [" + value + ']';
if (fontMetrics.width(title) > maxWidthForTitles) {
if (fontMetrics.boundingRect(title).width() > maxWidthForTitles) {
// If it does not fit, try to cut only the whole path, though if the
// name is too long (more than 3/4 of the whole text) we cut it a bit too
const int nameValueMaxWidth = maxWidthForTitles * 3 / 4;
const int nameWidth = fontMetrics.width(nameValue);
const int nameWidth = fontMetrics.boundingRect(nameValue).width();
QString cutNameValue, cutValue;
if (nameWidth > nameValueMaxWidth) {
cutNameValue = fontMetrics.elidedText(nameValue, Qt::ElideMiddle, nameValueMaxWidth);
......
......@@ -232,11 +232,7 @@ void ChannelModel::updateThumbnails(void)
m_thumbnails.resize(m_channelCount);
for (quint32 i = 0; i < (quint32)m_channelCount; ++i) {
#if QT_VERSION >= 0x050500
m_thumbnails[i] = QImage(thumbnailSize, QImage::Format_Grayscale8);
#else
m_thumbnails[i] = QImage(thumbnailSize, QImage::Format_ARGB32_Premultiplied);
#endif
}
KisSequentialConstIterator it(thumbnailDev, QRect(0, 0, thumbnailSize.width(), thumbnailSize.height()));
......@@ -247,12 +243,7 @@ void ChannelModel::updateThumbnails(void)
const quint8* pixel = it.rawDataConst();
for (int chan = 0; chan < m_channelCount; ++chan) {
QImage &img = m_thumbnails[chan];
#if QT_VERSION >= 0x050500
*(img.scanLine(y) + x) = cs->scaleToU8(pixel, chan);
#else
quint8 v = cs->scaleToU8(pixel, chan);
img.setPixel(x, y, qRgb(v, v, v));
#endif
}
}
}
......
......@@ -109,11 +109,7 @@ double KDcraw::Private::progressValue() const
void KDcraw::Private::fillIndentifyInfo(LibRaw* const raw, DcrawInfoContainer& identify)
{
#if QT_VERSION >= 0x050900
identify.dateTime.setSecsSinceEpoch(raw->imgdata.other.timestamp);
#else
identify.dateTime.setTime_t(raw->imgdata.other.timestamp);
#endif
identify.make = QString(raw->imgdata.idata.make);
identify.model = QString(raw->imgdata.idata.model);
identify.owner = QString(raw->imgdata.other.artist);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment