Skip to content

Commit

Permalink
Remove Qt < 5.15 support
Browse files Browse the repository at this point in the history
  • Loading branch information
dantti committed Jan 3, 2024
1 parent 685b397 commit 9eb273f
Show file tree
Hide file tree
Showing 10 changed files with 3 additions and 48 deletions.
7 changes: 1 addition & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,9 @@ repos:
args: [--allow-multiple-documents]
- id: check-json
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v17.0.3
rev: v17.0.6
hooks:
- id: clang-format
- repo: https://github.com/PyCQA/pylint
rev: v3.0.1
hooks:
- id: pylint
exclude: ^(.cmake-format.py|conan/conanfile.py)
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ if(BUILD_QT6)
set(KDSME_LIBRARY_QTID "-qt6")
else()
set(Qt_VERSION_MAJOR 5)
set(QT_MIN_VERSION "5.12")
set(QT_MIN_VERSION "5.15")
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Quick QuickWidgets Test Widgets)
set(KDSME_LIBRARY_QTID "")
include(ECMGeneratePriFile)
Expand Down
4 changes: 0 additions & 4 deletions examples/export/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ using namespace KDSME;

static void doOutput(QTextStream &qOut, const QByteArray &output)
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
qOut << output << Qt::endl;
#else
qOut << output << endl;
#endif
}

/**
Expand Down
5 changes: 1 addition & 4 deletions src/core/export/svgexporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,8 @@ bool SvgExporterPrivate::writeStateMachine(StateMachine *machine)
writeSvgRect(machine->boundingRect());
const QFontMetricsF metrics(QGuiApplication::font());
const QRectF headerBox(machine->pos().x(), machine->pos().y(),
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
metrics.horizontalAdvance(machine->label()) + 2 * margin(), headerHeight());
#else
metrics.width(machine->label()) + 2 * margin(), headerHeight());
#endif

writeSvgRect(headerBox);
writeSvgText(machine->label(), machine->pos() + QPointF(margin(), headerHeight() / 2.0));
return writeStateInner(machine);
Expand Down
4 changes: 0 additions & 4 deletions src/core/layout/layerwiselayouter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,7 @@ QRectF boundingRectForCollapsedRegion(State *state, const LayoutProperties *prop

const QString label = state->label();
const QFontMetricsF fm(prop->regionLabelFont());
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
const qreal width = fm.horizontalAdvance(label);
#else
const qreal width = fm.width(label);
#endif
const qreal height = fm.height();
const qreal margin = prop->regionLabelMargins();
return QRectF(0, 0, width + prop->regionLabelButtonBoxSize().width() + 2 * margin, height + 2 * margin);
Expand Down
4 changes: 0 additions & 4 deletions src/core/layout/layoututils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ QSizeF LayoutUtils::sizeForLabel(const QString &label)

// TODO: Improve
QFontMetricsF fm(QGuiApplication::font());
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
const qreal width = fm.horizontalAdvance(label);
#else
const qreal width = fm.width(label);
#endif
return QSizeF(width + 2 * margin, fm.height() + 2 * margin);
}

Expand Down
4 changes: 0 additions & 4 deletions src/core/tests/test_qmlexport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ namespace {
static QString stripQml(const QByteArray &input)
{
QStringList result;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
Q_FOREACH (const QString &s, QString::fromUtf8(input).split(u'\n', Qt::SkipEmptyParts)) {
#else
Q_FOREACH (const QString &s, QString::fromUtf8(input).split(u'\n', QString::SkipEmptyParts)) {
#endif
result.append(s.simplified().trimmed());
}
return result.join(u'\n');
Expand Down
7 changes: 0 additions & 7 deletions src/view/quick/quicksceneitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,10 @@ using namespace KDSME;

namespace {

#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
static QLineF::IntersectionType intersects(const QLineF &line1, const QLineF &line2, QPointF *intersectionPoint)
{
return line1.intersects(line2, intersectionPoint);
}
#else
static QLineF::IntersectType intersects(const QLineF &line1, const QLineF &line2, QPointF *intersectionPoint)
{
return line1.intersect(line2, intersectionPoint);
}
#endif

/**
* Return the first intersection point of @p line with @p rect
Expand Down
4 changes: 0 additions & 4 deletions src/view/widgets/codeeditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,7 @@ int CodeEditor::lineNumberAreaWidth()
++digits;
}

#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
int space = 3 + fontMetrics().horizontalAdvance(QLatin1Char('9')) * digits;
#else
int space = 3 + fontMetrics().width(QLatin1Char('9')) * digits;
#endif

return space;
}
Expand Down
10 changes: 0 additions & 10 deletions src/view/widgets/propertyeditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,27 +108,17 @@ PropertyEditor::PropertyEditor(QWidget *parent)
d->m_widgetToPropertyMap.insert(d->m_transitionWidget->timeoutEdit, QStringLiteral("timeout"));

connect(d->m_stateWidget->labelLineEdit, SIGNAL(editingFinished()), SLOT(updateSimpleProperty()));
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
connect(d->m_stateWidget->initialStateComboBox, &QComboBox::textActivated, this, [this](const QString &text) { d->setInitalState(text); });
connect(d->m_stateWidget->defaultStateComboBox, &QComboBox::textActivated, this, [this](const QString &text) { d->setDefaultState(text); });
#else
connect(d->m_stateWidget->initialStateComboBox, SIGNAL(activated(QString)), SLOT(setInitalState(QString)));
connect(d->m_stateWidget->defaultStateComboBox, SIGNAL(activated(QString)), SLOT(setDefaultState(QString)));
#endif
connect(d->m_stateWidget->onEntryEditor, SIGNAL(editingFinished(QString)), SLOT(updateSimpleProperty()));
connect(d->m_stateWidget->onExitEditor, SIGNAL(editingFinished(QString)), SLOT(updateSimpleProperty()));
connect(d->m_stateWidget->childModeEdit, SIGNAL(currentIndexChanged(int)), SLOT(updateSimpleProperty()));
connect(d->m_stateWidget->childModeEdit, SIGNAL(currentIndexChanged(int)), SLOT(childModeChanged()));
connect(d->m_stateWidget->historyTypeEdit, SIGNAL(currentIndexChanged(int)), SLOT(updateSimpleProperty()));

connect(d->m_transitionWidget->labelLineEdit, SIGNAL(editingFinished()), SLOT(updateSimpleProperty()));
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
connect(d->m_transitionWidget->sourceStateComboBox, &QComboBox::textActivated, this, [this](const QString &text) { d->setSourceState(text); });
connect(d->m_transitionWidget->targetStateComboBox, &QComboBox::textActivated, this, [this](const QString &text) { d->setTargetState(text); });
#else
connect(d->m_transitionWidget->sourceStateComboBox, SIGNAL(activated(QString)), SLOT(setSourceState(QString)));
connect(d->m_transitionWidget->targetStateComboBox, SIGNAL(activated(QString)), SLOT(setTargetState(QString)));
#endif
connect(d->m_transitionWidget->guardEditor, SIGNAL(editingFinished(QString)), SLOT(updateSimpleProperty()));
connect(d->m_transitionWidget->signalEdit, SIGNAL(editingFinished()), SLOT(updateSimpleProperty()));
connect(d->m_transitionWidget->timeoutEdit, SIGNAL(valueChanged(int)), SLOT(updateSimpleProperty()));
Expand Down

0 comments on commit 9eb273f

Please sign in to comment.