diff --git a/Engine/AppManager.cpp b/Engine/AppManager.cpp index 9174556ee..071f46b2d 100644 --- a/Engine/AppManager.cpp +++ b/Engine/AppManager.cpp @@ -88,7 +88,6 @@ #include #include #include -#include #include #include #include diff --git a/Engine/CLArgs.cpp b/Engine/CLArgs.cpp index e91b46cee..108d64e89 100644 --- a/Engine/CLArgs.cpp +++ b/Engine/CLArgs.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include "Global/GlobalDefines.h" #include "Global/GitVersion.h" @@ -1139,10 +1140,10 @@ CLArgsPrivate::parse() // A clean solution would be to separate the scriptName and the fileName with a comma. if ( it != args.end() && !it->startsWith( QChar::fromLatin1('-') ) ) { // Check that it's neither a python script, a natron project, nor a frame range. - QRegExp re( QString::fromUtf8("[0-9\\-,]*") ); // Matches frame ranges. + QRegularExpression re( QString::fromUtf8("[0-9\\-,]*") ); // Matches frame ranges. if (!it->endsWith(QString::fromUtf8(".py"), Qt::CaseInsensitive) && !it->endsWith(QString::fromUtf8(".ntp"), Qt::CaseInsensitive) && - !re.exactMatch(*it)) { + !re.match(*it).hasMatch()) { w.filename = *it; #ifdef __NATRON_UNIX__ w.filename = AppManager::qt_tildeExpansion(w.filename); diff --git a/Engine/EffectInstance.cpp b/Engine/EffectInstance.cpp index 0234ee387..d267e6e4c 100644 --- a/Engine/EffectInstance.cpp +++ b/Engine/EffectInstance.cpp @@ -4097,7 +4097,11 @@ EffectInstance::attachOpenGLContext_public(const OSGLContextPtr& glContext, { NON_RECURSIVE_ACTION(); bool concurrentGLRender = supportsConcurrentOpenGLRenders(); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + std::unique_ptr> locker; +#else std::unique_ptr locker; +#endif if (concurrentGLRender) { locker.reset( new QMutexLocker(&_imp->attachedContextsMutex) ); } else { @@ -4131,7 +4135,11 @@ EffectInstance::attachOpenGLContext_public(const OSGLContextPtr& glContext, void EffectInstance::dettachAllOpenGLContexts() { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QMutexLocker locker(&_imp->attachedContextsMutex); +#else QMutexLocker locker(&_imp->attachedContextsMutex); +#endif for (EffectInstance::OpenGLContextEffectsMap::iterator it = _imp->attachedContexts.begin(); it != _imp->attachedContexts.end(); ++it) { OSGLContextPtr context = it->first.lock(); @@ -4158,7 +4166,11 @@ EffectInstance::dettachOpenGLContext_public(const OSGLContextPtr& glContext, con { NON_RECURSIVE_ACTION(); bool concurrentGLRender = supportsConcurrentOpenGLRenders(); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + std::unique_ptr> locker; +#else std::unique_ptr locker; +#endif if (concurrentGLRender) { locker.reset( new QMutexLocker(&_imp->attachedContextsMutex) ); } diff --git a/Engine/EffectInstanceRenderRoI.cpp b/Engine/EffectInstanceRenderRoI.cpp index de9da7d0e..069119d55 100644 --- a/Engine/EffectInstanceRenderRoI.cpp +++ b/Engine/EffectInstanceRenderRoI.cpp @@ -1517,7 +1517,12 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, ///locks belongs to an instance) +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + std::unique_ptr> locker; + std::unique_ptr> recursiveLocker; +#else std::unique_ptr locker; +#endif EffectInstancePtr renderInstance; @@ -1535,11 +1540,19 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, assert(renderInstance); if (safety == eRenderSafetyInstanceSafe) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + locker.reset( new QMutexLocker( &getNode()->getRenderInstancesSharedMutex() ) ); +#else locker.reset( new QMutexLocker( &getNode()->getRenderInstancesSharedMutex() ) ); +#endif } else if (safety == eRenderSafetyUnsafe) { const Plugin* p = getNode()->getPlugin(); assert(p); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + recursiveLocker.reset( new QMutexLocker( p->getPluginLock() ) ); +#else locker.reset( new QMutexLocker( p->getPluginLock() ) ); +#endif } else { // no need to lock Q_UNUSED(locker); diff --git a/Engine/EngineFwd.h b/Engine/EngineFwd.h index 55f1bf6fb..600ffd5e7 100644 --- a/Engine/EngineFwd.h +++ b/Engine/EngineFwd.h @@ -28,6 +28,8 @@ #include "Global/Macros.h" +#include + #include #include #include @@ -61,7 +63,13 @@ class QNetworkRequest; class QProcess; class QSettings; class QString; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +template class QList; +template using QVector = QList; +using QStringList = QList; +#else class QStringList; +#endif class QThread; class QTimer; class QUrl; diff --git a/Engine/FileSystemModel.cpp b/Engine/FileSystemModel.cpp index 9529b707e..b9457d1e6 100644 --- a/Engine/FileSystemModel.cpp +++ b/Engine/FileSystemModel.cpp @@ -47,6 +47,7 @@ CLANG_DIAG_OFF(uninitialized) #include #include #include +#include CLANG_DIAG_ON(deprecated) CLANG_DIAG_ON(uninitialized) @@ -193,7 +194,7 @@ struct FileSystemModelPrivate QStringList headers; QDir::Filters filters; QString encodedRegexps; - std::list regexps; + std::list regexps; mutable QMutex filtersMutex; mutable QMutex sequenceModeEnabledMutex; bool sequenceModeEnabled; @@ -842,7 +843,7 @@ FileSystemModel::data(const QModelIndex &index, data = item->fileExtension(); break; case DateModified: - data = item->getLastModified().toString(Qt::LocalDate); + data = item->getLastModified().toString(QLocale::system().dateTimeFormat()); break; default: break; @@ -1041,7 +1042,8 @@ FileSystemModel::setRegexpFilters(const QString& filters) ++i; } if ( regExp != QString( QLatin1Char('*') ) ) { - QRegExp rx(regExp, Qt::CaseInsensitive, QRegExp::Wildcard); + QRegularExpression rx(QRegularExpression::wildcardToRegularExpression(regExp)); + rx.setPatternOptions(QRegularExpression::CaseInsensitiveOption); if ( rx.isValid() ) { _imp->regexps.push_back(rx); } @@ -1082,8 +1084,8 @@ FileSystemModel::isAcceptedByRegexps(const QString & path) const return true; } - for (std::list::const_iterator it = _imp->regexps.begin(); it != _imp->regexps.end(); ++it) { - if ( it->exactMatch(path) ) { + for (std::list::const_iterator it = _imp->regexps.begin(); it != _imp->regexps.end(); ++it) { + if ( it->match(path).hasMatch() ) { return true; } } diff --git a/Engine/Markdown.cpp b/Engine/Markdown.cpp index 718decd6a..c9dd2bf29 100644 --- a/Engine/Markdown.cpp +++ b/Engine/Markdown.cpp @@ -30,7 +30,7 @@ CLANG_DIAG_OFF(deprecated) CLANG_DIAG_OFF(uninitialized) #include -#include +#include CLANG_DIAG_ON(deprecated) CLANG_DIAG_ON(uninitialized) @@ -79,7 +79,7 @@ QString Markdown::parseCustomLinksForHTML(const QString& markdown) { QString result = markdown; - QRegExp rx( QString::fromUtf8("(\\|html::[^|]*\\|)\\|rst::[^|]*\\|") ); + QRegularExpression rx( QString::fromUtf8("(\\|html::[^|]*\\|)\\|rst::[^|]*\\|") ); result.replace( rx, QString::fromUtf8("\\1") ); return result; @@ -105,10 +105,9 @@ Markdown::fixSettingsHTML(const QString &html) QStringList list = html.split( QString::fromUtf8("\n") ); Q_FOREACH(const QString &line, list) { if ( line.startsWith(QString::fromUtf8("

")) ) { - QRegExp rx( QString::fromUtf8("

(.*)

") ); - rx.indexIn(line); - QString header = rx.cap(1); - QString headerLink = header.toLower(); + QRegularExpression rx( QString::fromUtf8("

(.*)

") ); + QString header(rx.match(line).captured(1)); + QString headerLink(header.toLower()); headerLink.replace( QString::fromUtf8(" "), QString::fromUtf8("-") ); result.append(QString::fromUtf8("

%2

").arg(headerLink).arg(header)); } else { diff --git a/Engine/Node.cpp b/Engine/Node.cpp index 8d6add034..346fda974 100644 --- a/Engine/Node.cpp +++ b/Engine/Node.cpp @@ -42,7 +42,6 @@ #include #include #include -#include #include diff --git a/Engine/NodeDocumentation.cpp b/Engine/NodeDocumentation.cpp index 4d1ff2af6..216789e5b 100644 --- a/Engine/NodeDocumentation.cpp +++ b/Engine/NodeDocumentation.cpp @@ -27,6 +27,7 @@ #include #include +#include #include "Engine/EffectInstance.h" #include "Engine/KnobTypes.h" @@ -409,7 +410,7 @@ Node::makeDocumentation(bool genHTML) const pluginDescription = NATRON_NAMESPACE::convertFromPlainText(pluginDescription, NATRON_NAMESPACE::WhiteSpaceNormal); // replace URLs with links - QRegExp re( QString::fromUtf8("((http|ftp|https)://([\\w_-]+(?:(?:\\.[\\w_-]+)+))([\\w.,@?^=%&:/~+#-]*[\\w@?^=%&/~+#-])?)") ); + QRegularExpression re( QString::fromUtf8("((http|ftp|https)://([\\w_-]+(?:(?:\\.[\\w_-]+)+))([\\w.,@?^=%&:/~+#-]*[\\w@?^=%&/~+#-])?)") ); pluginDescription.replace( re, QString::fromUtf8("\\1") ); } else { pluginDescription = convertFromPlainTextToMarkdown(pluginDescription, genHTML, false); diff --git a/Engine/OSGLContext_x11.cpp b/Engine/OSGLContext_x11.cpp index b9e3f3ccf..1342ae907 100644 --- a/Engine/OSGLContext_x11.cpp +++ b/Engine/OSGLContext_x11.cpp @@ -33,6 +33,10 @@ #include +#include "Engine/AppManager.h" +#include "Engine/OSGLContext.h" +#include "Global/GLIncludes.h" + extern "C" { #include @@ -41,10 +45,6 @@ extern "C" #include } -#include "Engine/AppManager.h" -#include "Engine/OSGLContext.h" -#include "Global/GLIncludes.h" - #define GLX_VENDOR 1 #define GLX_RGBA_BIT 0x00000001 #define GLX_WINDOW_BIT 0x00000001 diff --git a/Engine/OutputEffectInstance.cpp b/Engine/OutputEffectInstance.cpp index 0db16894f..dd26f2855 100644 --- a/Engine/OutputEffectInstance.cpp +++ b/Engine/OutputEffectInstance.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include // QtCore on Qt4, QtConcurrent on Qt5 #include // QtCore on Qt4, QtConcurrent on Qt5 @@ -268,7 +268,7 @@ OutputEffectInstance::renderFullSequence(bool isBlocking, std::size_t foundHash = pattern.find_first_of("#"); if (foundHash == std::string::npos) { // Look for printf style numbering - QRegExp exp(QString::fromUtf8("%[0-9]*d")); + QRegularExpression exp(QString::fromUtf8("%[0-9]*d")); QString qp(QString::fromUtf8(pattern.c_str())); if (!qp.contains(exp)) { QString message = tr("You are trying to render the frame range [%1 - %2] but you did not specify any hash ('#') character(s) or printf-like format ('%d') for the padding. This will result in the same image being overwritten multiple times.").arg(first).arg(last); diff --git a/Engine/Project.cpp b/Engine/Project.cpp index cc6c75cf9..c28dfb707 100644 --- a/Engine/Project.cpp +++ b/Engine/Project.cpp @@ -55,6 +55,7 @@ #include #include #include // QtCore on Qt4, QtConcurrent on Qt5 +#include #include // OFX::XML::escape @@ -504,7 +505,7 @@ findBackups(const QString & filePath) ret.append(filePath); } // find files matching filePath.~[0-9]+~ - QRegExp rx(QString::fromUtf8("\\.~(\\d+)~$")); + QRegularExpression rx(QString::fromUtf8("\\.~(\\d+)~$")); QFileInfo fileInfo(filePath); QString fileName = fileInfo.fileName(); QDirIterator it(fileInfo.dir()); @@ -518,7 +519,9 @@ findBackups(const QString & filePath) // If the filename contains target string - put it in the hitlist QString fn = file.fileName(); - if (fn.startsWith(fileName) && rx.lastIndexIn(fn) == fileName.size()) { + QRegularExpressionMatch match(rx.match(fileName)); + qsizetype pos = match.capturedEnd(); + if (fn.startsWith(fileName) && pos == fileName.size()) { ret.append(file.filePath()); } } @@ -532,10 +535,11 @@ findBackups(const QString & filePath) static QString nextBackup(const QString & filePath) { - QRegExp rx(QString::fromUtf8("\\.~(\\d+)~$")); - int pos = rx.lastIndexIn(filePath); + QRegularExpression rx(QString::fromUtf8("\\.~(\\d+)~$")); + QRegularExpressionMatch match(rx.match(filePath)); + int pos = match.capturedEnd(); if (pos >= 0) { - int i = rx.cap(1).toInt(); + int i = match.captured(1).toInt(); return filePath.left(pos) + QString::fromUtf8(".~%1~").arg(i+1); } else { return filePath + QString::fromUtf8(".~1~"); @@ -756,7 +760,11 @@ Project::onAutoSaveTimerTriggered() if (canAutoSave) { std::shared_ptr > watcher = std::make_shared >(); QObject::connect( watcher.get(), SIGNAL(finished()), this, SLOT(onAutoSaveFutureFinished()) ); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + watcher->setFuture( QtConcurrent::run(&Project::autoSave, this) ); +#else watcher->setFuture( QtConcurrent::run(this, &Project::autoSave) ); +#endif _imp->autoSaveFutures.push_back(watcher); } else { ///If the auto-save failed because a render is in progress, try every 2 seconds to auto-save. diff --git a/Engine/PyGlobalFunctions.h b/Engine/PyGlobalFunctions.h index 505e3eac1..2a1867f6c 100644 --- a/Engine/PyGlobalFunctions.h +++ b/Engine/PyGlobalFunctions.h @@ -172,7 +172,11 @@ class PyCoreApplication inline int getBuildNumber() const { +#ifdef NATRON_BUILD_NUMBER return NATRON_BUILD_NUMBER; +#else + return 0; +#endif } inline bool is64Bit() const diff --git a/Engine/StandardPaths.cpp b/Engine/StandardPaths.cpp index adf0572fe..3cfe1457d 100644 --- a/Engine/StandardPaths.cpp +++ b/Engine/StandardPaths.cpp @@ -317,7 +317,7 @@ StandardPaths::writableLocation(StandardLocationEnum type) path = QStandardPaths::HomeLocation; break; case StandardPaths::eStandardLocationData: - path = QStandardPaths::DataLocation; + path = QStandardPaths::AppDataLocation; break; case StandardPaths::eStandardLocationCache: path = QStandardPaths::CacheLocation; diff --git a/Engine/TrackerNodeInteract.cpp b/Engine/TrackerNodeInteract.cpp index 493d4e0cc..e85383688 100644 --- a/Engine/TrackerNodeInteract.cpp +++ b/Engine/TrackerNodeInteract.cpp @@ -1099,7 +1099,11 @@ TrackerNodeInteract::refreshSelectedMarkerTexture() imageGetterWatcher = std::make_shared(); QObject::connect( imageGetterWatcher.get(), SIGNAL(finished()), this, SLOT(onTrackImageRenderingFinished()) ); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + imageGetterWatcher->setFuture( QtConcurrent::run(&TrackMarker::getMarkerImage, marker.get(), time, roi) ); +#else imageGetterWatcher->setFuture( QtConcurrent::run(marker.get(), &TrackMarker::getMarkerImage, time, roi) ); +#endif } void @@ -1130,7 +1134,11 @@ TrackerNodeInteract::makeMarkerKeyTexture(int time, TrackWatcherPtr watcher( new TrackWatcher() ); QObject::connect( watcher.get(), SIGNAL(finished()), this, SLOT(onKeyFrameImageRenderingFinished()) ); trackRequestsMap[k] = watcher; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + watcher->setFuture( QtConcurrent::run(&TrackMarker::getMarkerImage, track.get(), time, k.roi) ); +#else watcher->setFuture( QtConcurrent::run(track.get(), &TrackMarker::getMarkerImage, time, k.roi) ); +#endif } } diff --git a/Engine/typesystem_engine.xml b/Engine/typesystem_engine.xml index 7aa3a1ea6..99386d422 100644 --- a/Engine/typesystem_engine.xml +++ b/Engine/typesystem_engine.xml @@ -791,9 +791,9 @@ - + diff --git a/Gui/AboutWindow.cpp b/Gui/AboutWindow.cpp index 8dc8f5fda..f29f35561 100644 --- a/Gui/AboutWindow.cpp +++ b/Gui/AboutWindow.cpp @@ -37,12 +37,10 @@ CLANG_DIAG_OFF(deprecated) #include #include #include -#include #include #include #include CLANG_DIAG_ON(deprecated) -#include #include "Global/GlobalDefines.h" #include "Global/GitVersion.h" @@ -130,7 +128,7 @@ AboutWindow::AboutWindow(QWidget* parent) QString licenseStr; QFile license( QString::fromUtf8(":LICENSE_SHORT.txt") ); license.open(QIODevice::ReadOnly | QIODevice::Text); - licenseStr = NATRON_NAMESPACE::convertFromPlainText(QTextCodec::codecForName("UTF-8")->toUnicode( license.readAll() ), NATRON_NAMESPACE::WhiteSpaceNormal); + licenseStr = NATRON_NAMESPACE::convertFromPlainText(QString::fromUtf8( license.readAll() ), NATRON_NAMESPACE::WhiteSpaceNormal); aboutText.append(licenseStr); } { @@ -445,7 +443,7 @@ AboutWindow::AboutWindow(QWidget* parent) { QFile changelogFile( QString::fromUtf8(":CHANGELOG.md") ); changelogFile.open(QIODevice::ReadOnly | QIODevice::Text); - _changelogText->setText( QTextCodec::codecForName("UTF-8")->toUnicode( changelogFile.readAll() ) ); + _changelogText->setText( QString::fromUtf8( changelogFile.readAll() ) ); } _tabWidget->addTab( _changelogText, tr("Changelog") ); @@ -460,7 +458,7 @@ AboutWindow::AboutWindow(QWidget* parent) { QFile team_file( QString::fromUtf8(":CONTRIBUTORS.txt") ); team_file.open(QIODevice::ReadOnly | QIODevice::Text); - _teamText->setText( QTextCodec::codecForName("UTF-8")->toUnicode( team_file.readAll() ) ); + _teamText->setText( QString::fromUtf8( team_file.readAll() ) ); } _tabWidget->addTab( _teamText, tr("Contributors") ); @@ -469,7 +467,7 @@ AboutWindow::AboutWindow(QWidget* parent) { QFile license( QString::fromUtf8(":LICENSE.txt") ); license.open(QIODevice::ReadOnly | QIODevice::Text); - _licenseText->setText( QTextCodec::codecForName("UTF-8")->toUnicode( license.readAll() ) ); + _licenseText->setText( QString::fromUtf8( license.readAll() ) ); } _tabWidget->addTab( _licenseText, tr("License") ); @@ -563,7 +561,7 @@ AboutWindow::onSelectionChanged(const QItemSelection & newSelection, fileName += ( item->text() == QString::fromUtf8("README") ) ? QString::fromUtf8(".md") : QString::fromUtf8(".txt"); QFile file(fileName); if ( file.open(QIODevice::ReadOnly | QIODevice::Text) ) { - QString content = QTextCodec::codecForName("UTF-8")->toUnicode( file.readAll() ); + QString content = QString::fromUtf8( file.readAll() ); _thirdPartyBrowser->setText(content); } } diff --git a/Gui/ActionShortcuts.h b/Gui/ActionShortcuts.h index 68e8d4b9b..9a4b58e1c 100644 --- a/Gui/ActionShortcuts.h +++ b/Gui/ActionShortcuts.h @@ -657,7 +657,11 @@ extractKeySequence(const QKeySequence & seq, ///The nativeSeqStr now contains only the symbol QKeySequence newSeq(nativeSeqStr, QKeySequence::NativeText); if (newSeq.count() > 0) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + symbol = newSeq[0].key(); +#else symbol = (Qt::Key)newSeq[0]; +#endif } else { symbol = (Qt::Key)0; } diff --git a/Gui/ClickableLabel.cpp b/Gui/ClickableLabel.cpp index 9b0bfc35f..d9c97888f 100644 --- a/Gui/ClickableLabel.cpp +++ b/Gui/ClickableLabel.cpp @@ -180,7 +180,11 @@ KnobClickableLabel::~KnobClickableLabel() } void +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +KnobClickableLabel::enterEvent(QEnterEvent* e) +#else KnobClickableLabel::enterEvent(QEvent* e) +#endif { _dnd->mouseEnter(e); ClickableLabel::enterEvent(e); diff --git a/Gui/ClickableLabel.h b/Gui/ClickableLabel.h index 668f1005a..0352e2666 100644 --- a/Gui/ClickableLabel.h +++ b/Gui/ClickableLabel.h @@ -143,7 +143,11 @@ class KnobClickableLabel private: +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + virtual void enterEvent(QEnterEvent* e) OVERRIDE FINAL; +#else virtual void enterEvent(QEvent* e) OVERRIDE FINAL; +#endif virtual void leaveEvent(QEvent* e) OVERRIDE FINAL; virtual void keyPressEvent(QKeyEvent* e) OVERRIDE FINAL; virtual void keyReleaseEvent(QKeyEvent* e) OVERRIDE FINAL; diff --git a/Gui/ColorSelectorWidget.cpp b/Gui/ColorSelectorWidget.cpp index dc9934219..c46d55989 100644 --- a/Gui/ColorSelectorWidget.cpp +++ b/Gui/ColorSelectorWidget.cpp @@ -646,8 +646,13 @@ ColorSelectorWidget::ColorSelectorWidget(bool withAlpha, QWidget *parent) this, SLOT( handleSliderAMoved(double) ) ); } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QObject::connect( _buttonColorGroup, SIGNAL( buttonClicked(QAbstractButton*) ), + this, SLOT( handleButtonColorClicked(QAbstractButton*) ) ); +#else QObject::connect( _buttonColorGroup, SIGNAL( buttonClicked(int) ), this, SLOT( handleButtonColorClicked(int) ) ); +#endif QObject::connect( paletteAddColorButton, SIGNAL( clicked(bool) ), this, SLOT( setPaletteButtonColor(bool) ) ); @@ -1106,8 +1111,12 @@ void ColorSelectorWidget::handleHexChanged() value.prepend( QString::fromUtf8("#") ); } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QColor color( QColor::fromString(_hex->text()) ); +#else QColor color; color.setNamedColor( _hex->text() ); +#endif if ( !color.isValid() ) { return; } @@ -1222,6 +1231,16 @@ ColorSelectorWidget::setSliderVColor() _slideV->setUseLineColor(true, color); } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +void +ColorSelectorWidget::handleButtonColorClicked(QAbstractButton *button) +{ + QVariant var = button->property(COLOR_SELECTOR_BUTTON_PROPERTY); + if ( var.isValid() ) { + _stack->setCurrentIndex( var.toInt() ); + } +} +#else void ColorSelectorWidget::handleButtonColorClicked(int /*id*/) { @@ -1230,6 +1249,7 @@ ColorSelectorWidget::handleButtonColorClicked(int /*id*/) _stack->setCurrentIndex( var.toInt() ); } } +#endif void ColorSelectorWidget::setPaletteButtonColor(bool /*clicked*/) diff --git a/Gui/ColorSelectorWidget.h b/Gui/ColorSelectorWidget.h index 4cab7bbbb..3d8b89083 100644 --- a/Gui/ColorSelectorWidget.h +++ b/Gui/ColorSelectorWidget.h @@ -192,7 +192,11 @@ private Q_SLOTS: void setSliderSColor(); void setSliderVColor(); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + void handleButtonColorClicked(QAbstractButton *button); +#else void handleButtonColorClicked(int id); +#endif void setPaletteButtonColor(bool clicked = true); void clearPaletteButtons(bool clicked = true); diff --git a/Gui/CurveEditor.cpp b/Gui/CurveEditor.cpp index 04d0b73a3..2b24f3560 100644 --- a/Gui/CurveEditor.cpp +++ b/Gui/CurveEditor.cpp @@ -1559,7 +1559,11 @@ CurveEditor::keyReleaseEvent(QKeyEvent* e) } void +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +CurveEditor::enterEvent(QEnterEvent* e) +#else CurveEditor::enterEvent(QEvent* e) +#endif { enterEventBase(); QWidget::enterEvent(e); diff --git a/Gui/CurveEditor.h b/Gui/CurveEditor.h index 7cedd74ce..60691f5a0 100644 --- a/Gui/CurveEditor.h +++ b/Gui/CurveEditor.h @@ -380,7 +380,11 @@ public Q_SLOTS: private: virtual QUndoStack* getUndoStack() const OVERRIDE FINAL WARN_UNUSED_RETURN; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + virtual void enterEvent(QEnterEvent* e) OVERRIDE FINAL; +#else virtual void enterEvent(QEvent* e) OVERRIDE FINAL; +#endif virtual void leaveEvent(QEvent* e) OVERRIDE FINAL; virtual void keyPressEvent(QKeyEvent* e) OVERRIDE FINAL; virtual void keyReleaseEvent(QKeyEvent* e) OVERRIDE FINAL; diff --git a/Gui/CurveWidget.cpp b/Gui/CurveWidget.cpp index 67fe8b60e..2d023dddd 100644 --- a/Gui/CurveWidget.cpp +++ b/Gui/CurveWidget.cpp @@ -803,7 +803,11 @@ CurveWidget::mouseDoubleClickEvent(QMouseEvent* e) QScreen* desktop = QGuiApplication::primaryScreen(); QRect screen = desktop->availableGeometry(); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QPoint gP = e->globalPosition().toPoint(); +#else QPoint gP = e->globalPos(); +#endif if ( gP.x() > (screen.width() - dialogW) ) { gP.rx() -= dialogW; } @@ -1252,7 +1256,11 @@ CurveWidget::mouseMoveEvent(QMouseEvent* e) } } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QPointF newClick_opengl = _imp->zoomCtx.toZoomCoordinates( e->position().x(), e->position().y() ); +#else QPointF newClick_opengl = _imp->zoomCtx.toZoomCoordinates( e->x(), e->y() ); +#endif QPointF oldClick_opengl = _imp->zoomCtx.toZoomCoordinates( _imp->_lastMousePos.x(), _imp->_lastMousePos.y() ); double dx = ( oldClick_opengl.x() - newClick_opengl.x() ); double dy = ( oldClick_opengl.y() - newClick_opengl.y() ); @@ -1294,7 +1302,11 @@ CurveWidget::mouseMoveEvent(QMouseEvent* e) } break; case eEventStateSelecting: +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + _imp->refreshSelectionRectangle( (double)e->position().x(), (double)e->position().y() ); +#else _imp->refreshSelectionRectangle( (double)e->x(), (double)e->y() ); +#endif break; case eEventStateDraggingTangent: @@ -1313,8 +1325,13 @@ CurveWidget::mouseMoveEvent(QMouseEvent* e) if ( (_imp->zoomCtx.screenWidth() > 0) && (_imp->zoomCtx.screenHeight() > 0) ) { _imp->zoomOrPannedSinceLastFit = true; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + int deltaX = 2 * ( e->position().x() - _imp->_lastMousePos.x() ); + int deltaY = -2 * ( e->position().y() - _imp->_lastMousePos.y() ); +#else int deltaX = 2 * ( e->x() - _imp->_lastMousePos.x() ); int deltaY = -2 * ( e->y() - _imp->_lastMousePos.y() ); +#endif // Wheel: zoom values and time, keep point under mouse double scaleFactorX = std::pow( NATRON_WHEEL_ZOOM_PER_DELTA, deltaX); double scaleFactorY = std::pow( NATRON_WHEEL_ZOOM_PER_DELTA, deltaY); @@ -1592,7 +1609,11 @@ CurveWidget::keyPressEvent(QKeyEvent* e) } // keyPressEvent void +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +CurveWidget::enterEvent(QEnterEvent* e) +#else CurveWidget::enterEvent(QEvent* e) +#endif { setFocus(); QOpenGLWidget::enterEvent(e); diff --git a/Gui/CurveWidget.h b/Gui/CurveWidget.h index 1d9015a34..c83bd6e45 100644 --- a/Gui/CurveWidget.h +++ b/Gui/CurveWidget.h @@ -230,7 +230,11 @@ public Q_SLOTS: virtual void mouseDoubleClickEvent(QMouseEvent* e) OVERRIDE FINAL; virtual void mouseReleaseEvent(QMouseEvent* e) OVERRIDE FINAL; virtual void mouseMoveEvent(QMouseEvent* e) OVERRIDE FINAL; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + virtual void enterEvent(QEnterEvent* e) OVERRIDE FINAL; +#else virtual void enterEvent(QEvent* e) OVERRIDE FINAL; +#endif virtual void wheelEvent(QWheelEvent* e) OVERRIDE FINAL; virtual void keyPressEvent(QKeyEvent* e) OVERRIDE FINAL; virtual void focusInEvent(QFocusEvent* e) OVERRIDE FINAL; diff --git a/Gui/CurveWidgetPrivate.cpp b/Gui/CurveWidgetPrivate.cpp index dc3eea48a..e68c3132e 100644 --- a/Gui/CurveWidgetPrivate.cpp +++ b/Gui/CurveWidgetPrivate.cpp @@ -189,20 +189,20 @@ CurveWidgetPrivate::createMenu() QAction* copyKeyFramesAction = new ActionWithShortcut(kShortcutGroupCurveEditor, kShortcutIDActionCurveEditorCopy, kShortcutDescActionCurveEditorCopy, editMenu); - copyKeyFramesAction->setShortcut( QKeySequence(Qt::CTRL + Qt::Key_C) ); + copyKeyFramesAction->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_C) ); QObject::connect( copyKeyFramesAction, SIGNAL(triggered()), _widget, SLOT(copySelectedKeyFramesToClipBoard()) ); editMenu->addAction(copyKeyFramesAction); QAction* pasteKeyFramesAction = new ActionWithShortcut(kShortcutGroupCurveEditor, kShortcutIDActionCurveEditorPaste, kShortcutDescActionCurveEditorPaste, editMenu); - pasteKeyFramesAction->setShortcut( QKeySequence(Qt::CTRL + Qt::Key_V) ); + pasteKeyFramesAction->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_V) ); QObject::connect( pasteKeyFramesAction, SIGNAL(triggered()), _widget, SLOT(pasteKeyFramesFromClipBoardToSelectedCurve()) ); editMenu->addAction(pasteKeyFramesAction); QAction* selectAllAction = new ActionWithShortcut(kShortcutGroupCurveEditor, kShortcutIDActionCurveEditorSelectAll, kShortcutDescActionCurveEditorSelectAll, editMenu); - selectAllAction->setShortcut( QKeySequence(Qt::CTRL + Qt::Key_A) ); + selectAllAction->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_A) ); QObject::connect( selectAllAction, SIGNAL(triggered()), _widget, SLOT(selectAllKeyFrames()) ); editMenu->addAction(selectAllAction); diff --git a/Gui/DocumentationManager.cpp b/Gui/DocumentationManager.cpp index f112edd5e..9e32177ee 100644 --- a/Gui/DocumentationManager.cpp +++ b/Gui/DocumentationManager.cpp @@ -197,7 +197,7 @@ DocumentationManager::handler(QHttpRequest *req, } } if ( !staticPage.isEmpty() ) { - QFileInfo staticFileInfo = docDir + staticPage; + QFileInfo staticFileInfo(docDir + staticPage); if ( ( isStatic && !staticFileInfo.exists() ) || ( !isStatic && staticFileInfo.exists() ) ) { // must redirect @@ -510,9 +510,9 @@ DocumentationManager::handler(QHttpRequest *req, QFileInfo staticFileInfo; if ( page.startsWith( QString::fromUtf8("LOCAL_FILE/") ) ) { - staticFileInfo = page.replace( QString::fromUtf8("LOCAL_FILE/"), QString::fromUtf8("") ).replace( QString::fromUtf8("%2520"), QString::fromUtf8(" ") ).replace( QString::fromUtf8("%20"), QString::fromUtf8(" ") ); + staticFileInfo = QFileInfo(page.replace( QString::fromUtf8("LOCAL_FILE/"), QString::fromUtf8("") ).replace( QString::fromUtf8("%2520"), QString::fromUtf8(" ") ).replace( QString::fromUtf8("%20"), QString::fromUtf8(" ") )); } else { - staticFileInfo = docDir + page; + staticFileInfo = QFileInfo(docDir + page); } #ifdef DEBUG qDebug() << "www client requested page" << page << "->file" << staticFileInfo.absoluteFilePath(); diff --git a/Gui/DopeSheetEditor.cpp b/Gui/DopeSheetEditor.cpp index 7a1db6258..1ab8b1cf0 100644 --- a/Gui/DopeSheetEditor.cpp +++ b/Gui/DopeSheetEditor.cpp @@ -264,7 +264,11 @@ DopeSheetEditor::keyReleaseEvent(QKeyEvent* e) } void -DopeSheetEditor::enterEvent(QEvent *e) +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +DopeSheetEditor::enterEvent(QEnterEvent* e) +#else +DopeSheetEditor::enterEvent(QEvent* e) +#endif { enterEventBase(); QWidget::enterEvent(e); diff --git a/Gui/DopeSheetEditor.h b/Gui/DopeSheetEditor.h index 91f02a978..acbc71eeb 100644 --- a/Gui/DopeSheetEditor.h +++ b/Gui/DopeSheetEditor.h @@ -122,7 +122,11 @@ class DopeSheetEditor private: - virtual void enterEvent(QEvent *e) OVERRIDE FINAL; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + virtual void enterEvent(QEnterEvent* e) OVERRIDE FINAL; +#else + virtual void enterEvent(QEvent* e) OVERRIDE FINAL; +#endif virtual void leaveEvent(QEvent *e) OVERRIDE FINAL; virtual void keyPressEvent(QKeyEvent* e) OVERRIDE FINAL; virtual void keyReleaseEvent(QKeyEvent* e) OVERRIDE FINAL; diff --git a/Gui/DopeSheetHierarchyView.cpp b/Gui/DopeSheetHierarchyView.cpp index a65f46b37..a65ef60d2 100644 --- a/Gui/DopeSheetHierarchyView.cpp +++ b/Gui/DopeSheetHierarchyView.cpp @@ -798,7 +798,12 @@ HierarchyView::drawRow(QPainter *painter, painter->fillRect(itemRect.adjusted(-1, 0, 0, 0), fillColor); // Draw the item text +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QStyleOptionViewItem newOpt; + initViewItemOption(&newOpt); +#else QStyleOptionViewItem newOpt = viewOptions(); +#endif newOpt.rect = itemRect; @@ -849,7 +854,12 @@ HierarchyView::drawBranches(QPainter *painter, painter->fillRect(rectForDull, nodeColorDull); // Draw the branch indicator +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QStyleOptionViewItem option; + initViewItemOption(&option); +#else QStyleOptionViewItem option = viewOptions(); +#endif option.rect = _imp->getParentArrowRect(item, rect); option.displayAlignment = Qt::AlignCenter; diff --git a/Gui/DopeSheetView.cpp b/Gui/DopeSheetView.cpp index b0c7bc016..07b9ac05b 100644 --- a/Gui/DopeSheetView.cpp +++ b/Gui/DopeSheetView.cpp @@ -2172,7 +2172,11 @@ DopeSheetViewPrivate::computeGroupRange(DSNode *group) void DopeSheetViewPrivate::onMouseLeftButtonDrag(QMouseEvent *e) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QPointF mouseZoomCoords = zoomContext.toZoomCoordinates( e->position().x(), e->position().y() ); +#else QPointF mouseZoomCoords = zoomContext.toZoomCoordinates( e->x(), e->y() ); +#endif QPointF lastZoomCoordsOnMousePress = zoomContext.toZoomCoordinates( lastPosOnMousePress.x(), lastPosOnMousePress.y() ); QPointF lastZoomCoordsOnMouseMove = zoomContext.toZoomCoordinates( lastPosOnMouseMove.x(), @@ -3331,7 +3335,11 @@ DopeSheetView::mousePressEvent(QMouseEvent *e) return; } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QPointF clickZoomCoords = _imp->zoomContext.toZoomCoordinates( e->position().x(), e->position().y() ); +#else QPointF clickZoomCoords = _imp->zoomContext.toZoomCoordinates( e->x(), e->y() ); +#endif if ( buttonDownIsLeft(e) ) { if ( !_imp->selectedKeysBRect.isNull() && _imp->isNearbySelectedKeysBRec( e->pos() ) ) { @@ -3426,7 +3434,11 @@ DopeSheetView::mousePressEvent(QMouseEvent *e) } // if (!didSomething) if (!didSomething) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QTreeWidgetItem *treeItem = _imp->hierarchyView->itemAt( 0, e->position().y() ); +#else QTreeWidgetItem *treeItem = _imp->hierarchyView->itemAt( 0, e->y() ); +#endif //Did not find a range node, look for keyframes if (treeItem) { DSTreeItemNodeMap dsNodeItems = _imp->model->getItemNodeMap(); @@ -3497,14 +3509,22 @@ DopeSheetView::mouseMoveEvent(QMouseEvent *e) { running_in_main_thread(); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QPointF mouseZoomCoords = _imp->zoomContext.toZoomCoordinates( e->position().x(), e->position().y() ); +#else QPointF mouseZoomCoords = _imp->zoomContext.toZoomCoordinates( e->x(), e->y() ); +#endif if (e->buttons() == Qt::NoButton) { setCursor( _imp->getCursorDuringHover( e->pos() ) ); } else if (_imp->eventState == DopeSheetView::esZoomingView) { _imp->zoomOrPannedSinceLastFit = true; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + int deltaX = 2 * ( e->position().x() - _imp->lastPosOnMouseMove.x() ); +#else int deltaX = 2 * ( e->x() - _imp->lastPosOnMouseMove.x() ); +#endif double scaleFactorX = std::pow( NATRON_WHEEL_ZOOM_PER_DELTA, deltaX); QPointF zoomCenter = _imp->zoomContext.toZoomCoordinates( _imp->lastPosOnMousePress.x(), _imp->lastPosOnMousePress.y() ); diff --git a/Gui/FileTypeMainWindow_win.cpp b/Gui/FileTypeMainWindow_win.cpp index 5cf275db4..a3c92abd3 100644 --- a/Gui/FileTypeMainWindow_win.cpp +++ b/Gui/FileTypeMainWindow_win.cpp @@ -51,7 +51,7 @@ #include #include #include -#include +#include NATRON_NAMESPACE_ENTER @@ -283,9 +283,10 @@ DocumentWindow::ddeExecute(MSG* message, return true; } - QRegExp regCommand( QString::fromUtf8("^\\[(\\w+)\\((.*)\\)\\]$") ); - if ( regCommand.exactMatch(command) ) { - executeDdeCommand( regCommand.cap(1), regCommand.cap(2) ); + QRegularExpression regCommand( QString::fromUtf8("^\\[(\\w+)\\((.*)\\)\\]$") ); + QRegularExpressionMatch match(regCommand.match(command)); + if ( match.hasMatch() ) { + executeDdeCommand( match.captured(1), match.captured(2) ); } *result = 0; @@ -345,15 +346,16 @@ void DocumentWindow::executeDdeCommand(const QString& command, const QString& params) { - QRegExp regCommand( QString::fromUtf8("^\"(.*)\"$") ); - bool singleCommand = regCommand.exactMatch(params); + QRegularExpression regCommand( QString::fromUtf8("^\"(.*)\"$") ); + QRegularExpressionMatch match(regCommand.match(params)); + bool singleCommand = match.hasMatch(); if ( ( 0 == command.compare(QString::fromUtf8("open"), Qt::CaseInsensitive) ) && singleCommand ) { - ddeOpenFile( regCommand.cap(1) ); + ddeOpenFile( match.captured(1) ); } else if ( ( 0 == command.compare(QString::fromUtf8("new"), Qt::CaseInsensitive) ) && singleCommand ) { - ddeNewFile( regCommand.cap(1) ); + ddeNewFile( match.captured(1) ); } else if ( ( 0 == command.compare(QString::fromUtf8("print"), Qt::CaseInsensitive) ) && singleCommand ) { - ddePrintFile( regCommand.cap(1) ); + ddePrintFile( match.captured(1) ); } else { executeUnknownDdeCommand(command, params); } diff --git a/Gui/Gui.cpp b/Gui/Gui.cpp index b6972b2fd..f4bbb2812 100644 --- a/Gui/Gui.cpp +++ b/Gui/Gui.cpp @@ -281,7 +281,11 @@ Gui::toggleFullScreen() QWidget* activeWin = qApp->activeWindow(); if (!activeWin) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) + activateWindow(); +#else qApp->setActiveWindow(this); +#endif activeWin = this; } @@ -409,7 +413,12 @@ Gui::createGui() setupUi(); ///post a fake event so the qt handlers are called and the proper widget receives the focus +#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0) + QPointF pos(QCursor::pos()); + QMouseEvent e(QEvent::MouseMove, mapFromGlobal(pos), pos, Qt::NoButton, Qt::NoButton, Qt::NoModifier); +#else QMouseEvent e(QEvent::MouseMove, QCursor::pos(), Qt::NoButton, Qt::NoButton, Qt::NoModifier); +#endif qApp->sendEvent(this, &e); } diff --git a/Gui/Gui15.cpp b/Gui/Gui15.cpp index 9b64c2995..a79e27640 100644 --- a/Gui/Gui15.cpp +++ b/Gui/Gui15.cpp @@ -147,43 +147,43 @@ Gui::keySequenceForView(ViewIdx v) switch ( static_cast(v) ) { case 0: - return QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_1); + return QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_1); break; case 1: - return QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_2); + return QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_2); break; case 2: - return QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_3); + return QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_3); break; case 3: - return QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_4); + return QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_4); break; case 4: - return QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_5); + return QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_5); break; case 5: - return QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_6); + return QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_6); break; case 6: - return QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_7); + return QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_7); break; case 7: - return QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_8); + return QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_8); break; case 8: - return QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_9); + return QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_9); break; case 9: - return QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_0); + return QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_0); break; default: @@ -250,13 +250,13 @@ Gui::updateViewsActions(int viewsCount) if (viewsCount == 2) { QAction* left = new QAction(this); left->setCheckable(false); - left->setShortcut( QKeySequence(Qt::CTRL + Qt::Key_1) ); + left->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_1) ); _imp->viewersViewMenu->addAction(left); left->setText( tr("Display Left View") ); QObject::connect( left, SIGNAL(triggered()), this, SLOT(showView0()) ); QAction* right = new QAction(this); right->setCheckable(false); - right->setShortcut( QKeySequence(Qt::CTRL + Qt::Key_2) ); + right->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_2) ); _imp->viewersViewMenu->addAction(right); right->setText( tr("Display Right View") ); QObject::connect( right, SIGNAL(triggered()), this, SLOT(showView1()) ); diff --git a/Gui/Gui40.cpp b/Gui/Gui40.cpp index 181f12497..acdddd27a 100644 --- a/Gui/Gui40.cpp +++ b/Gui/Gui40.cpp @@ -179,10 +179,10 @@ Gui::updateRecentFileActions() } } - assert(files.size() <= (int)NATRON_MAX_RECENT_FILES); + assert(files.size() <= qsizetype(NATRON_MAX_RECENT_FILES)); assert(files.size() == fileNames.size()); assert(dirNames.size() == fileNames.size()); - int numRecentFiles = std::min(fileNames.size(), (int)NATRON_MAX_RECENT_FILES); + int numRecentFiles = std::min(qsizetype(fileNames.size()), qsizetype(NATRON_MAX_RECENT_FILES)); // the dirname can be the same too. for each fileName with count > 1, collect the indices of the identical filenames. if dirname and directory up-level is the same for at least two files, raise the directory level up until the two dirnames are different for (std::map::const_iterator it = allDirNames.begin(); it != allDirNames.end(); ++it) { @@ -194,9 +194,9 @@ Gui::updateRecentFileActions() for (int i = 0; i < dirs.size(); ++i) { dirParts[i] = QDir::toNativeSeparators(dirs.at(i)).split(QDir::separator(), Qt::SkipEmptyParts); } - int minComps = dirParts[0].size(); + qsizetype minComps = dirParts[0].size(); for (int i = 1; i < dirs.size(); ++i) { - minComps = std::min(minComps, dirParts[i].size()); + minComps = std::min(minComps, qsizetype(dirParts[i].size())); } // count the number of elements to remove int commonComps = 0; diff --git a/Gui/Gui50.cpp b/Gui/Gui50.cpp index ef6aa4191..c8c67536c 100644 --- a/Gui/Gui50.cpp +++ b/Gui/Gui50.cpp @@ -1287,7 +1287,11 @@ Gui::dropEvent(QDropEvent* e) QList urls = e->mimeData()->urls(); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + handleOpenFilesFromUrls( urls, mapToGlobal( e->position().toPoint() ) ); +#else handleOpenFilesFromUrls( urls, mapToGlobal( e->pos() ) ); +#endif } // dropEvent NATRON_NAMESPACE_EXIT diff --git a/Gui/GuiApplicationManager.cpp b/Gui/GuiApplicationManager.cpp index 25df689ca..092431d49 100644 --- a/Gui/GuiApplicationManager.cpp +++ b/Gui/GuiApplicationManager.cpp @@ -946,7 +946,11 @@ GuiApplicationManager::initGui(const CLArgs& args) QObject::connect( &_imp->updateSplashscreenTimer, SIGNAL(timeout()), this, SLOT(onFontconfigTimerTriggered()) ); _imp->updateSplashscreenTimer.start(1000); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + _imp->fontconfigUpdateWatcher->setFuture( QtConcurrent::run(&GuiApplicationManagerPrivate::updateFontConfigCache, _imp.get()) ); +#else _imp->fontconfigUpdateWatcher->setFuture( QtConcurrent::run(_imp.get(), &GuiApplicationManagerPrivate::updateFontConfigCache) ); +#endif Gui::loadStyleSheet(); diff --git a/Gui/GuiApplicationManager10.cpp b/Gui/GuiApplicationManager10.cpp index 452b4255c..f47f70bdb 100644 --- a/Gui/GuiApplicationManager10.cpp +++ b/Gui/GuiApplicationManager10.cpp @@ -41,8 +41,8 @@ CLANG_DIAG_OFF(uninitialized) #include #include #include -#include #include +#include CLANG_DIAG_ON(deprecated) CLANG_DIAG_ON(uninitialized) @@ -299,9 +299,9 @@ GuiApplicationManager::initializeQApp(int &argc, #endif app = new Application(this, argc, argv); } - QDesktopWidget* desktop = app->desktop(); - int dpiX = desktop->logicalDpiX(); - int dpiY = desktop->logicalDpiY(); + QScreen* desktop = app->primaryScreen(); + int dpiX = desktop->logicalDotsPerInchX(); + int dpiY = desktop->logicalDotsPerInchY(); setCurrentLogicalDPI(dpiX, dpiY); diff --git a/Gui/GuiApplicationManagerPrivate.h b/Gui/GuiApplicationManagerPrivate.h index 36fd49206..174f4471f 100644 --- a/Gui/GuiApplicationManagerPrivate.h +++ b/Gui/GuiApplicationManagerPrivate.h @@ -37,6 +37,7 @@ CLANG_DIAG_OFF(uninitialized) #include #include #include +#include CLANG_DIAG_ON(deprecated) CLANG_DIAG_ON(uninitialized) diff --git a/Gui/GuiFwd.h b/Gui/GuiFwd.h index d939dbe92..3973f02e5 100644 --- a/Gui/GuiFwd.h +++ b/Gui/GuiFwd.h @@ -81,6 +81,7 @@ class QPoint; class QPointF; class QProgressDialog; class QRectF; +class QRegularExpression; class QScrollArea; class QSplitter; class QStyleOptionViewItem; diff --git a/Gui/GuiPrivate.cpp b/Gui/GuiPrivate.cpp index d5fdde1c4..e79ca5d20 100644 --- a/Gui/GuiPrivate.cpp +++ b/Gui/GuiPrivate.cpp @@ -523,7 +523,11 @@ class AutoRaiseToolButton } } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + virtual void enterEvent(QEnterEvent* e) OVERRIDE FINAL +#else virtual void enterEvent(QEvent* e) OVERRIDE FINAL +#endif { AutoRaiseToolButton* btn = dynamic_cast( _gui->getToolButtonMenuOpened() ); diff --git a/Gui/Histogram.cpp b/Gui/Histogram.cpp index 6f09fab58..971aecb70 100644 --- a/Gui/Histogram.cpp +++ b/Gui/Histogram.cpp @@ -32,7 +32,6 @@ #include #include #include -#include GCC_DIAG_UNUSED_PRIVATE_FIELD_OFF // /opt/local/include/QtGui/qmime.h:119:10: warning: private field 'type' is not used [-Wunused-private-field] #include @@ -1266,7 +1265,11 @@ Histogram::mousePressEvent(QMouseEvent* e) _imp->state = eEventStateDraggingView; _imp->oldClick = e->pos(); } else if ( buttonDownIsRight(e) ) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + _imp->showMenu( e->globalPosition().toPoint() ); +#else _imp->showMenu( e->globalPos() ); +#endif } else if ( ( (e->buttons() & Qt::MiddleButton) && ( ( buttonMetaAlt(e) == Qt::AltModifier) || (e->buttons() & Qt::LeftButton) ) ) || ( (e->buttons() & Qt::LeftButton) && @@ -1285,7 +1288,11 @@ Histogram::mouseMoveEvent(QMouseEvent* e) // always running in the main thread assert( qApp && qApp->thread() == QThread::currentThread() ); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QPointF newClick_opengl = _imp->zoomCtx.toZoomCoordinates( e->position().x(), e->position().y() ); +#else QPointF newClick_opengl = _imp->zoomCtx.toZoomCoordinates( e->x(), e->y() ); +#endif QPointF oldClick_opengl = _imp->zoomCtx.toZoomCoordinates( _imp->oldClick.x(), _imp->oldClick.y() ); @@ -1302,12 +1309,20 @@ Histogram::mouseMoveEvent(QMouseEvent* e) computeHistogramAndRefresh(); break; case eEventStateZoomingView: { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + int delta = 2 * ( ( e->position().x() - _imp->oldClick.x() ) - ( e->position().y() - _imp->oldClick.y() ) ); +#else int delta = 2 * ( ( e->x() - _imp->oldClick.x() ) - ( e->y() - _imp->oldClick.y() ) ); +#endif const double zoomFactor_min = 0.000001; const double zoomFactor_max = 1000000.; double zoomFactor; double scaleFactor = std::pow( NATRON_WHEEL_ZOOM_PER_DELTA, delta); // no need to use ipow() here, because the result is not cast to int +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QPointF zoomCenter = _imp->zoomCtx.toZoomCoordinates( e->position().x(), e->position().y() ); +#else QPointF zoomCenter = _imp->zoomCtx.toZoomCoordinates( e->x(), e->y() ); +#endif // Wheel: zoom values and time, keep point under mouse @@ -1483,7 +1498,11 @@ Histogram::keyReleaseEvent(QKeyEvent* e) } void +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +Histogram::enterEvent(QEnterEvent* e) +#else Histogram::enterEvent(QEvent* e) +#endif { enterEventBase(); QOpenGLWidget::enterEvent(e); diff --git a/Gui/Histogram.h b/Gui/Histogram.h index 5abbbdbe3..cb848270a 100644 --- a/Gui/Histogram.h +++ b/Gui/Histogram.h @@ -109,7 +109,11 @@ public Q_SLOTS: virtual void wheelEvent(QWheelEvent* e) OVERRIDE FINAL; virtual void keyPressEvent(QKeyEvent* e) OVERRIDE FINAL; virtual void keyReleaseEvent(QKeyEvent* e) OVERRIDE FINAL; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + virtual void enterEvent(QEnterEvent* e) OVERRIDE FINAL; +#else virtual void enterEvent(QEvent* e) OVERRIDE FINAL; +#endif virtual void leaveEvent(QEvent* e) OVERRIDE FINAL; virtual void showEvent(QShowEvent* e) OVERRIDE FINAL; virtual QSize sizeHint() const OVERRIDE FINAL; diff --git a/Gui/KnobGuiBool.cpp b/Gui/KnobGuiBool.cpp index 1af3e8918..b17a83394 100644 --- a/Gui/KnobGuiBool.cpp +++ b/Gui/KnobGuiBool.cpp @@ -113,7 +113,11 @@ Bool_CheckBox::getBackgroundColor(double *r, } void +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +Bool_CheckBox::enterEvent(QEnterEvent* e) +#else Bool_CheckBox::enterEvent(QEvent* e) +#endif { _dnd->mouseEnter(e); AnimatedCheckBox::enterEvent(e); diff --git a/Gui/KnobGuiBool.h b/Gui/KnobGuiBool.h index ad86679b8..c38401dd1 100644 --- a/Gui/KnobGuiBool.h +++ b/Gui/KnobGuiBool.h @@ -77,7 +77,11 @@ class Bool_CheckBox private: +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + virtual void enterEvent(QEnterEvent* e) OVERRIDE FINAL; +#else virtual void enterEvent(QEvent* e) OVERRIDE FINAL; +#endif virtual void leaveEvent(QEvent* e) OVERRIDE FINAL; virtual void keyPressEvent(QKeyEvent* e) OVERRIDE FINAL; virtual void keyReleaseEvent(QKeyEvent* e) OVERRIDE FINAL; diff --git a/Gui/KnobGuiChoice.cpp b/Gui/KnobGuiChoice.cpp index 2a9ae4955..5335f0a50 100644 --- a/Gui/KnobGuiChoice.cpp +++ b/Gui/KnobGuiChoice.cpp @@ -116,7 +116,11 @@ KnobComboBox::wheelEvent(QWheelEvent *e) } void +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +KnobComboBox::enterEvent(QEnterEvent* e) +#else KnobComboBox::enterEvent(QEvent* e) +#endif { _dnd->mouseEnter(e); ComboBox::enterEvent(e); diff --git a/Gui/KnobGuiChoice.h b/Gui/KnobGuiChoice.h index 1b4218c80..c5d7725d3 100644 --- a/Gui/KnobGuiChoice.h +++ b/Gui/KnobGuiChoice.h @@ -68,7 +68,11 @@ class KnobComboBox private: virtual void wheelEvent(QWheelEvent *e) OVERRIDE FINAL; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + virtual void enterEvent(QEnterEvent* e) OVERRIDE FINAL; +#else virtual void enterEvent(QEvent* e) OVERRIDE FINAL; +#endif virtual void leaveEvent(QEvent* e) OVERRIDE FINAL; virtual void keyPressEvent(QKeyEvent* e) OVERRIDE FINAL; virtual void keyReleaseEvent(QKeyEvent* e) OVERRIDE FINAL; diff --git a/Gui/KnobGuiColor.cpp b/Gui/KnobGuiColor.cpp index 683c7cfe6..b265f4d25 100644 --- a/Gui/KnobGuiColor.cpp +++ b/Gui/KnobGuiColor.cpp @@ -106,7 +106,11 @@ ColorPickerLabel::mousePressEvent(QMouseEvent*) } void -ColorPickerLabel::enterEvent(QEvent*) +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +ColorPickerLabel::enterEvent(QEnterEvent* e) +#else +ColorPickerLabel::enterEvent(QEvent* e) +#endif { QToolTip::showText( QCursor::pos(), toolTip() ); } diff --git a/Gui/KnobGuiColor.h b/Gui/KnobGuiColor.h index 7dd3df212..3581ccb9b 100644 --- a/Gui/KnobGuiColor.h +++ b/Gui/KnobGuiColor.h @@ -97,7 +97,11 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON private: - virtual void enterEvent(QEvent*) OVERRIDE FINAL; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + virtual void enterEvent(QEnterEvent* e) OVERRIDE FINAL; +#else + virtual void enterEvent(QEvent* e) OVERRIDE FINAL; +#endif virtual void leaveEvent(QEvent*) OVERRIDE FINAL; virtual void mousePressEvent(QMouseEvent*) OVERRIDE FINAL; diff --git a/Gui/KnobGuiFile.cpp b/Gui/KnobGuiFile.cpp index 5d857118a..8e8b3b888 100644 --- a/Gui/KnobGuiFile.cpp +++ b/Gui/KnobGuiFile.cpp @@ -226,7 +226,7 @@ KnobGuiFile::updateGUI(int /*dimension*/) QString tt = toolTip(); tt.append( QString::fromUtf8("\n\nLast modified: ") ); - tt.append( dateTime.toString(Qt::SystemLocaleShortDate) ); + tt.append( dateTime.toString(QLocale::system().dateTimeFormat(QLocale::ShortFormat)) ); _lineEdit->setToolTip(tt); } } diff --git a/Gui/KnobGuiString.cpp b/Gui/KnobGuiString.cpp index d0ef55d9e..832d23aad 100644 --- a/Gui/KnobGuiString.cpp +++ b/Gui/KnobGuiString.cpp @@ -147,7 +147,11 @@ AnimatingTextEdit::setDirty(bool b) } void +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +AnimatingTextEdit::enterEvent(QEnterEvent* e) +#else AnimatingTextEdit::enterEvent(QEvent* e) +#endif { _dnd->mouseEnter(e); QTextEdit::enterEvent(e); @@ -270,7 +274,11 @@ KnobLineEdit::~KnobLineEdit() } void +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +KnobLineEdit::enterEvent(QEnterEvent* e) +#else KnobLineEdit::enterEvent(QEvent* e) +#endif { _dnd->mouseEnter(e); LineEdit::enterEvent(e); @@ -1354,7 +1362,7 @@ KnobGuiString::updateToolTip() tt += tr("This text area supports html encoding. " "Please check Qt website for more info."); } - QKeySequence seq(Qt::CTRL + Qt::Key_Return); + QKeySequence seq(Qt::CTRL | Qt::Key_Return); tt += tr("Use %1 to validate changes made to the text.").arg( seq.toString(QKeySequence::NativeText) ); _textEdit->setToolTip(tt); } else if (_lineEdit) { diff --git a/Gui/KnobGuiString.h b/Gui/KnobGuiString.h index 0217f1843..31cd10f02 100644 --- a/Gui/KnobGuiString.h +++ b/Gui/KnobGuiString.h @@ -109,7 +109,11 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON virtual void keyPressEvent(QKeyEvent* e) OVERRIDE; virtual void keyReleaseEvent(QKeyEvent* e) OVERRIDE; virtual void paintEvent(QPaintEvent* e) OVERRIDE; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + virtual void enterEvent(QEnterEvent* e) OVERRIDE FINAL; +#else virtual void enterEvent(QEvent* e) OVERRIDE FINAL; +#endif virtual void leaveEvent(QEvent* e) OVERRIDE FINAL; virtual void mousePressEvent(QMouseEvent* e) OVERRIDE FINAL; virtual void mouseMoveEvent(QMouseEvent* e) OVERRIDE FINAL; @@ -140,7 +144,11 @@ class KnobLineEdit virtual void focusInEvent(QFocusEvent* e) OVERRIDE FINAL; virtual void focusOutEvent(QFocusEvent* e) OVERRIDE FINAL; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + virtual void enterEvent(QEnterEvent* e) OVERRIDE FINAL; +#else virtual void enterEvent(QEvent* e) OVERRIDE FINAL; +#endif virtual void leaveEvent(QEvent* e) OVERRIDE FINAL; virtual void keyPressEvent(QKeyEvent* e) OVERRIDE FINAL; virtual void keyReleaseEvent(QKeyEvent* e) OVERRIDE FINAL; diff --git a/Gui/KnobUndoCommand.cpp b/Gui/KnobUndoCommand.cpp index 56a8b806e..bbdf5fdff 100644 --- a/Gui/KnobUndoCommand.cpp +++ b/Gui/KnobUndoCommand.cpp @@ -596,7 +596,7 @@ MultipleKnobEditsUndoCommand::mergeWith(const QUndoCommand *command) vit->setKeyFrame == wit->setKeyFrame) { //qDebug() << "mergeWith: update value for dim" << vit->dimension << "of knob" << foundExistinKnob->first.lock()->getKnob()->getName().c_str(); if (vit->oldValue != wit->newValue) { - qDebug() << "mergeWith: warning: old=" << vit->oldValue << "!= new=" << wit->newValue; + qDebug() << "mergeWith: warning: old=" << QVariant(vit->oldValue) << "!= new=" << QVariant(wit->newValue); } if (wit->newValue != vit->newValue) { //qDebug() << "mergeWith: update newValue" << wit->newValue << "->" << vit->newValue << "oldValue remains" << wit->oldValue; diff --git a/Gui/MessageBox.cpp b/Gui/MessageBox.cpp index e12c5d372..caf986a67 100644 --- a/Gui/MessageBox.cpp +++ b/Gui/MessageBox.cpp @@ -38,7 +38,6 @@ CLANG_DIAG_OFF(uninitialized) #include #include #include -#include CLANG_DIAG_ON(deprecated) CLANG_DIAG_ON(uninitialized) diff --git a/Gui/MultiInstancePanel.cpp b/Gui/MultiInstancePanel.cpp index 65368cf9a..acd967db6 100644 --- a/Gui/MultiInstancePanel.cpp +++ b/Gui/MultiInstancePanel.cpp @@ -404,12 +404,12 @@ TableItemDelegate::paint(QPainter * painter, QRect r; QString data; QVariant var = item->data(Qt::DisplayRole); - if ( var.canConvert(QVariant::String) ) { + if ( var.canConvert() ) { data = var.toString(); - } else if ( var.canConvert(QVariant::Double) ) { + } else if ( var.canConvert() ) { double d = var.toDouble(); data = QString::number(d); - } else if ( var.canConvert(QVariant::Int) ) { + } else if ( var.canConvert() ) { int i = var.toInt(); data = QString::number(i); } diff --git a/Gui/NodeCreationDialog.cpp b/Gui/NodeCreationDialog.cpp index f73f142bd..a2f909620 100644 --- a/Gui/NodeCreationDialog.cpp +++ b/Gui/NodeCreationDialog.cpp @@ -37,8 +37,7 @@ CLANG_DIAG_OFF(uninitialized) #include #include #include -#include -#include +#include #include #include CLANG_DIAG_ON(deprecated) @@ -151,12 +150,14 @@ CompleterLineEdit::filterText(const QString & txt) pattern.push_back(txt[i]); } pattern.push_back( QLatin1Char('*') ); - QRegExp expr(pattern, Qt::CaseInsensitive, QRegExp::WildcardUnix); + QRegularExpression expr(QRegularExpression::wildcardToRegularExpression(pattern)); + expr.setPatternOptions(QRegularExpression::CaseInsensitiveOption); #ifdef NODE_TAB_DIALOG_USE_MATCHED_LENGTH std::map matchOrdered; for (PluginsNamesMap::iterator it = _imp->names.begin(); it != _imp->names.end(); ++it) { - if ( expr.exactMatch(it->second.first) ) { + bool isMatch = expr.match(it->second.first).hasMatch(); + if ( isMatch ) { QStringList& matchedForLength = matchOrdered[expr.matchedLength()]; matchedForLength.push_front(it->second.second); } @@ -182,14 +183,6 @@ CompleterLineEdit::filterText(const QString & txt) } QPoint p = mapToGlobal( QPoint( 0, height() ) ); - //QDesktopWidget* desktop = QApplication::desktop(); - //QRect screen = desktop->screenGeometry(); - //double maxHeight = ( screen.height() - p.y() ) * 0.8; - //QFontMetrics fm = _imp->listView->fontMetrics(); - //maxHeight = std::min( maxHeight, ( rowCount * fm.height() * 1.2 + fm.height() ) ); - - // Position the text edit - // _imp->listView->setFixedSize(width(),maxHeight); _imp->listView->move(p); _imp->listView->show(); diff --git a/Gui/NodeGraph.h b/Gui/NodeGraph.h index 33677da99..8aa2d0982 100644 --- a/Gui/NodeGraph.h +++ b/Gui/NodeGraph.h @@ -260,7 +260,11 @@ public Q_SLOTS: bool isNearbyNavigator(const QPoint& widgetPos, QPointF& scenePos) const; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + virtual void enterEvent(QEnterEvent* e) OVERRIDE FINAL; +#else virtual void enterEvent(QEvent* e) OVERRIDE FINAL; +#endif virtual void leaveEvent(QEvent* e) OVERRIDE FINAL; virtual void keyPressEvent(QKeyEvent* e) OVERRIDE FINAL; virtual void keyReleaseEvent(QKeyEvent* e) OVERRIDE FINAL; diff --git a/Gui/NodeGraph10.cpp b/Gui/NodeGraph10.cpp index bf30258a2..3609ac0cd 100644 --- a/Gui/NodeGraph10.cpp +++ b/Gui/NodeGraph10.cpp @@ -240,8 +240,13 @@ NodeGraph::mousePressEvent(QMouseEvent* e) int ih = _imp->unlockIcon.height(); int w = width(); int offset = 20; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + if ( ( e->position().x() >= (w - iw - 10 - offset) ) && ( e->position().x() <= (w - 10 + offset) ) && + ( e->position().y() >= (10 - offset) ) && ( e->position().y() <= (10 + ih + offset) ) ) { +#else if ( ( e->x() >= (w - iw - 10 - offset) ) && ( e->x() <= (w - 10 + offset) ) && ( e->y() >= (10 - offset) ) && ( e->y() <= (10 + ih + offset) ) ) { +#endif assert(isGroup); isGroup->getNode()->setPyPlugEdited(true); NodesList nodes = isGroup->getNodes(); diff --git a/Gui/NodeGraph20.cpp b/Gui/NodeGraph20.cpp index b877b980e..e6e1a282f 100644 --- a/Gui/NodeGraph20.cpp +++ b/Gui/NodeGraph20.cpp @@ -500,7 +500,11 @@ NodeGraph::mouseMoveEvent(QMouseEvent* e) break; } case eEventStateZoomingArea: { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + int delta = 2 * ( ( e->position().x() - _imp->_lastMousePos.x() ) - ( e->position().y() - _imp->_lastMousePos.y() ) ); +#else int delta = 2 * ( ( e->x() - _imp->_lastMousePos.x() ) - ( e->y() - _imp->_lastMousePos.y() ) ); +#endif setTransformationAnchor(QGraphicsView::AnchorViewCenter); wheelEventInternal(modCASIsControl(e), delta); setTransformationAnchor(QGraphicsView::AnchorUnderMouse); diff --git a/Gui/NodeGraph30.cpp b/Gui/NodeGraph30.cpp index e7a245367..80602fb9d 100644 --- a/Gui/NodeGraph30.cpp +++ b/Gui/NodeGraph30.cpp @@ -139,7 +139,11 @@ NodeGraph::connectCurrentViewerToSelection(int inputNB, } // connectCurrentViewerToSelection void +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +NodeGraph::enterEvent(QEnterEvent* e) +#else NodeGraph::enterEvent(QEvent* e) +#endif { enterEventBase(); QGraphicsView::enterEvent(e); diff --git a/Gui/NodeGraph45.cpp b/Gui/NodeGraph45.cpp index b3e428c3f..7cb98e8b2 100644 --- a/Gui/NodeGraph45.cpp +++ b/Gui/NodeGraph45.cpp @@ -38,6 +38,7 @@ CLANG_DIAG_OFF(uninitialized) #include #include #include +#include GCC_DIAG_UNUSED_PRIVATE_FIELD_ON CLANG_DIAG_ON(deprecated) CLANG_DIAG_ON(uninitialized) @@ -366,16 +367,14 @@ FindNodeDialog::updateFindResults(const QString& filter) return; } - Qt::CaseSensitivity sensitivity = _imp->caseSensitivity->isChecked() ? Qt::CaseSensitive : Qt::CaseInsensitive; const NodesGuiList& activeNodes = _imp->graph->getAllActiveNodes(); - QRegExp exp(_imp->matchWhole->isChecked() ? filter : - ( QChar::fromLatin1('*') + filter + QChar::fromLatin1('*') ), - sensitivity, - QRegExp::Wildcard); + QRegularExpression exp(QRegularExpression::wildcardToRegularExpression( + _imp->matchWhole->isChecked() ? filter : ( QChar::fromLatin1('*') + filter + QChar::fromLatin1('*') ))); + exp.setPatternOptions(_imp->caseSensitivity->isChecked() ? QRegularExpression::NoPatternOption : QRegularExpression::CaseInsensitiveOption); if ( exp.isValid() ) { for (NodesGuiList::const_iterator it = activeNodes.begin(); it != activeNodes.end(); ++it) { - if ( (*it)->isVisible() && exp.exactMatch( QString::fromUtf8( (*it)->getNode()->getLabel().c_str() ) ) ) { + if ( (*it)->isVisible() && exp.match( QString::fromUtf8( (*it)->getNode()->getLabel().c_str() ) ).hasMatch() ) { _imp->nodeResults.push_back(*it); } } diff --git a/Gui/NodeViewerContext.cpp b/Gui/NodeViewerContext.cpp index 239282d73..c24d7c0b9 100644 --- a/Gui/NodeViewerContext.cpp +++ b/Gui/NodeViewerContext.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -242,7 +243,7 @@ addSpacer(QBoxLayout* layout) line->setFrameShape(QFrame::VLine); line->setFrameShadow(QFrame::Raised); QPalette palette; - palette.setColor(QPalette::Foreground, Qt::black); + palette.setColor(QPalette::WindowText, Qt::black); line->setPalette(palette); layout->addWidget(line); layout->addSpacing( TO_DPIX(5) ); diff --git a/Gui/PreferencesPanel.cpp b/Gui/PreferencesPanel.cpp index 375e35871..9ea78edd1 100644 --- a/Gui/PreferencesPanel.cpp +++ b/Gui/PreferencesPanel.cpp @@ -37,6 +37,7 @@ CLANG_DIAG_OFF(uninitialized) #include #include #include +#include #include #include #include @@ -819,7 +820,8 @@ PreferencesPanel::filterPlugins(const QString & txt) pattern.push_back(txt[i]); } pattern.push_back( QLatin1Char('*') ); - QRegExp expr(pattern, Qt::CaseInsensitive, QRegExp::WildcardUnix); + QRegularExpression expr(QRegularExpression::wildcardToRegularExpression(pattern)); + expr.setPatternOptions(QRegularExpression::CaseInsensitiveOption); std::list itemsToDisplay; for (PluginTreeNodeList::iterator it = _imp->pluginsList.begin(); it != _imp->pluginsList.end(); ++it) { if ( it->plugin && it->plugin->getLabelWithoutSuffix().contains(expr) ) { diff --git a/Gui/ProgressPanel.cpp b/Gui/ProgressPanel.cpp index b5797aefa..a1de44f30 100644 --- a/Gui/ProgressPanel.cpp +++ b/Gui/ProgressPanel.cpp @@ -299,7 +299,11 @@ ProgressPanel::keyReleaseEvent(QKeyEvent* e) } void +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +ProgressPanel::enterEvent(QEnterEvent* e) +#else ProgressPanel::enterEvent(QEvent* e) +#endif { enterEventBase(); QWidget::enterEvent(e); diff --git a/Gui/ProgressPanel.h b/Gui/ProgressPanel.h index 539823885..fb652042c 100644 --- a/Gui/ProgressPanel.h +++ b/Gui/ProgressPanel.h @@ -139,7 +139,11 @@ public Q_SLOTS: // overridden from QWidget virtual void keyPressEvent(QKeyEvent* e) OVERRIDE FINAL; virtual void keyReleaseEvent(QKeyEvent* e) OVERRIDE FINAL; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + virtual void enterEvent(QEnterEvent* e) OVERRIDE FINAL; +#else virtual void enterEvent(QEvent* e) OVERRIDE FINAL; +#endif virtual void leaveEvent(QEvent* e) OVERRIDE FINAL; std::unique_ptr _imp; TaskBar *_taskbar; diff --git a/Gui/PropertiesBinWrapper.cpp b/Gui/PropertiesBinWrapper.cpp index bad5bb61a..e65de0589 100644 --- a/Gui/PropertiesBinWrapper.cpp +++ b/Gui/PropertiesBinWrapper.cpp @@ -54,7 +54,11 @@ PropertiesBinWrapper::mousePressEvent(QMouseEvent* e) } void +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +PropertiesBinWrapper::enterEvent(QEnterEvent* e) +#else PropertiesBinWrapper::enterEvent(QEvent* e) +#endif { QWidget::enterEvent(e); } diff --git a/Gui/PropertiesBinWrapper.h b/Gui/PropertiesBinWrapper.h index 1b3c6d062..b470cfa3a 100644 --- a/Gui/PropertiesBinWrapper.h +++ b/Gui/PropertiesBinWrapper.h @@ -44,7 +44,11 @@ class PropertiesBinWrapper private: virtual void mousePressEvent(QMouseEvent* e) OVERRIDE FINAL; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + virtual void enterEvent(QEnterEvent* e) OVERRIDE FINAL; +#else virtual void enterEvent(QEvent* e) OVERRIDE FINAL; +#endif virtual void leaveEvent(QEvent* e) OVERRIDE FINAL; virtual void keyPressEvent(QKeyEvent* e) OVERRIDE FINAL; virtual void keyReleaseEvent(QKeyEvent* e) OVERRIDE FINAL; diff --git a/Gui/PythonPanels.cpp b/Gui/PythonPanels.cpp index 4173a01b8..8ff5a124a 100644 --- a/Gui/PythonPanels.cpp +++ b/Gui/PythonPanels.cpp @@ -537,7 +537,11 @@ PyPanel::mousePressEvent(QMouseEvent* e) } void +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +PyPanel::enterEvent(QEnterEvent* e) +#else PyPanel::enterEvent(QEvent* e) +#endif { enterEventBase(); QWidget::enterEvent(e); diff --git a/Gui/PythonPanels.h b/Gui/PythonPanels.h index b4acbe6f4..6205e3cb5 100644 --- a/Gui/PythonPanels.h +++ b/Gui/PythonPanels.h @@ -157,7 +157,11 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON void onUserDataChanged(); virtual void mousePressEvent(QMouseEvent* e) OVERRIDE; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + virtual void enterEvent(QEnterEvent* e) OVERRIDE; +#else virtual void enterEvent(QEvent* e) OVERRIDE; +#endif virtual void leaveEvent(QEvent* e) OVERRIDE; virtual void keyPressEvent(QKeyEvent* e) OVERRIDE; diff --git a/Gui/QGLWidgetCompat.h b/Gui/QGLWidgetCompat.h new file mode 100644 index 000000000..665ec94ef --- /dev/null +++ b/Gui/QGLWidgetCompat.h @@ -0,0 +1,39 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * This file is part of Natron , + * (C) 2018-2023 The Natron developers + * (C) 2013-2018 INRIA and Alexandre Gauthier-Foichat + * + * Natron is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Natron is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Natron. If not, see + * ***** END LICENSE BLOCK ***** */ + +// This is a header that provides type declarations that map a subset of the newer QOpenGL +// classes used by Natron with their older QGL counterparts + +#ifndef NATRON_GUI_QGLWIDGETCOMPAT_H +#define NATRON_GUI_QGLWIDGETCOMPAT_H + +#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) +#error "This file must not be included while using Qt >= 5.4.0" +#endif + +#include "Global/Macros.h" + +CLANG_DIAG_OFF(deprecated) +#include +CLANG_DIAG_ON(deprecated) + +typedef QGLWidget QOpenGLWidget; +typedef QGLContext QOpenGLContext; + +#endif // NATRON_GUI_QGLWIDGETCOMPAT_H diff --git a/Gui/QtColorTriangle.cpp b/Gui/QtColorTriangle.cpp index 5af0690b3..d28960cd7 100644 --- a/Gui/QtColorTriangle.cpp +++ b/Gui/QtColorTriangle.cpp @@ -215,7 +215,7 @@ void QtColorTriangle::genBackground() // Create an image of the same size as the contents rect. bg = QImage(contentsRect().size(), QImage::Format_RGB32); QPainter p(&bg); - p.setRenderHint(QPainter::HighQualityAntialiasing); + p.setRenderHint(QPainter::Antialiasing); p.fillRect(bg.rect(), palette().mid()); QConicalGradient gradient(bg.rect().center(), 90); diff --git a/Gui/RenderStatsDialog.cpp b/Gui/RenderStatsDialog.cpp index a3bb460be..f3dea4710 100644 --- a/Gui/RenderStatsDialog.cpp +++ b/Gui/RenderStatsDialog.cpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include "Engine/Node.h" #include "Engine/Timer.h" @@ -1010,12 +1010,14 @@ RenderStatsDialogPrivate::updateVisibleRowsInternal(const QString& nameFilter, if ( useUnixWildcardsCheckbox->isChecked() ) { - QRegExp nameExpr(nameFilter, Qt::CaseInsensitive, QRegExp::Wildcard); + QRegularExpression nameExpr(QRegularExpression::wildcardToRegularExpression(nameFilter)); + nameExpr.setPatternOptions(QRegularExpression::CaseInsensitiveOption); if ( !nameExpr.isValid() ) { return; } - QRegExp idExpr(pluginIDFilter, Qt::CaseInsensitive, QRegExp::Wildcard); + QRegularExpression idExpr(QRegularExpression::wildcardToRegularExpression(pluginIDFilter)); + idExpr.setPatternOptions(QRegularExpression::CaseInsensitiveOption); if ( !idExpr.isValid() ) { return; } @@ -1028,8 +1030,8 @@ RenderStatsDialogPrivate::updateVisibleRowsInternal(const QString& nameFilter, continue; } - if ( ( nameFilter.isEmpty() || nameExpr.exactMatch( QString::fromUtf8( node->getLabel().c_str() ) ) ) && - ( pluginIDFilter.isEmpty() || idExpr.exactMatch( QString::fromUtf8( node->getPluginID().c_str() ) ) ) ) { + if ( ( nameFilter.isEmpty() || nameExpr.match( QString::fromUtf8( node->getLabel().c_str() ) ).hasMatch() ) && + ( pluginIDFilter.isEmpty() || idExpr.match( QString::fromUtf8( node->getPluginID().c_str() ) ).hasMatch() ) ) { if ( view->isRowHidden(i, rootIdx) ) { view->setRowHidden(i, rootIdx, false); } diff --git a/Gui/RightClickableWidget.cpp b/Gui/RightClickableWidget.cpp index a1050b2ce..6370f3739 100644 --- a/Gui/RightClickableWidget.cpp +++ b/Gui/RightClickableWidget.cpp @@ -48,7 +48,11 @@ void RightClickableWidget::mousePressEvent(QMouseEvent* e) { if ( buttonDownIsRight(e) ) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QWidget* underMouse = qApp->widgetAt( e->globalPosition().toPoint() ); +#else QWidget* underMouse = qApp->widgetAt( e->globalPos() ); +#endif if (underMouse == this) { Q_EMIT rightClicked( e->pos() ); e->accept(); @@ -68,7 +72,11 @@ RightClickableWidget::keyPressEvent(QKeyEvent* e) } void +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +RightClickableWidget::enterEvent(QEnterEvent* e) +#else RightClickableWidget::enterEvent(QEvent* e) +#endif { // always running in the main thread assert( qApp && qApp->thread() == QThread::currentThread() ); diff --git a/Gui/RightClickableWidget.h b/Gui/RightClickableWidget.h index 853c1e62f..b72bc2428 100644 --- a/Gui/RightClickableWidget.h +++ b/Gui/RightClickableWidget.h @@ -80,7 +80,11 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON private: +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + virtual void enterEvent(QEnterEvent* e) OVERRIDE FINAL; +#else virtual void enterEvent(QEvent* e) OVERRIDE FINAL; +#endif virtual void keyPressEvent(QKeyEvent* e) OVERRIDE FINAL; virtual void mousePressEvent(QMouseEvent* e) OVERRIDE FINAL; }; diff --git a/Gui/RotoPanel.cpp b/Gui/RotoPanel.cpp index d102d70d7..0d7b6454e 100644 --- a/Gui/RotoPanel.cpp +++ b/Gui/RotoPanel.cpp @@ -301,7 +301,11 @@ class TreeWidget if ( index.isValid() && (index.column() != 0) && selection.contains(item) ) { Q_EMIT itemClicked( item, index.column() ); } else if ( triggerButtonIsRight(e) && index.isValid() ) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + _panel->showItemMenu( item, e->globalPosition().toPoint() ); +#else _panel->showItemMenu( item, e->globalPos() ); +#endif } else { QTreeWidget::mouseReleaseEvent(e); } @@ -1959,7 +1963,11 @@ TreeWidget::dragMoveEvent(QDragMoveEvent* e) { const QMimeData* mime = e->mimeData(); std::list droppedItems; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + bool ret = dragAndDropHandler(mime, e->position().toPoint(), droppedItems); +#else bool ret = dragAndDropHandler(mime, e->pos(), droppedItems); +#endif QTreeWidget::dragMoveEvent(e); if (!ret) { @@ -2142,7 +2150,11 @@ TreeWidget::dropEvent(QDropEvent* e) { std::list droppedItems; const QMimeData* mime = e->mimeData(); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + bool accepted = dragAndDropHandler(mime, e->position().toPoint(), droppedItems); +#else bool accepted = dragAndDropHandler(mime, e->pos(), droppedItems); +#endif e->setAccepted(accepted); @@ -2235,17 +2247,17 @@ RotoPanel::showItemMenu(QTreeWidgetItem* item, deleteAct->setShortcut( QKeySequence(Qt::Key_Backspace) ); QObject::connect( deleteAct, SIGNAL(triggered()), this, SLOT(onDeleteItemActionTriggered()) ); QAction* cutAct = menu.addAction( tr("Cut") ); - cutAct->setShortcut( QKeySequence(Qt::Key_X + Qt::CTRL) ); + cutAct->setShortcut( QKeySequence(Qt::Key_X | Qt::CTRL) ); QObject::connect( cutAct, SIGNAL(triggered()), this, SLOT(onCutItemActionTriggered()) ); QAction* copyAct = menu.addAction( tr("Copy") ); - copyAct->setShortcut( QKeySequence(Qt::Key_C + Qt::CTRL) ); + copyAct->setShortcut( QKeySequence(Qt::Key_C | Qt::CTRL) ); QObject::connect( copyAct, SIGNAL(triggered()), this, SLOT(onCopyItemActionTriggered()) ); QAction* pasteAct = menu.addAction( tr("Paste") ); - pasteAct->setShortcut( QKeySequence(Qt::Key_V + Qt::CTRL) ); + pasteAct->setShortcut( QKeySequence(Qt::Key_V | Qt::CTRL) ); QObject::connect( pasteAct, SIGNAL(triggered()), this, SLOT(onPasteItemActionTriggered()) ); pasteAct->setEnabled( !_imp->clipBoard.empty() ); QAction* duplicateAct = menu.addAction( tr("Duplicate") ); - duplicateAct->setShortcut( QKeySequence(Qt::Key_C + Qt::ALT) ); + duplicateAct->setShortcut( QKeySequence(Qt::Key_C | Qt::ALT) ); QObject::connect( duplicateAct, SIGNAL(triggered()), this, SLOT(onDuplicateItemActionTriggered()) ); ///The base layer cannot be duplicated diff --git a/Gui/ScaleSliderQWidget.cpp b/Gui/ScaleSliderQWidget.cpp index 195d4ce43..cdad13333 100644 --- a/Gui/ScaleSliderQWidget.cpp +++ b/Gui/ScaleSliderQWidget.cpp @@ -277,7 +277,11 @@ ScaleSliderQWidget::zoomRange() } void +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +ScaleSliderQWidget::enterEvent(QEnterEvent* e) +#else ScaleSliderQWidget::enterEvent(QEvent* e) +#endif { if ( Gui::isFocusStealingPossible() ) { setFocus(); @@ -448,7 +452,7 @@ ScaleSliderQWidget::paintEvent(QPaintEvent* /*e*/) ///fill the background with the appropriate style color QStyleOption opt; - opt.init(this); + opt.initFrom(this); QPainter p(this); p.setOpacity(1); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); diff --git a/Gui/ScaleSliderQWidget.h b/Gui/ScaleSliderQWidget.h index 642b4d777..a93bb5323 100644 --- a/Gui/ScaleSliderQWidget.h +++ b/Gui/ScaleSliderQWidget.h @@ -121,7 +121,11 @@ public Q_SLOTS: virtual QSize minimumSizeHint() const OVERRIDE FINAL; virtual void paintEvent(QPaintEvent* e) OVERRIDE FINAL; virtual void resizeEvent(QResizeEvent* e) OVERRIDE FINAL; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + virtual void enterEvent(QEnterEvent* e) OVERRIDE FINAL; +#else virtual void enterEvent(QEvent* e) OVERRIDE FINAL; +#endif virtual void leaveEvent(QEvent* e) OVERRIDE FINAL; virtual void focusInEvent(QFocusEvent* e) OVERRIDE FINAL; virtual void focusOutEvent(QFocusEvent* e) OVERRIDE FINAL; diff --git a/Gui/ScriptEditor.cpp b/Gui/ScriptEditor.cpp index a5957e524..83ec0f1ed 100644 --- a/Gui/ScriptEditor.cpp +++ b/Gui/ScriptEditor.cpp @@ -132,7 +132,7 @@ ScriptEditor::ScriptEditor(Gui* gui) appPTR->getIcon(NATRON_PIXMAP_SCRIPT_SAVE_SCRIPT, NATRON_MEDIUM_BUTTON_ICON_SIZE, &saveScriptPix); _imp->undoB = new Button(QIcon(undoPix), QString(), _imp->buttonsContainer); - QKeySequence undoSeq(Qt::CTRL + Qt::Key_BracketLeft); + QKeySequence undoSeq(Qt::CTRL | Qt::Key_BracketLeft); _imp->undoB->setFixedSize(NATRON_MEDIUM_BUTTON_SIZE, NATRON_MEDIUM_BUTTON_SIZE); _imp->undoB->setIconSize( QSize(NATRON_MEDIUM_BUTTON_ICON_SIZE, NATRON_MEDIUM_BUTTON_ICON_SIZE) ); _imp->undoB->setFocusPolicy(Qt::NoFocus); @@ -141,7 +141,7 @@ ScriptEditor::ScriptEditor(Gui* gui) QObject::connect( _imp->undoB, SIGNAL(clicked(bool)), this, SLOT(onUndoClicked()) ); _imp->redoB = new Button(QIcon(redoPix), QString(), _imp->buttonsContainer); - QKeySequence redoSeq(Qt::CTRL + Qt::Key_BracketRight); + QKeySequence redoSeq(Qt::CTRL | Qt::Key_BracketRight); _imp->redoB->setFocusPolicy(Qt::NoFocus); _imp->redoB->setFixedSize(NATRON_MEDIUM_BUTTON_SIZE, NATRON_MEDIUM_BUTTON_SIZE); _imp->redoB->setIconSize( QSize(NATRON_MEDIUM_BUTTON_ICON_SIZE, NATRON_MEDIUM_BUTTON_ICON_SIZE) ); @@ -180,7 +180,7 @@ ScriptEditor::ScriptEditor(Gui* gui) QObject::connect( _imp->saveScriptB, SIGNAL(clicked(bool)), this, SLOT(onSaveScriptClicked()) ); _imp->execScriptB = new Button(QIcon(execScriptPix), QString(), _imp->buttonsContainer); - QKeySequence execSeq(Qt::CTRL + Qt::Key_Return); + QKeySequence execSeq(Qt::CTRL | Qt::Key_Return); _imp->execScriptB->setFocusPolicy(Qt::NoFocus); _imp->execScriptB->setFixedSize(NATRON_MEDIUM_BUTTON_SIZE, NATRON_MEDIUM_BUTTON_SIZE); _imp->execScriptB->setIconSize( QSize(NATRON_MEDIUM_BUTTON_ICON_SIZE, NATRON_MEDIUM_BUTTON_ICON_SIZE) ); @@ -201,7 +201,7 @@ ScriptEditor::ScriptEditor(Gui* gui) QObject::connect( _imp->showHideOutputB, SIGNAL(clicked(bool)), this, SLOT(onShowHideOutputClicked(bool)) ); _imp->clearOutputB = new Button(QIcon(clearOutpoutPix), QString(), _imp->buttonsContainer); - QKeySequence clearSeq(Qt::CTRL + Qt::Key_Backspace); + QKeySequence clearSeq(Qt::CTRL | Qt::Key_Backspace); _imp->clearOutputB->setFocusPolicy(Qt::NoFocus); _imp->clearOutputB->setFixedSize(NATRON_MEDIUM_BUTTON_SIZE, NATRON_MEDIUM_BUTTON_SIZE); _imp->clearOutputB->setIconSize( QSize(NATRON_MEDIUM_BUTTON_ICON_SIZE, NATRON_MEDIUM_BUTTON_ICON_SIZE) ); @@ -621,7 +621,11 @@ ScriptEditor::printAutoDeclaredVariable(const QString& str) } void +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +ScriptEditor::enterEvent(QEnterEvent *e) +#else ScriptEditor::enterEvent(QEvent *e) +#endif { enterEventBase(); QWidget::enterEvent(e); diff --git a/Gui/ScriptEditor.h b/Gui/ScriptEditor.h index f2c32a929..971067483 100644 --- a/Gui/ScriptEditor.h +++ b/Gui/ScriptEditor.h @@ -111,7 +111,11 @@ public Q_SLOTS: virtual void focusInEvent(QFocusEvent* e) OVERRIDE FINAL; virtual void mousePressEvent(QMouseEvent* e) OVERRIDE FINAL; - virtual void enterEvent(QEvent *e) OVERRIDE FINAL; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + virtual void enterEvent(QEnterEvent* e) OVERRIDE FINAL; +#else + virtual void enterEvent(QEvent* e) OVERRIDE FINAL; +#endif virtual void leaveEvent(QEvent *e) OVERRIDE FINAL; virtual void keyPressEvent(QKeyEvent* e) OVERRIDE FINAL; virtual void keyReleaseEvent(QKeyEvent* e) OVERRIDE FINAL; diff --git a/Gui/ScriptTextEdit.cpp b/Gui/ScriptTextEdit.cpp index 5d58f1ad9..bd978f2ac 100644 --- a/Gui/ScriptTextEdit.cpp +++ b/Gui/ScriptTextEdit.cpp @@ -33,7 +33,7 @@ CLANG_DIAG_OFF(uninitialized) #include #include #include -#include +#include #include CLANG_DIAG_ON(deprecated) CLANG_DIAG_ON(uninitialized) @@ -58,13 +58,13 @@ struct PyHighLightRule const QTextCharFormat &matchingFormat) { originalRuleStr = patternStr; - pattern = QRegExp(patternStr); + pattern = QRegularExpression(patternStr); nth = n; format = matchingFormat; } QString originalRuleStr; - QRegExp pattern; + QRegularExpression pattern; int nth; QTextCharFormat format; }; @@ -77,8 +77,8 @@ struct PySyntaxHighlighterPrivate QStringList braces; QHash basicStyles; QList rules; - QRegExp triSingleQuote; - QRegExp triDoubleQuote; + QRegularExpression triSingleQuote; + QRegularExpression triDoubleQuote; PySyntaxHighlighterPrivate(PySyntaxHighlighter* publicInterface) : publicInterface(publicInterface) @@ -125,13 +125,15 @@ void PySyntaxHighlighter::highlightBlock(const QString &text) { for (QList::Iterator it = _imp->rules.begin(); it != _imp->rules.end(); ++it) { - int idx = it->pattern.indexIn(text, 0); + QRegularExpressionMatch match(it->pattern.match(text)); + int idx = match.capturedStart(); while (idx >= 0) { // Get index of Nth match - idx = it->pattern.pos(it->nth); - int length = it->pattern.cap(it->nth).length(); + idx = match.capturedStart(it->nth); + int length = match.captured(it->nth).length(); setFormat(idx, length, it->format); - idx = it->pattern.indexIn(text, idx + length); + match = it->pattern.match(text, idx + length); + idx = match.capturedStart(); } } @@ -186,7 +188,7 @@ PySyntaxHighlighterPrivate::initializeRules() bool PySyntaxHighlighter::matchMultiline(const QString &text, - const QRegExp &delimiter, + const QRegularExpression &delimiter, const int inState, const QTextCharFormat &style) { @@ -201,18 +203,20 @@ PySyntaxHighlighter::matchMultiline(const QString &text, start = 0; add = 0; } else { - start = delimiter.indexIn(text); + QRegularExpressionMatch match(delimiter.match(text)); + start = match.capturedStart(); // Move past this match - add = delimiter.matchedLength(); + add = match.capturedLength(); } // As long as there's a delimiter match on this line... while (start >= 0) { // Look for the ending delimiter - end = delimiter.indexIn(text, start + add); + QRegularExpressionMatch match(delimiter.match(text, start + add)); + end = match.capturedStart(); // Ending delimiter on this line? if (end >= add) { - length = end - start + add + delimiter.matchedLength(); + length = end - start + add + match.capturedLength(); setCurrentBlockState(0); } else { // No= multi-line string @@ -221,7 +225,8 @@ PySyntaxHighlighter::matchMultiline(const QString &text, } // Apply formatting and look for next setFormat(start, length, style); - start = delimiter.indexIn(text, start + length); + match = delimiter.match(text, start + length); + start = match.capturedStart(); } // Return True if still inside a multi-line string, False otherwise if (currentBlockState() == inState) { @@ -497,7 +502,11 @@ InputScriptTextEdit::dropEvent(QDropEvent* e) } void +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +InputScriptTextEdit::enterEvent(QEnterEvent* /*e*/) +#else InputScriptTextEdit::enterEvent(QEvent* /*e*/) +#endif { if ( acceptDrops() && (cursor().shape() != Qt::OpenHandCursor) ) { setCursor(Qt::OpenHandCursor); diff --git a/Gui/ScriptTextEdit.h b/Gui/ScriptTextEdit.h index f3ee988c8..fa5fb15bf 100644 --- a/Gui/ScriptTextEdit.h +++ b/Gui/ScriptTextEdit.h @@ -57,7 +57,7 @@ class PySyntaxHighlighter private: virtual void highlightBlock(const QString &text) OVERRIDE FINAL; - bool matchMultiline(const QString &text, const QRegExp &delimiter, const int inState, const QTextCharFormat &style); + bool matchMultiline(const QString &text, const QRegularExpression &delimiter, const int inState, const QTextCharFormat &style); std::unique_ptr _imp; }; @@ -98,7 +98,11 @@ private Q_SLOTS: virtual void dropEvent(QDropEvent* e) OVERRIDE FINAL; virtual void resizeEvent(QResizeEvent *event) OVERRIDE FINAL; virtual void dragMoveEvent(QDragMoveEvent* e) OVERRIDE FINAL; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + virtual void enterEvent(QEnterEvent* e) OVERRIDE FINAL; +#else virtual void enterEvent(QEvent* e) OVERRIDE FINAL; +#endif virtual void leaveEvent(QEvent* e) OVERRIDE FINAL; private: diff --git a/Gui/SequenceFileDialog.cpp b/Gui/SequenceFileDialog.cpp index 01a6c8019..ee24e1e4a 100644 --- a/Gui/SequenceFileDialog.cpp +++ b/Gui/SequenceFileDialog.cpp @@ -783,13 +783,13 @@ SequenceFileDialog::createMenuActions() { QAction *goHomeAction = new QAction(this); - goHomeAction->setShortcut(Qt::CTRL + Qt::Key_H + Qt::SHIFT); + goHomeAction->setShortcut(QKeySequence(Qt::CTRL, Qt::SHIFT, Qt::Key_H)); QObject::connect( goHomeAction, SIGNAL(triggered()), this, SLOT(goHome()) ); addAction(goHomeAction); QAction *goToParent = new QAction(this); - goToParent->setShortcut(Qt::CTRL + Qt::UpArrow); + goToParent->setShortcut(QKeySequence(Qt::CTRL, Qt::Key_Up)); QObject::connect( goToParent, SIGNAL(triggered()), this, SLOT(parentFolder()) ); addAction(goToParent); @@ -1892,7 +1892,11 @@ UrlModel::setData(const QModelIndex &index, const QVariant &value, int role) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + if (value.metaType().id() == QMetaType::QUrl) { +#else if (value.type() == QVariant::Url) { +#endif QUrl url = value.toUrl(); QModelIndex dirIndex = fileSystemModel->index( urlToPathString(url) ); QStandardItemModel::setData(index, QDir::toNativeSeparators( fileSystemModel->data(dirIndex, QFileSystemModel::FilePathRole).toString() ), Qt::ToolTipRole); diff --git a/Gui/SequenceFileDialog.h b/Gui/SequenceFileDialog.h index e9a2f92f9..2432166a3 100644 --- a/Gui/SequenceFileDialog.h +++ b/Gui/SequenceFileDialog.h @@ -47,7 +47,6 @@ CLANG_DIAG_OFF(uninitialized) #include #include #include -#include #include #include #include diff --git a/Gui/SpinBox.cpp b/Gui/SpinBox.cpp index df81b71a7..b7854def8 100644 --- a/Gui/SpinBox.cpp +++ b/Gui/SpinBox.cpp @@ -826,7 +826,11 @@ SpinBox::mouseMoveEvent(QMouseEvent *e) isReadOnly() || !hasFocus() ) { // Multiply by some amount to resemble a wheel event +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + int delta = ( e->position().x() - _imp->lastMousePos.x() ) * 3; +#else int delta = ( e->x() - _imp->lastMousePos.x() ) * 3; +#endif int shift = 0; if ( modCASIsShift(e) ) { shift = 1; @@ -1000,7 +1004,11 @@ KnobSpinBox::~KnobSpinBox() } void +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +KnobSpinBox::enterEvent(QEnterEvent* e) +#else KnobSpinBox::enterEvent(QEvent* e) +#endif { _dnd->mouseEnter(e); SpinBox::enterEvent(e); diff --git a/Gui/SpinBox.h b/Gui/SpinBox.h index d321d9166..a1968f0b4 100644 --- a/Gui/SpinBox.h +++ b/Gui/SpinBox.h @@ -171,7 +171,11 @@ class KnobSpinBox private: virtual void wheelEvent(QWheelEvent* e) OVERRIDE FINAL; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + virtual void enterEvent(QEnterEvent* e) OVERRIDE FINAL; +#else virtual void enterEvent(QEvent* e) OVERRIDE FINAL; +#endif virtual void leaveEvent(QEvent* e) OVERRIDE FINAL; virtual void keyPressEvent(QKeyEvent* e) OVERRIDE FINAL; virtual void keyReleaseEvent(QKeyEvent* e) OVERRIDE FINAL; diff --git a/Gui/SplashScreen.cpp b/Gui/SplashScreen.cpp index f3e44f258..96fbdbd51 100644 --- a/Gui/SplashScreen.cpp +++ b/Gui/SplashScreen.cpp @@ -112,7 +112,7 @@ SplashScreen::paintEvent(QPaintEvent*) { QStyleOption opt; - opt.init(this); + opt.initFrom(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); @@ -165,7 +165,7 @@ LoadProjectSplashScreen::paintEvent(QPaintEvent* /*e*/) { QStyleOption opt; - opt.init(this); + opt.initFrom(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); diff --git a/Gui/TabWidget.cpp b/Gui/TabWidget.cpp index 182ea6971..d865c9463 100644 --- a/Gui/TabWidget.cpp +++ b/Gui/TabWidget.cpp @@ -1451,7 +1451,11 @@ TabBar::mouseMoveEvent(QMouseEvent* e) } if ( _tabWidget->getGui()->isDraggingPanel() ) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QPoint globalPos(e->globalPosition().toPoint()); +#else const QPoint & globalPos = e->globalPos(); +#endif QWidget* widgetUnderMouse = qApp->widgetAt(globalPos); if (widgetUnderMouse) { TabWidget* topLvlTabWidget = findTabWidgetRecursive(widgetUnderMouse); @@ -1496,7 +1500,11 @@ TabBar::mouseMoveEvent(QMouseEvent* e) _tabWidget->startDragTab(selectedTabIndex); _dragPix = new DragPixmap( pixmap, e->pos() ); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + _dragPix->update( e->globalPosition().toPoint() ); +#else _dragPix->update( e->globalPos() ); +#endif _dragPix->show(); grabMouse(); } @@ -1567,7 +1575,11 @@ TabBar::mouseReleaseEvent(QMouseEvent* e) if ( _tabWidget->getGui()->isDraggingPanel() ) { releaseMouse(); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QPoint p(e->globalPosition().toPoint()); +#else const QPoint & p = e->globalPos(); +#endif hasClosedTabWidget = _tabWidget->stopDragTab(p); _dragPix->hide(); delete _dragPix; @@ -2040,7 +2052,11 @@ TabWidget::mouseMoveEvent(QMouseEvent* e) { if (!_imp->tabBarVisible) { QSize size = _imp->header->sizeHint(); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + if ( e->position().y() <= (size.height() * 1.2) ) { +#else if ( e->y() <= (size.height() * 1.2) ) { +#endif if ( !_imp->header->isVisible() ) { _imp->header->setVisible(true); } @@ -2051,7 +2067,11 @@ TabWidget::mouseMoveEvent(QMouseEvent* e) } } if ( _imp->gui && _imp->gui->isLeftToolBarDisplayedOnMouseHoverOnly() ) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + _imp->gui->refreshLeftToolBarVisibility( e->globalPosition().toPoint() ); +#else _imp->gui->refreshLeftToolBarVisibility( e->globalPos() ); +#endif } QFrame::mouseMoveEvent(e); } @@ -2064,7 +2084,11 @@ TabWidget::leaveEvent(QEvent* e) } void +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +TabWidget::enterEvent(QEnterEvent* e) +#else TabWidget::enterEvent(QEvent* e) +#endif { if (_imp->gui) { _imp->gui->setLastEnteredTabWidget(this); diff --git a/Gui/TabWidget.h b/Gui/TabWidget.h index 96b30e84c..c91d52b26 100644 --- a/Gui/TabWidget.h +++ b/Gui/TabWidget.h @@ -349,7 +349,11 @@ public Q_SLOTS: virtual void keyPressEvent(QKeyEvent* e) OVERRIDE FINAL; virtual void mouseMoveEvent(QMouseEvent* e) OVERRIDE FINAL; virtual void leaveEvent(QEvent* e) OVERRIDE FINAL; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + virtual void enterEvent(QEnterEvent* e) OVERRIDE FINAL; +#else virtual void enterEvent(QEvent* e) OVERRIDE FINAL; +#endif private: diff --git a/Gui/TableModelView.cpp b/Gui/TableModelView.cpp index 2840793d0..a99bb789a 100644 --- a/Gui/TableModelView.cpp +++ b/Gui/TableModelView.cpp @@ -43,6 +43,10 @@ #include "Gui/ComboBox.h" #include "Gui/SpinBox.h" +#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0) +using namespace Qt::Literals::StringLiterals; +#endif + NATRON_NAMESPACE_ENTER //////////////TableItem @@ -925,8 +929,7 @@ ExpandingLineEdit::updateMinimumWidth() QStyleOptionFrame opt; initStyleOption(&opt); - int minWidth = style()->sizeFromContents(QStyle::CT_LineEdit, &opt, QSize(width, 0). - expandedTo( QApplication::globalStrut() ), this).width(); + int minWidth = style()->sizeFromContents(QStyle::CT_LineEdit, &opt, QSize(width, sizeHint().height()), this).width(); setMinimumWidth(minWidth); } @@ -959,14 +962,22 @@ TableItemEditorFactory::createEditor(int userType, QWidget *parent) const { switch (userType) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + case QMetaType::UInt: { +#else case QVariant::UInt: { +#endif SpinBox *sb = new SpinBox(parent, SpinBox::eSpinBoxTypeInt); sb->setFrame(false); sb->setMaximum(std::numeric_limits::max()); return sb; } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + case QMetaType::Int: { +#else case QVariant::Int: { +#endif SpinBox *sb = new SpinBox(parent, SpinBox::eSpinBoxTypeInt); sb->setFrame(false); sb->setMinimum(std::numeric_limits::min()); @@ -974,10 +985,18 @@ TableItemEditorFactory::createEditor(int userType, return sb; } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + case QMetaType::QPixmap: +#else case QVariant::Pixmap: +#endif return new Label(parent); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + case QMetaType::Double: { +#else case QVariant::Double: { +#endif SpinBox *sb = new SpinBox(parent, SpinBox::eSpinBoxTypeDouble); sb->setFrame(false); sb->setMinimum(std::numeric_limits::lowest()); @@ -985,7 +1004,11 @@ TableItemEditorFactory::createEditor(int userType, return sb; } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + case QMetaType::QString: +#else case QVariant::String: +#endif default: { // the default editor is a lineedit ExpandingLineEdit *le = new ExpandingLineEdit(parent); @@ -1005,6 +1028,18 @@ QByteArray TableItemEditorFactory::valuePropertyName(int userType) const { switch (userType) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0) + case QMetaType::UInt: + case QMetaType::Int: + case QMetaType::Double: + + return "value"_ba; + case QMetaType::QString: + default: + + // the default editor is a lineedit + return "text"_ba; +#else case QVariant::UInt: case QVariant::Int: case QVariant::Double: @@ -1013,8 +1048,8 @@ TableItemEditorFactory::valuePropertyName(int userType) const case QVariant::String: default: - // the default editor is a lineedit return "text"; +#endif } } @@ -1394,7 +1429,11 @@ TableView::dropEvent(QDropEvent* e) case QAbstractItemView::BelowItem: break; } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + TableItem* into = itemAt( e->position().toPoint() ); +#else TableItem* into = itemAt( e->pos() ); +#endif if ( !into || _imp->draggedItems.empty() ) { return; diff --git a/Gui/TableModelView.h b/Gui/TableModelView.h index d3657f72b..f6af31ee2 100644 --- a/Gui/TableModelView.h +++ b/Gui/TableModelView.h @@ -159,12 +159,12 @@ class TableItem inline QColor backgroundColor() const { - return qvariant_cast( data(Qt::BackgroundColorRole) ); + return qvariant_cast( data(Qt::BackgroundRole) ); } inline void setBackgroundColor(const QColor &color) { - setData(Qt::BackgroundColorRole, color); + setData(Qt::BackgroundRole, color); } inline QBrush background() const @@ -179,12 +179,12 @@ class TableItem inline QColor textColor() const { - return qvariant_cast( data(Qt::TextColorRole) ); + return qvariant_cast( data(Qt::ForegroundRole) ); } inline void setTextColor(const QColor &color) { - setData(Qt::TextColorRole, color); + setData(Qt::ForegroundRole, color); } inline QBrush foreground() const diff --git a/Gui/TextRenderer.cpp b/Gui/TextRenderer.cpp index 013d6bc9c..b5ddccf64 100644 --- a/Gui/TextRenderer.cpp +++ b/Gui/TextRenderer.cpp @@ -179,7 +179,7 @@ TextRendererPrivate::createCharacter(QChar c) image.fill(Qt::transparent); QPainter painter; painter.begin(&image); - painter.setRenderHints(QPainter::HighQualityAntialiasing + painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing); painter.setFont(_font); painter.setPen(Qt::white); diff --git a/Gui/TimeLineGui.cpp b/Gui/TimeLineGui.cpp index 0a077ea85..78a59ea10 100644 --- a/Gui/TimeLineGui.cpp +++ b/Gui/TimeLineGui.cpp @@ -899,7 +899,11 @@ TimeLineGui::seek(SequenceTime time) void TimeLineGui::mousePressEvent(QMouseEvent* e) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + _imp->mousePressX = e->position().x(); +#else _imp->mousePressX = e->x(); +#endif _imp->mouseMoveX = _imp->mousePressX; if ( buttonDownIsMiddle(e) ) { _imp->state = eTimelineStatePanning; @@ -919,8 +923,13 @@ TimeLineGui::mousePressEvent(QMouseEvent* e) _imp->state = eTimelineStateDraggingBoundary; int firstPos = toWidget(leftBound - 1); int lastPos = toWidget(rightBound + 1); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + int distFromFirst = std::abs(e->position().x() - firstPos); + int distFromLast = std::abs(e->position().x() - lastPos); +#else int distFromFirst = std::abs(e->x() - firstPos); int distFromLast = std::abs(e->x() - lastPos); +#endif if (distFromFirst > distFromLast) { setBoundariesInternal(leftBound, tseq, true); // moving last frame anchor } else { @@ -938,8 +947,13 @@ TimeLineGui::mouseMoveEvent(QMouseEvent* e) { int mouseMoveXprev = _imp->mouseMoveX; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + _imp->lastMouseEventWidgetCoord = e->position().toPoint(); + _imp->mouseMoveX = e->position().x(); +#else _imp->lastMouseEventWidgetCoord = e->pos(); _imp->mouseMoveX = e->x(); +#endif const double t = toTimeLine(_imp->mouseMoveX); SequenceTime tseq = std::floor(t + 0.5); bool distortViewPort = false; @@ -973,8 +987,13 @@ TimeLineGui::mouseMoveEvent(QMouseEvent* e) } int firstPos = toWidget(leftBound - 1); int lastPos = toWidget(rightBound + 1); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + int distFromFirst = std::abs(e->position().x() - firstPos); + int distFromLast = std::abs(e->position().x() - lastPos); +#else int distFromFirst = std::abs(e->x() - firstPos); int distFromLast = std::abs(e->x() - lastPos); +#endif if (distFromFirst > distFromLast) { // moving last frame anchor if (leftBound <= tseq) { setBoundariesInternal(leftBound, tseq, true); @@ -1007,7 +1026,11 @@ TimeLineGui::mouseMoveEvent(QMouseEvent* e) } // TimeLineGui::mouseMoveEvent void +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +TimeLineGui::enterEvent(QEnterEvent* e) +#else TimeLineGui::enterEvent(QEvent* e) +#endif { _imp->alphaCursor = true; update(); @@ -1029,7 +1052,11 @@ TimeLineGui::mouseReleaseEvent(QMouseEvent* e) // - if the last selected frame is the same as the first selected frame, zoom on the PROJECT range // (NOT the playback range as in the following, and NOT adding margins as centerOn() does) // - if they are different, zoom on that range +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + double t = toTimeLine( e->position().x() ); +#else double t = toTimeLine( e->x() ); +#endif int leftBound = std::floor(t + 0.5); int rightBound = std::floor(toTimeLine(_imp->mousePressX) + 0.5); if (leftBound > rightBound) { @@ -1065,7 +1092,11 @@ TimeLineGui::mouseReleaseEvent(QMouseEvent* e) if (onEditingFinishedOnly) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + double t = toTimeLine( e->position().x() ); +#else double t = toTimeLine( e->x() ); +#endif SequenceTime tseq = std::floor(t + 0.5); if ( ( tseq != _imp->timeline->currentFrame() ) ) { _imp->gui->getApp()->setLastViewerUsingTimeline( _imp->viewer->getNode() ); diff --git a/Gui/TimeLineGui.h b/Gui/TimeLineGui.h index db13f5ff7..19b73d389 100644 --- a/Gui/TimeLineGui.h +++ b/Gui/TimeLineGui.h @@ -166,7 +166,11 @@ public Q_SLOTS: virtual void mouseMoveEvent(QMouseEvent* e) OVERRIDE FINAL; virtual void mouseReleaseEvent(QMouseEvent* e) OVERRIDE FINAL; virtual void wheelEvent(QWheelEvent* e) OVERRIDE FINAL; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + virtual void enterEvent(QEnterEvent* e) OVERRIDE FINAL; +#else virtual void enterEvent(QEvent* e) OVERRIDE FINAL; +#endif virtual void leaveEvent(QEvent* e) OVERRIDE FINAL; virtual QSize sizeHint() const OVERRIDE FINAL; diff --git a/Gui/ViewerGL.cpp b/Gui/ViewerGL.cpp index eeb97bf44..f51130259 100644 --- a/Gui/ViewerGL.cpp +++ b/Gui/ViewerGL.cpp @@ -1069,12 +1069,13 @@ NATRON_NAMESPACE_ANONYMOUS_ENTER static QStringList explode(const QString& str) { - QRegExp rx( QString::fromUtf8("(\\ |\\-|\\.|\\/|\\t|\\n)") ); //RegEx for ' ' '/' '.' '-' '\t' '\n' + QRegularExpression rx( QString::fromUtf8("(\\ |\\-|\\.|\\/|\\t|\\n)") ); //RegEx for ' ' '/' '.' '-' '\t' '\n' QStringList ret; int startIndex = 0; while (true) { - int index = str.indexOf(rx, startIndex); + QRegularExpressionMatch match(rx.match(str, startIndex)); + int index = match.capturedStart(); if (index == -1) { ret.push_back( str.mid(startIndex) ); @@ -1720,8 +1721,6 @@ ViewerGL::setLut(int lut) _imp->displayingImageLut = (ViewerColorSpaceEnum)lut; } -#define QMouseEventLocalPos(e) ( e->localPos() ) - void ViewerGL::mousePressEvent(QMouseEvent* e) { @@ -1763,7 +1762,11 @@ ViewerGL::mousePressEvent(QMouseEvent* e) double zoomScreenPixelWidth, zoomScreenPixelHeight; // screen pixel size in zoom coordinates { QMutexLocker l(&_imp->zoomCtxMutex); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + zoomPos = _imp->zoomCtx.toZoomCoordinates( e->position().x(), e->position().y() ); +#else zoomPos = _imp->zoomCtx.toZoomCoordinates( e->x(), e->y() ); +#endif zoomScreenPixelWidth = _imp->zoomCtx.screenPixelWidth(); zoomScreenPixelHeight = _imp->zoomCtx.screenPixelHeight(); } @@ -1843,7 +1846,11 @@ ViewerGL::mousePressEvent(QMouseEvent* e) if (!overlaysCaught && (_imp->ms == eMouseStateUndefined) && _imp->overlay) { - overlaysCaught = _imp->viewerTab->notifyOverlaysPenDown(RenderScale::fromMipmapLevel(getCurrentMipmapLevel()), _imp->pointerTypeOnPress, QMouseEventLocalPos(e), zoomPos, _imp->pressureOnPress, currentTimeForEvent(e)); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + overlaysCaught = _imp->viewerTab->notifyOverlaysPenDown(RenderScale::fromMipmapLevel(getCurrentMipmapLevel()), _imp->pointerTypeOnPress, e->position(), zoomPos, _imp->pressureOnPress, currentTimeForEvent(e)); +#else + overlaysCaught = _imp->viewerTab->notifyOverlaysPenDown(RenderScale::fromMipmapLevel(getCurrentMipmapLevel()), _imp->pointerTypeOnPress, e->localPos(), zoomPos, _imp->pressureOnPress, currentTimeForEvent(e)); +#endif if (overlaysCaught) { mustRedraw = true; } @@ -1854,7 +1861,11 @@ ViewerGL::mousePressEvent(QMouseEvent* e) displayingImage() ) { // picker with single-point selection _imp->pickerState = ePickerStatePoint; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + if ( pickColor( e->position().x(), e->position().y(), false ) ) { +#else if ( pickColor( e->x(), e->y(), false ) ) { +#endif _imp->ms = eMouseStatePickingColor; mustRedraw = true; overlaysCaught = true; @@ -1866,7 +1877,11 @@ ViewerGL::mousePressEvent(QMouseEvent* e) displayingImage() ) { // picker with single-point selection _imp->pickerState = ePickerStatePoint; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + if ( pickColor( e->position().x(), e->position().y(), true ) ) { +#else if ( pickColor( e->x(), e->y(), true ) ) { +#endif _imp->ms = eMouseStatePickingInputColor; mustRedraw = true; overlaysCaught = true; @@ -2041,9 +2056,17 @@ ViewerGL::mouseReleaseEvent(QMouseEvent* e) QPointF zoomPos; { QMutexLocker l(&_imp->zoomCtxMutex); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + zoomPos = _imp->zoomCtx.toZoomCoordinates( e->position().x(), e->position().y() ); +#else zoomPos = _imp->zoomCtx.toZoomCoordinates( e->x(), e->y() ); +#endif } - if ( _imp->viewerTab->notifyOverlaysPenUp(RenderScale::fromMipmapLevel(getCurrentMipmapLevel()), QMouseEventLocalPos(e), zoomPos, currentTimeForEvent(e), _imp->pressureOnRelease) ) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + if ( _imp->viewerTab->notifyOverlaysPenUp(RenderScale::fromMipmapLevel(getCurrentMipmapLevel()), e->position(), zoomPos, currentTimeForEvent(e), _imp->pressureOnRelease) ) { +#else + if ( _imp->viewerTab->notifyOverlaysPenUp(RenderScale::fromMipmapLevel(getCurrentMipmapLevel()), e->localPos(), zoomPos, currentTimeForEvent(e), _imp->pressureOnRelease) ) { +#endif mustRedraw = true; } if (mustRedraw) { @@ -2059,9 +2082,15 @@ ViewerGL::mouseReleaseEvent(QMouseEvent* e) void ViewerGL::mouseMoveEvent(QMouseEvent* e) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + if ( !penMotionInternal(e->position().x(), e->position().y(), /*pressure=*/ 1., currentTimeForEvent(e), e) ) { + QOpenGLWidget::mouseMoveEvent(e); + } +#else if ( !penMotionInternal(e->x(), e->y(), /*pressure=*/ 1., currentTimeForEvent(e), e) ) { QOpenGLWidget::mouseMoveEvent(e); } +#endif } // mouseMoveEvent void @@ -2076,6 +2105,15 @@ ViewerGL::tabletEvent(QTabletEvent* e) switch ( e->type() ) { case QEvent::TabletPress: { switch ( e->pointerType() ) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + case QPointingDevice::PointerType::Cursor: + _imp->pointerTypeOnPress = ePenTypeCursor; + break; + case QPointingDevice::PointerType::Eraser: + _imp->pointerTypeOnPress = ePenTypeEraser; + break; + case QPointingDevice::PointerType::Pen: +#else case QTabletEvent::Cursor: _imp->pointerTypeOnPress = ePenTypeCursor; break; @@ -2083,6 +2121,7 @@ ViewerGL::tabletEvent(QTabletEvent* e) _imp->pointerTypeOnPress = ePenTypeEraser; break; case QTabletEvent::Pen: +#endif default: _imp->pointerTypeOnPress = ePenTypePen; break; @@ -2097,7 +2136,11 @@ ViewerGL::tabletEvent(QTabletEvent* e) break; } case QEvent::TabletMove: { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + if ( !penMotionInternal(e->position().x(), e->position().y(), pressure, currentTimeForEvent(e), e) ) { +#else if ( !penMotionInternal(e->x(), e->y(), pressure, currentTimeForEvent(e), e) ) { +#endif QOpenGLWidget::tabletEvent(e); } else { e->accept(); @@ -2498,9 +2541,17 @@ ViewerGL::mouseDoubleClickEvent(QMouseEvent* e) QPointF pos_opengl; { QMutexLocker l(&_imp->zoomCtxMutex); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + pos_opengl = _imp->zoomCtx.toZoomCoordinates( e->position().x(), e->position().y() ); +#else pos_opengl = _imp->zoomCtx.toZoomCoordinates( e->x(), e->y() ); +#endif } - if ( _imp->viewerTab->notifyOverlaysPenDoubleClick(RenderScale::fromMipmapLevel(getCurrentMipmapLevel()), QMouseEventLocalPos(e), pos_opengl) ) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + if ( _imp->viewerTab->notifyOverlaysPenDoubleClick(RenderScale::fromMipmapLevel(getCurrentMipmapLevel()), e->position(), pos_opengl) ) { +#else + if ( _imp->viewerTab->notifyOverlaysPenDoubleClick(RenderScale::fromMipmapLevel(getCurrentMipmapLevel()), e->localPos(), pos_opengl) ) { +#endif update(); } QOpenGLWidget::mouseDoubleClickEvent(e); @@ -3100,7 +3151,11 @@ ViewerGL::focusOutEvent(QFocusEvent* e) } void +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +ViewerGL::enterEvent(QEnterEvent* e) +#else ViewerGL::enterEvent(QEvent* e) +#endif { // always running in the main thread assert( qApp && qApp->thread() == QThread::currentThread() ); diff --git a/Gui/ViewerGL.h b/Gui/ViewerGL.h index 631fe88bf..d7c591b24 100644 --- a/Gui/ViewerGL.h +++ b/Gui/ViewerGL.h @@ -494,7 +494,11 @@ public Q_SLOTS: virtual void wheelEvent(QWheelEvent* e) OVERRIDE FINAL; virtual void focusInEvent(QFocusEvent* e) OVERRIDE FINAL; virtual void focusOutEvent(QFocusEvent* e) OVERRIDE FINAL; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + virtual void enterEvent(QEnterEvent* e) OVERRIDE FINAL; +#else virtual void enterEvent(QEvent* e) OVERRIDE FINAL; +#endif virtual void leaveEvent(QEvent* e) OVERRIDE FINAL; virtual void tabletEvent(QTabletEvent* e) OVERRIDE FINAL; diff --git a/Gui/ViewerTab.cpp b/Gui/ViewerTab.cpp index 92853dcf5..d546a0166 100644 --- a/Gui/ViewerTab.cpp +++ b/Gui/ViewerTab.cpp @@ -91,7 +91,7 @@ addSpacer(QBoxLayout* layout) line->setFrameShadow(QFrame::Raised); //line->setObjectName("LayoutSeparator"); QPalette palette; - palette.setColor(QPalette::Foreground, Qt::black); + palette.setColor(QPalette::WindowText, Qt::black); line->setPalette(palette); layout->addWidget(line); layout->addSpacing(5); @@ -319,7 +319,7 @@ ViewerTab::ViewerTab(const std::list & existingNodesContext, _imp->refreshButton->setFixedSize(buttonSize); _imp->refreshButton->setIconSize(buttonIconSize); { - QKeySequence seq(Qt::CTRL + Qt::SHIFT); + QKeySequence seq(Qt::CTRL | Qt::SHIFT); std::list refreshActions; refreshActions.push_back(kShortcutIDActionRefresh); refreshActions.push_back(kShortcutIDActionRefreshWithStats); @@ -338,7 +338,7 @@ ViewerTab::ViewerTab(const std::list & existingNodesContext, _imp->pauseButton->setChecked(false); _imp->pauseButton->setDown(false); { - QKeySequence seq(Qt::CTRL + Qt::SHIFT); + QKeySequence seq(Qt::CTRL | Qt::SHIFT); std::list actions; actions.push_back(kShortcutIDActionPauseViewerInputA); actions.push_back(kShortcutIDActionPauseViewer); diff --git a/Gui/ViewerTab.h b/Gui/ViewerTab.h index c94f7f3c8..4c35172d3 100644 --- a/Gui/ViewerTab.h +++ b/Gui/ViewerTab.h @@ -467,7 +467,11 @@ public Q_SLOTS: virtual bool eventFilter(QObject *target, QEvent* e) OVERRIDE FINAL; virtual void keyPressEvent(QKeyEvent* e) OVERRIDE FINAL; virtual void keyReleaseEvent(QKeyEvent* e) OVERRIDE FINAL; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + virtual void enterEvent(QEnterEvent* e) OVERRIDE FINAL; +#else virtual void enterEvent(QEvent* e) OVERRIDE FINAL; +#endif virtual void leaveEvent(QEvent* e) OVERRIDE FINAL; virtual QSize minimumSizeHint() const OVERRIDE FINAL; virtual QSize sizeHint() const OVERRIDE FINAL; diff --git a/Gui/ViewerTab10.cpp b/Gui/ViewerTab10.cpp index 86e6857a5..1d9cc2ee5 100644 --- a/Gui/ViewerTab10.cpp +++ b/Gui/ViewerTab10.cpp @@ -589,7 +589,11 @@ ViewerTab::previousLayer() } void +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +ViewerTab::enterEvent(QEnterEvent* e) +#else ViewerTab::enterEvent(QEvent* e) +#endif { enterEventBase(); QWidget::enterEvent(e); diff --git a/Gui/typesystem_natronGui.xml b/Gui/typesystem_natronGui.xml index 727c5cb48..10498dd4d 100644 --- a/Gui/typesystem_natronGui.xml +++ b/Gui/typesystem_natronGui.xml @@ -68,9 +68,9 @@ - +