Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Porting Tiled to Qt 6 #2909

Merged
merged 15 commits into from
Oct 13, 2020
Merged

Porting Tiled to Qt 6 #2909

merged 15 commits into from
Oct 13, 2020

Conversation

bjorn
Copy link
Member

@bjorn bjorn commented Oct 8, 2020

With the Qt 6.0 Alpha out it's time to start porting Tiled to Qt 6.

Of course, ideally while keeping it working against Qt 5.6, but more realistically we'll update the minimum required version of Qt to a more recent LTS version if that turns out to be too much effort.

(reopen of #2907, which was merged by accident, while still broken...)

@bjorn bjorn force-pushed the wip/qt6 branch 7 times, most recently from 4dca7f1 to f17df50 Compare October 8, 2020 21:03
Still a large amount of work remaining to port the rest of the code.
Removed the JsonReader class, which is now no longer necessary and was
using QTextCodec, which got removed in Qt 6.
Removed not very important "DontUseSheet" enum value that got stripped
from Qt 6.
* QRegExp -> QRegularExpression
* Use new version of qChecksum
Further removal of QStringRef would be possible if the minimum Qt
version would be raised to Qt 5.10, though even with 5.15 QtringView
does not entirely replace QStringRef unfortunately.
* QRegExp -> QRegularExpression
* QLocale::decimalPoint now returns QString
* QStyleOption::init -> initFrom
* QLayout::setMargin -> setContentsMargins
* QFont::resolve -> resolveMask (hidden API...)
Was apparently obsolete since at least Qt 5.6 already, but was never
marked with a warning or exclusion macro...
Replaced with QRegularExpression, except for one case where wildcard
matching is done, since QRegularExpression::wildcardToRegularExpression
only exists since Qt 5.15.
* qHash changed signature
* qrand() was removed (replaced with QRandomGenerator)
* QDesktopWidget was removed (now using QWidget::screen)
* QDataStream open mode enum changed location
* Qt::AA_UseHighDpiPixmaps was removed
* Adjustments due to flags deleting operator+
* QWheelEvent API changed
* QWidget::enterEvent takes a custom QEnterEvent
* Qt::MidButton was removed (replaced with Qt::MiddleButton)
* QTextCodec was removed (replaced with encoding enum, but decided to
  remove TextFile.codec for now)
* QLinkedList deprecated (replaced with std::list)
* QMap::insertMulti removed (need to use QMultiMap)
* Need to depend on openglwidgets module for QOpenGLWidget
Also adjusted another use of the removed QString::splitRef.
It appears types used in properties, signals, Q_INVOKABLE functions,
etc. now need to be fully defined even when only referenced by pointer.
This created many circular dependency issues, which is why I've opted to
change many of such occurrences to QObject* and adding qobject_cast or
static_cast where necessary.
* QSet::const_iterator no longer supports + operator
* Further adjusting to removal of QString::midRef / QStringRef
* QGuiApplication::setFallbackSessionManagementEnabled was removed
* Qt::AA_DisableWindowContextHelpButton was removed
* Shortcut modifiers no longer support + operator
* Re-introduced TextFile.codec based on QStringConverter, but supporting
  less encodings
* JSON binary data for tile stamps is no longer supported (but it appears
  Tiled never wrote these files in binary data, fortunately)
* QShortcut parent is now QObject* instead of QWidget*

Unfortunately, a linker issue remains when compiling with Qbs:

    /usr/bin/ld: cannot find -l-pthread
* Data modification when using QStringConverter::encodingForData
  (QTBUG-87466)

* Crash when calling QStringDecoder::decode (not reported yet, unsure
  what causes it).

For now we assume scripts are saved as UTF-8 when compiling against
Qt 6.
@bjorn bjorn merged commit e5f65a5 into master Oct 13, 2020
@bjorn bjorn deleted the wip/qt6 branch November 10, 2020 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant