diff --git a/.github/workflows/arch_ci.yml b/.github/workflows/arch_ci.yml index 9316b147..be8bce69 100644 --- a/.github/workflows/arch_ci.yml +++ b/.github/workflows/arch_ci.yml @@ -30,7 +30,7 @@ jobs: - name: Install run: | sudo apt-get update - sudo apt-get install git make cmake libboost-all-dev python3-dev pypy3 libeigen3-dev tcl-dev lzma-dev libftdi-dev clang bison flex swig qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools iverilog libreadline-dev liblzma-dev cargo rustc + sudo apt-get install git make cmake libboost-all-dev python3-dev pypy3 libeigen3-dev tcl-dev lzma-dev libftdi-dev clang bison flex swig qt6-base-dev iverilog libreadline-dev liblzma-dev cargo rustc - name: Cache yosys installation uses: actions/cache@v4 diff --git a/3rdparty/QtPropertyBrowser/CMakeLists.txt b/3rdparty/QtPropertyBrowser/CMakeLists.txt index a86b5c6b..7175f222 100644 --- a/3rdparty/QtPropertyBrowser/CMakeLists.txt +++ b/3rdparty/QtPropertyBrowser/CMakeLists.txt @@ -5,7 +5,7 @@ PROJECT(QtPropertyBrowser) ##################### Look for required libraries ###################### # Add QT dependencies -FIND_PACKAGE(Qt5Widgets REQUIRED) +FIND_PACKAGE(Qt6Widgets REQUIRED) ######################### Add Primary Targets ########################## ADD_SUBDIRECTORY(src) diff --git a/3rdparty/QtPropertyBrowser/README.md b/3rdparty/QtPropertyBrowser/README.md index a7b52250..c5ba0060 100644 --- a/3rdparty/QtPropertyBrowser/README.md +++ b/3rdparty/QtPropertyBrowser/README.md @@ -5,4 +5,4 @@ A property browser framework enabling the user to edit a set of properties. The framework provides a browser widget that displays the given properties with labels and corresponding editing widgets (e.g. line edits or comboboxes). The various types of editing widgets are provided by the framework's editor factories: For each property type, the framework provides a property manager (e.g. QtIntPropertyManager and QtStringPropertyManager) which can be associated with the preferred editor factory (e.g.QtSpinBoxFactory and QtLineEditFactory). The framework also provides a variant based property type with corresponding variant manager and factory. Finally, the framework provides three ready-made implementations of the browser widget: QtTreePropertyBrowser, QtButtonPropertyBrowser and QtGroupBoxPropertyBrowser. Original source code is archived at https://qt.gitorious.org/qt-solutions/qt-solutions -This fork adds CMake and Qt5 support \ No newline at end of file +This fork adds CMake and Qt6 support diff --git a/3rdparty/QtPropertyBrowser/cmake/CommonCMakeUtils.cmake b/3rdparty/QtPropertyBrowser/cmake/CommonCMakeUtils.cmake index 428dde71..7ff22eea 100644 --- a/3rdparty/QtPropertyBrowser/cmake/CommonCMakeUtils.cmake +++ b/3rdparty/QtPropertyBrowser/cmake/CommonCMakeUtils.cmake @@ -13,7 +13,7 @@ endmacro() # extract target properties of all items in src_list in dst_list -# example usage: extract_target_properties(QT_INCLUDES Qt5::Core INTERFACE_INCLUDE_DIR) +# example usage: extract_target_properties(QT_INCLUDES Qt6::Core INTERFACE_INCLUDE_DIR) macro(extract_target_properties target_props target_list property) set(list_var "${${target_list}}") # message(STATUS "list_var: ${list_var}") @@ -24,4 +24,4 @@ macro(extract_target_properties target_props target_list property) endforeach() #message(STATUS "target_props: ${${target_props}}") list(REMOVE_DUPLICATES ${target_props}) -endmacro() \ No newline at end of file +endmacro() diff --git a/3rdparty/QtPropertyBrowser/cmake/QtPropertyBrowserConfig.cmake.in b/3rdparty/QtPropertyBrowser/cmake/QtPropertyBrowserConfig.cmake.in index 445941d4..87a8e9d1 100644 --- a/3rdparty/QtPropertyBrowser/cmake/QtPropertyBrowserConfig.cmake.in +++ b/3rdparty/QtPropertyBrowser/cmake/QtPropertyBrowserConfig.cmake.in @@ -17,7 +17,7 @@ include(CMakeFindDependencyMacro) -find_dependency(Qt5Widgets) +find_dependency(Qt6Widgets) # Our library dependencies (contains definitions for IMPORTED targets) if(NOT TARGET QtPropertyBrowser) diff --git a/3rdparty/QtPropertyBrowser/examples/demo/CMakeLists.txt b/3rdparty/QtPropertyBrowser/examples/demo/CMakeLists.txt index cafcb15d..6e31d23c 100644 --- a/3rdparty/QtPropertyBrowser/examples/demo/CMakeLists.txt +++ b/3rdparty/QtPropertyBrowser/examples/demo/CMakeLists.txt @@ -9,7 +9,7 @@ SET(KIT_resources demo.qrc ) -QT5_ADD_RESOURCES(KIT_QRC_SRCS ${KIT_resources}) +QT6_ADD_RESOURCES(KIT_QRC_SRCS ${KIT_resources}) ADD_EXECUTABLE(${example_name} ${KIT_SRCS} ${KIT_QRC_SRCS}) TARGET_LINK_LIBRARIES(${example_name} ${PROJECT_NAME}) diff --git a/3rdparty/QtPropertyBrowser/examples/object_controller/objectcontroller.cpp b/3rdparty/QtPropertyBrowser/examples/object_controller/objectcontroller.cpp index 1c09b0a1..4bcf6433 100644 --- a/3rdparty/QtPropertyBrowser/examples/object_controller/objectcontroller.cpp +++ b/3rdparty/QtPropertyBrowser/examples/object_controller/objectcontroller.cpp @@ -334,7 +334,7 @@ ObjectController::ObjectController(QWidget *parent) d_ptr->m_browser = new QtGroupBoxPropertyBrowser(this); QVBoxLayout *layout = new QVBoxLayout(this); - layout->setMargin(0); + layout->setContentsMargins(0, 0, 0, 0); layout->addWidget(scroll); scroll->setWidget(d_ptr->m_browser); */ @@ -342,7 +342,7 @@ ObjectController::ObjectController(QWidget *parent) browser->setRootIsDecorated(false); d_ptr->m_browser = browser; QVBoxLayout *layout = new QVBoxLayout(this); - layout->setMargin(0); + layout->setContentsMargins(0, 0, 0, 0); layout->addWidget(d_ptr->m_browser); d_ptr->m_readOnlyManager = new QtVariantPropertyManager(this); diff --git a/3rdparty/QtPropertyBrowser/src/CMakeLists.txt b/3rdparty/QtPropertyBrowser/src/CMakeLists.txt index 9d02d58d..668e18a4 100644 --- a/3rdparty/QtPropertyBrowser/src/CMakeLists.txt +++ b/3rdparty/QtPropertyBrowser/src/CMakeLists.txt @@ -23,8 +23,8 @@ set(_RESOURCES qtpropertybrowser.qrc ) -QT5_WRAP_UI(_UI_SRCS ${_UI_FORMS}) -QT5_ADD_RESOURCES(_QRC_SRCS ${_RESOURCES}) +QT6_WRAP_UI(_UI_SRCS ${_UI_FORMS}) +QT6_ADD_RESOURCES(_QRC_SRCS ${_RESOURCES}) set(TARGET_NAME ${PROJECT_NAME}) @@ -38,4 +38,4 @@ if (MSVC) target_compile_options(${TARGET_NAME} PRIVATE /wd4457 /wd4718) endif() -target_link_libraries(${TARGET_NAME} Qt5::Widgets) +target_link_libraries(${TARGET_NAME} Qt6::Widgets) diff --git a/3rdparty/QtPropertyBrowser/src/qteditorfactory.cpp b/3rdparty/QtPropertyBrowser/src/qteditorfactory.cpp index 4920f472..e2040e2c 100644 --- a/3rdparty/QtPropertyBrowser/src/qteditorfactory.cpp +++ b/3rdparty/QtPropertyBrowser/src/qteditorfactory.cpp @@ -904,7 +904,7 @@ class QtLineEditFactoryPrivate : public EditorFactoryPrivate public: void slotPropertyChanged(QtProperty *property, const QString &value); - void slotRegExpChanged(QtProperty *property, const QRegExp ®Exp); + void slotRegExpChanged(QtProperty *property, const QRegularExpression ®Exp); void slotSetValue(const QString &value); }; @@ -923,7 +923,7 @@ void QtLineEditFactoryPrivate::slotPropertyChanged(QtProperty *property, } void QtLineEditFactoryPrivate::slotRegExpChanged(QtProperty *property, - const QRegExp ®Exp) + const QRegularExpression ®Exp) { if (!m_createdEditors.contains(property)) return; @@ -939,7 +939,7 @@ void QtLineEditFactoryPrivate::slotRegExpChanged(QtProperty *property, const QValidator *oldValidator = editor->validator(); QValidator *newValidator = 0; if (regExp.isValid()) { - newValidator = new QRegExpValidator(regExp, editor); + newValidator = new QRegularExpressionValidator(regExp, editor); } editor->setValidator(newValidator); if (oldValidator) @@ -1001,8 +1001,8 @@ void QtLineEditFactory::connectPropertyManager(QtStringPropertyManager *manager) { connect(manager, SIGNAL(valueChanged(QtProperty *, const QString &)), this, SLOT(slotPropertyChanged(QtProperty *, const QString &))); - connect(manager, SIGNAL(regExpChanged(QtProperty *, const QRegExp &)), - this, SLOT(slotRegExpChanged(QtProperty *, const QRegExp &))); + connect(manager, SIGNAL(regExpChanged(QtProperty *, const QRegularExpression &)), + this, SLOT(slotRegExpChanged(QtProperty *, const QRegularExpression &))); } /*! @@ -1015,9 +1015,9 @@ QWidget *QtLineEditFactory::createEditor(QtStringPropertyManager *manager, { QLineEdit *editor = d_ptr->createEditor(property, parent); - QRegExp regExp = manager->regExp(property); + QRegularExpression regExp = manager->regExp(property); if (regExp.isValid()) { - QValidator *validator = new QRegExpValidator(regExp, editor); + QValidator *validator = new QRegularExpressionValidator(regExp, editor); editor->setValidator(validator); } editor->setText(manager->value(property)); @@ -1038,8 +1038,8 @@ void QtLineEditFactory::disconnectPropertyManager(QtStringPropertyManager *manag { disconnect(manager, SIGNAL(valueChanged(QtProperty *, const QString &)), this, SLOT(slotPropertyChanged(QtProperty *, const QString &))); - disconnect(manager, SIGNAL(regExpChanged(QtProperty *, const QRegExp &)), - this, SLOT(slotRegExpChanged(QtProperty *, const QRegExp &))); + disconnect(manager, SIGNAL(regExpChanged(QtProperty *, const QRegularExpression &)), + this, SLOT(slotRegExpChanged(QtProperty *, const QRegularExpression &))); } // QtDateEditFactory @@ -1545,7 +1545,7 @@ QtCharEdit::QtCharEdit(QWidget *parent) { QHBoxLayout *layout = new QHBoxLayout(this); layout->addWidget(m_lineEdit); - layout->setMargin(0); + layout->setContentsMargins(0, 0, 0, 0); m_lineEdit->installEventFilter(this); m_lineEdit->setReadOnly(true); m_lineEdit->setFocusProxy(this); @@ -1610,7 +1610,7 @@ void QtCharEdit::handleKeyEvent(QKeyEvent *e) } const QString text = e->text(); - if (text.count() != 1) + if (text.length() != 1) return; const QChar c = text.at(0); @@ -1669,7 +1669,7 @@ void QtCharEdit::keyReleaseEvent(QKeyEvent *e) void QtCharEdit::paintEvent(QPaintEvent *) { QStyleOption opt; - opt.init(this); + opt.initFrom(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); } @@ -2240,7 +2240,7 @@ bool QtColorEditWidget::eventFilter(QObject *obj, QEvent *ev) void QtColorEditWidget::paintEvent(QPaintEvent *) { QStyleOption opt; - opt.init(this); + opt.initFrom(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); } @@ -2462,7 +2462,7 @@ bool QtFontEditWidget::eventFilter(QObject *obj, QEvent *ev) void QtFontEditWidget::paintEvent(QPaintEvent *) { QStyleOption opt; - opt.init(this); + opt.initFrom(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); } diff --git a/3rdparty/QtPropertyBrowser/src/qteditorfactory.h b/3rdparty/QtPropertyBrowser/src/qteditorfactory.h index 5fe7cabd..bb0d7d6b 100644 --- a/3rdparty/QtPropertyBrowser/src/qteditorfactory.h +++ b/3rdparty/QtPropertyBrowser/src/qteditorfactory.h @@ -184,7 +184,7 @@ private: Q_DECLARE_PRIVATE(QtLineEditFactory) Q_DISABLE_COPY(QtLineEditFactory) Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, const QString &)) - Q_PRIVATE_SLOT(d_func(), void slotRegExpChanged(QtProperty *, const QRegExp &)) + Q_PRIVATE_SLOT(d_func(), void slotRegExpChanged(QtProperty *, const QRegularExpression &)) Q_PRIVATE_SLOT(d_func(), void slotSetValue(const QString &)) Q_PRIVATE_SLOT(d_func(), void slotEditorDestroyed(QObject *)) }; diff --git a/3rdparty/QtPropertyBrowser/src/qtpropertybrowserutils.cpp b/3rdparty/QtPropertyBrowser/src/qtpropertybrowserutils.cpp index cd195835..58368e9d 100644 --- a/3rdparty/QtPropertyBrowser/src/qtpropertybrowserutils.cpp +++ b/3rdparty/QtPropertyBrowser/src/qtpropertybrowserutils.cpp @@ -262,7 +262,7 @@ void QtBoolEdit::mousePressEvent(QMouseEvent *event) void QtBoolEdit::paintEvent(QPaintEvent *) { QStyleOption opt; - opt.init(this); + opt.initFrom(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); } @@ -274,7 +274,7 @@ QtKeySequenceEdit::QtKeySequenceEdit(QWidget *parent) { QHBoxLayout *layout = new QHBoxLayout(this); layout->addWidget(m_lineEdit); - layout->setMargin(0); + layout->setContentsMargins(0, 0, 0, 0); m_lineEdit->installEventFilter(this); m_lineEdit->setReadOnly(true); m_lineEdit->setFocusProxy(this); @@ -332,10 +332,10 @@ void QtKeySequenceEdit::handleKeyEvent(QKeyEvent *e) return; nextKey |= translateModifiers(e->modifiers(), e->text()); - int k0 = m_keySequence[0]; - int k1 = m_keySequence[1]; - int k2 = m_keySequence[2]; - int k3 = m_keySequence[3]; + int k0 = m_keySequence[0].toCombined(); + int k1 = m_keySequence[1].toCombined(); + int k2 = m_keySequence[2].toCombined(); + int k3 = m_keySequence[3].toCombined(); switch (m_num) { case 0: k0 = nextKey; k1 = 0; k2 = 0; k3 = 0; break; case 1: k1 = nextKey; k2 = 0; k3 = 0; break; @@ -408,7 +408,7 @@ void QtKeySequenceEdit::keyReleaseEvent(QKeyEvent *e) void QtKeySequenceEdit::paintEvent(QPaintEvent *) { QStyleOption opt; - opt.init(this); + opt.initFrom(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); } diff --git a/3rdparty/QtPropertyBrowser/src/qtpropertymanager.cpp b/3rdparty/QtPropertyBrowser/src/qtpropertymanager.cpp index ef627e9c..10e7a323 100644 --- a/3rdparty/QtPropertyBrowser/src/qtpropertymanager.cpp +++ b/3rdparty/QtPropertyBrowser/src/qtpropertymanager.cpp @@ -444,7 +444,7 @@ static QList sortCountries(const QList &coun QListIterator itCountry(countries); while (itCountry.hasNext()) { QLocale::Country country = itCountry.next(); - nameToCountry.insert(QLocale::countryToString(country), country); + nameToCountry.insert(QLocale::territoryToString(country), country); } return nameToCountry.values(); } @@ -469,13 +469,11 @@ void QtMetaEnumProvider::initLocale() while (itLang.hasNext()) { QLocale::Language language = itLang.next(); QList countries; -#if QT_VERSION < 0x040300 - countries = countriesForLanguage(language); -#else - countries = QLocale::countriesForLanguage(language); -#endif + for(QLocale locale: QLocale::matchingLocales(language, QLocale::AnyScript, QLocale::AnyTerritory)) { + countries << locale.territory(); + } if (countries.isEmpty() && language == system.language()) - countries << system.country(); + countries << system.territory(); if (!countries.isEmpty() && !m_languageToIndex.contains(language)) { countries = sortCountries(countries); @@ -487,7 +485,7 @@ void QtMetaEnumProvider::initLocale() int countryIdx = 0; while (it.hasNext()) { QLocale::Country country = it.next(); - countryNames << QLocale::countryToString(country); + countryNames << QLocale::territoryToString(country); m_indexToCountry[langIdx][countryIdx] = country; m_countryToIndex[language][country] = countryIdx; ++countryIdx; @@ -1229,11 +1227,11 @@ public: struct Data { - Data() : regExp(QString(QLatin1Char('*')), Qt::CaseSensitive, QRegExp::Wildcard) + Data() : regExp(QRegularExpression::fromWildcard(QString(QLatin1Char('*')), Qt::CaseSensitive)) { } QString val; - QRegExp regExp; + QRegularExpression regExp; }; typedef QMap PropertyValueMap; @@ -1271,7 +1269,7 @@ public: */ /*! - \fn void QtStringPropertyManager::regExpChanged(QtProperty *property, const QRegExp ®Exp) + \fn void QtStringPropertyManager::regExpChanged(QtProperty *property, const QRegularExpression ®Exp) This signal is emitted whenever a property created by this manager changes its currenlty set regular expression, passing a pointer to @@ -1320,9 +1318,9 @@ QString QtStringPropertyManager::value(const QtProperty *property) const \sa setRegExp() */ -QRegExp QtStringPropertyManager::regExp(const QtProperty *property) const +QRegularExpression QtStringPropertyManager::regExp(const QtProperty *property) const { - return getData(d_ptr->m_values, &QtStringPropertyManagerPrivate::Data::regExp, property, QRegExp()); + return getData(d_ptr->m_values, &QtStringPropertyManagerPrivate::Data::regExp, property, QRegularExpression()); } /*! @@ -1357,7 +1355,7 @@ void QtStringPropertyManager::setValue(QtProperty *property, const QString &val) if (data.val == val) return; - if (data.regExp.isValid() && !data.regExp.exactMatch(val)) + if (data.regExp.isValid() && !data.regExp.match(val).hasMatch()) return; data.val = val; @@ -1373,7 +1371,7 @@ void QtStringPropertyManager::setValue(QtProperty *property, const QString &val) \sa regExp(), setValue(), regExpChanged() */ -void QtStringPropertyManager::setRegExp(QtProperty *property, const QRegExp ®Exp) +void QtStringPropertyManager::setRegExp(QtProperty *property, const QRegularExpression ®Exp) { const QtStringPropertyManagerPrivate::PropertyValueMap::iterator it = d_ptr->m_values.find(property); if (it == d_ptr->m_values.end()) @@ -2278,14 +2276,14 @@ void QtLocalePropertyManagerPrivate::slotEnumChanged(QtProperty *property, int v if (QtProperty *prop = m_languageToProperty.value(property, 0)) { const QLocale loc = m_values[prop]; QLocale::Language newLanguage = loc.language(); - QLocale::Country newCountry = loc.country(); + QLocale::Country newCountry = loc.territory(); metaEnumProvider()->indexToLocale(value, 0, &newLanguage, 0); QLocale newLoc(newLanguage, newCountry); q_ptr->setValue(prop, newLoc); } else if (QtProperty *prop = m_countryToProperty.value(property, 0)) { const QLocale loc = m_values[prop]; QLocale::Language newLanguage = loc.language(); - QLocale::Country newCountry = loc.country(); + QLocale::Country newCountry = loc.territory(); metaEnumProvider()->indexToLocale(m_enumPropertyManager->value(m_propertyToLanguage.value(prop)), value, &newLanguage, &newCountry); QLocale newLoc(newLanguage, newCountry); q_ptr->setValue(prop, newLoc); @@ -2401,7 +2399,7 @@ QString QtLocalePropertyManager::valueText(const QtProperty *property) const int langIdx = 0; int countryIdx = 0; - metaEnumProvider()->localeToIndex(loc.language(), loc.country(), &langIdx, &countryIdx); + metaEnumProvider()->localeToIndex(loc.language(), loc.territory(), &langIdx, &countryIdx); QString str = tr("%1, %2") .arg(metaEnumProvider()->languageEnumNames().at(langIdx)) .arg(metaEnumProvider()->countryEnumNames(loc.language()).at(countryIdx)); @@ -2430,7 +2428,7 @@ void QtLocalePropertyManager::setValue(QtProperty *property, const QLocale &val) int langIdx = 0; int countryIdx = 0; - metaEnumProvider()->localeToIndex(val.language(), val.country(), &langIdx, &countryIdx); + metaEnumProvider()->localeToIndex(val.language(), val.territory(), &langIdx, &countryIdx); if (loc.language() != val.language()) { d_ptr->m_enumPropertyManager->setValue(d_ptr->m_propertyToLanguage.value(property), langIdx); d_ptr->m_enumPropertyManager->setEnumNames(d_ptr->m_propertyToCountry.value(property), @@ -2452,7 +2450,7 @@ void QtLocalePropertyManager::initializeProperty(QtProperty *property) int langIdx = 0; int countryIdx = 0; - metaEnumProvider()->localeToIndex(val.language(), val.country(), &langIdx, &countryIdx); + metaEnumProvider()->localeToIndex(val.language(), val.territory(), &langIdx, &countryIdx); QtProperty *languageProp = d_ptr->m_enumPropertyManager->addProperty(); languageProp->setPropertyName(tr("Language")); @@ -5524,8 +5522,6 @@ void QtSizePolicyPropertyManager::uninitializeProperty(QtProperty *property) // enumeration manager to re-set its strings and index values // for each property. -Q_GLOBAL_STATIC(QFontDatabase, fontDatabase) - class QtFontPropertyManagerPrivate { QtFontPropertyManager *q_ptr; @@ -5668,7 +5664,7 @@ void QtFontPropertyManagerPrivate::slotFontDatabaseDelayedChange() typedef QMap PropertyPropertyMap; // rescan available font names const QStringList oldFamilies = m_familyNames; - m_familyNames = fontDatabase()->families(); + m_familyNames = QFontDatabase::families(); // Adapt all existing properties if (!m_propertyToFamily.empty()) { @@ -5854,7 +5850,7 @@ void QtFontPropertyManager::setValue(QtProperty *property, const QFont &val) return; const QFont oldVal = it.value(); - if (oldVal == val && oldVal.resolve() == val.resolve()) + if (oldVal == val && oldVal.resolveMask() == val.resolveMask()) return; it.value() = val; @@ -5888,7 +5884,7 @@ void QtFontPropertyManager::initializeProperty(QtProperty *property) QtProperty *familyProp = d_ptr->m_enumPropertyManager->addProperty(); familyProp->setPropertyName(tr("Family")); if (d_ptr->m_familyNames.empty()) - d_ptr->m_familyNames = fontDatabase()->families(); + d_ptr->m_familyNames = QFontDatabase::families(); d_ptr->m_enumPropertyManager->setEnumNames(familyProp, d_ptr->m_familyNames); int idx = d_ptr->m_familyNames.indexOf(val.family()); if (idx == -1) diff --git a/3rdparty/QtPropertyBrowser/src/qtpropertymanager.h b/3rdparty/QtPropertyBrowser/src/qtpropertymanager.h index f5d157bc..eea2b0d5 100644 --- a/3rdparty/QtPropertyBrowser/src/qtpropertymanager.h +++ b/3rdparty/QtPropertyBrowser/src/qtpropertymanager.h @@ -173,14 +173,14 @@ public: ~QtStringPropertyManager(); QString value(const QtProperty *property) const; - QRegExp regExp(const QtProperty *property) const; + QRegularExpression regExp(const QtProperty *property) const; public Q_SLOTS: void setValue(QtProperty *property, const QString &val); - void setRegExp(QtProperty *property, const QRegExp ®Exp); + void setRegExp(QtProperty *property, const QRegularExpression ®Exp); Q_SIGNALS: void valueChanged(QtProperty *property, const QString &val); - void regExpChanged(QtProperty *property, const QRegExp ®Exp); + void regExpChanged(QtProperty *property, const QRegularExpression ®Exp); protected: QString valueText(const QtProperty *property) const; virtual void initializeProperty(QtProperty *property); diff --git a/3rdparty/QtPropertyBrowser/src/qttreepropertybrowser.cpp b/3rdparty/QtPropertyBrowser/src/qttreepropertybrowser.cpp index 1ed0c983..9969a21d 100644 --- a/3rdparty/QtPropertyBrowser/src/qttreepropertybrowser.cpp +++ b/3rdparty/QtPropertyBrowser/src/qttreepropertybrowser.cpp @@ -486,7 +486,7 @@ static QIcon drawIndicatorIcon(const QPalette &palette, QStyle *style) void QtTreePropertyBrowserPrivate::init(QWidget *parent) { QHBoxLayout *layout = new QHBoxLayout(parent); - layout->setMargin(0); + layout->setContentsMargins(0, 0, 0, 0); m_treeWidget = new QtPropertyEditorView(parent); m_treeWidget->setEditorPrivate(this); m_treeWidget->setIconSize(QSize(18, 18)); diff --git a/3rdparty/QtPropertyBrowser/src/qtvariantproperty.cpp b/3rdparty/QtPropertyBrowser/src/qtvariantproperty.cpp index c003f3e4..9eea1e1e 100644 --- a/3rdparty/QtPropertyBrowser/src/qtvariantproperty.cpp +++ b/3rdparty/QtPropertyBrowser/src/qtvariantproperty.cpp @@ -41,6 +41,7 @@ #include "qtvariantproperty.h" #include "qtpropertymanager.h" #include "qteditorfactory.h" +#include #include #include #include @@ -281,7 +282,7 @@ bool QtVariantProperty::compare(QtProperty* otherProperty)const The specified \a value must be of the type returned by valueType(), or of a type that can be converted to valueType() - using the QVariant::canConvert() function; otherwise this function + using the QMetaType::canConvert() function; otherwise this function does nothing. \sa value() @@ -326,7 +327,7 @@ public: void slotDecimalsChanged(QtProperty *property, int prec); void slotValueChanged(QtProperty *property, bool val); void slotValueChanged(QtProperty *property, const QString &val); - void slotRegExpChanged(QtProperty *property, const QRegExp ®Exp); + void slotRegExpChanged(QtProperty *property, const QRegularExpression ®Exp); void slotValueChanged(QtProperty *property, const QDate &val); void slotRangeChanged(QtProperty *property, const QDate &min, const QDate &max); void slotValueChanged(QtProperty *property, const QTime &val); @@ -543,7 +544,7 @@ void QtVariantPropertyManagerPrivate::slotValueChanged(QtProperty *property, con valueChanged(property, QVariant(val)); } -void QtVariantPropertyManagerPrivate::slotRegExpChanged(QtProperty *property, const QRegExp ®Exp) +void QtVariantPropertyManagerPrivate::slotRegExpChanged(QtProperty *property, const QRegularExpression ®Exp) { if (QtVariantProperty *varProp = m_internalToProperty.value(property, 0)) emit q_ptr->attributeChanged(varProp, m_regExpAttribute, QVariant(regExp)); @@ -987,11 +988,11 @@ QtVariantPropertyManager::QtVariantPropertyManager(QObject *parent) d_ptr->m_typeToPropertyManager[QVariant::String] = stringPropertyManager; d_ptr->m_typeToValueType[QVariant::String] = QVariant::String; d_ptr->m_typeToAttributeToAttributeType[QVariant::String][d_ptr->m_regExpAttribute] = - QVariant::RegExp; + QMetaType::QRegularExpression; connect(stringPropertyManager, SIGNAL(valueChanged(QtProperty *, const QString &)), this, SLOT(slotValueChanged(QtProperty *, const QString &))); - connect(stringPropertyManager, SIGNAL(regExpChanged(QtProperty *, const QRegExp &)), - this, SLOT(slotRegExpChanged(QtProperty *, const QRegExp &))); + connect(stringPropertyManager, SIGNAL(regExpChanged(QtProperty *, const QRegularExpression &)), + this, SLOT(slotRegExpChanged(QtProperty *, const QRegularExpression &))); // DatePropertyManager QtDatePropertyManager *datePropertyManager = new QtDatePropertyManager(this); d_ptr->m_typeToPropertyManager[QVariant::Date] = datePropertyManager; @@ -1623,7 +1624,7 @@ int QtVariantPropertyManager::attributeType(int propertyType, const QString &att The specified \a value must be of a type returned by valueType(), or of type that can be converted to valueType() using the - QVariant::canConvert() function, otherwise this function does + QMetaType::canConvert() function, otherwise this function does nothing. \sa value(), QtVariantProperty::setValue(), valueChanged() @@ -1636,7 +1637,7 @@ void QtVariantPropertyManager::setValue(QtProperty *property, const QVariant &va int valType = valueType(property); - if (propType != valType && !val.canConvert(static_cast(valType))) + if (propType != valType && !val.canConvert(QMetaType(valType))) return; QtProperty *internProp = propertyToWrappedProperty()->value(property, 0); @@ -1723,7 +1724,7 @@ void QtVariantPropertyManager::setValue(QtProperty *property, const QVariant &va The new \a value's type must be of the type returned by attributeType(), or of a type that can be converted to - attributeType() using the QVariant::canConvert() function, + attributeType() using the QMetaType::canConvert() function, otherwise this function does nothing. \sa attributeValue(), QtVariantProperty::setAttribute(), attributeChanged() @@ -1740,7 +1741,7 @@ void QtVariantPropertyManager::setAttribute(QtProperty *property, return; if (attrType != attributeType(propertyType(property), attribute) && - !value.canConvert((QVariant::Type)attrType)) + !value.canConvert(QMetaType(attrType))) return; QtProperty *internProp = propertyToWrappedProperty()->value(property, 0); @@ -1768,7 +1769,7 @@ void QtVariantPropertyManager::setAttribute(QtProperty *property, return; } else if (QtStringPropertyManager *stringManager = qobject_cast(manager)) { if (attribute == d_ptr->m_regExpAttribute) - stringManager->setRegExp(internProp, value.value()); + stringManager->setRegExp(internProp, value.value()); return; } else if (QtDatePropertyManager *dateManager = qobject_cast(manager)) { if (attribute == d_ptr->m_maximumAttribute) diff --git a/3rdparty/QtPropertyBrowser/src/qtvariantproperty.h b/3rdparty/QtPropertyBrowser/src/qtvariantproperty.h index 5fb83d6a..dc2dd1f9 100644 --- a/3rdparty/QtPropertyBrowser/src/qtvariantproperty.h +++ b/3rdparty/QtPropertyBrowser/src/qtvariantproperty.h @@ -129,7 +129,7 @@ private: Q_PRIVATE_SLOT(d_func(), void slotDecimalsChanged(QtProperty *, int)) Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, bool)) Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QString &)) - Q_PRIVATE_SLOT(d_func(), void slotRegExpChanged(QtProperty *, const QRegExp &)) + Q_PRIVATE_SLOT(d_func(), void slotRegExpChanged(QtProperty *, const QRegularExpression &)) Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QDate &)) Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, const QDate &, const QDate &)) Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QTime &)) diff --git a/3rdparty/python-console/CMakeLists.txt b/3rdparty/python-console/CMakeLists.txt index 89433edc..9149f1a9 100644 --- a/3rdparty/python-console/CMakeLists.txt +++ b/3rdparty/python-console/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required( VERSION 2.8 ) project( PythonInterpreter ) set(CMAKE_CXX_STANDARD 11) -find_package(Qt5 COMPONENTS Core Widgets REQUIRED) +find_package(Qt6 COMPONENTS Core Widgets REQUIRED) find_package( PythonLibs REQUIRED ) include_directories( ${PYTHON_INCLUDE_DIRS} ) @@ -10,7 +10,7 @@ include_directories( ${PYTHON_INCLUDE_DIRS} ) add_executable( test_python_interpreter test_python_interpreter.cpp Interpreter.cpp ) target_link_libraries( test_python_interpreter ${PYTHON_LIBRARIES} ) -qt5_wrap_cpp( Console_MOC Console.h ) +qt6_wrap_cpp( Console_MOC Console.h ) add_executable( test_console test_console.cpp Console.cpp ${Console_MOC} ColumnFormatter.cpp @@ -22,7 +22,7 @@ add_executable( test_console test_console.cpp ParseMessage.cpp ) target_compile_definitions( test_console PRIVATE QT_NO_KEYWORDS) -target_link_libraries( test_console Qt5::Widgets ${PYTHON_LIBRARIES} ) +target_link_libraries( test_console Qt6::Widgets ${PYTHON_LIBRARIES} ) add_executable( test_parse_helper test_parse_helper.cpp ParseHelper.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 562c718d..ea208832 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -197,8 +197,8 @@ else() endif() if (BUILD_GUI) - # Find the Qt5 libraries - find_package(Qt5 COMPONENTS Core Widgets OpenGL REQUIRED) + # Find the Qt6 libraries + find_package(Qt6 COMPONENTS Core Widgets OpenGL OpenGLWidgets REQUIRED) # For higher quality backtraces set(CMAKE_ENABLE_EXPORTS ON) diff --git a/README.md b/README.md index 1188270b..7f91861f 100644 --- a/README.md +++ b/README.md @@ -173,12 +173,11 @@ sudo make install ### GUI -The nextpnr GUI is not built by default, to reduce the number of dependencies for a standard headless build. To enable it, add `-DBUILD_GUI=ON` to the CMake command line and ensure that Qt5 and OpenGL are available: +The nextpnr GUI is not built by default, to reduce the number of dependencies for a standard headless build. To enable it, add `-DBUILD_GUI=ON` to the CMake command line and ensure that Qt6 and OpenGL are available: - - On Ubuntu 22.04 LTS, install `qtcreator qtbase5-dev qt5-qmake` - - On other Ubuntu versions, install `qt5-default` - - For MSVC vcpkg, install `qt5-base` (32-bit) or `qt5-base:x64-windows` (64-bit) - - For Homebrew, install `qt5` and add qt5 in path: `echo 'export PATH="/usr/local/opt/qt/bin:$PATH"' >> ~/.bash_profile` + - On Ubuntu 22.04 LTS, install `qt6-base-dev` + - For MSVC vcpkg, install `qtbase` (32-bit) or `qtbase:x64-windows` (64-bit) + - For Homebrew, install `qt6` and add qt6 in path: `echo 'export PATH="/usr/local/opt/qt/bin:$PATH"' >> ~/.bash_profile` ` - this change is effective in next terminal session, so please re-open terminal window before building ### Multiple architectures diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt index ff5d9208..d6ec6af3 100644 --- a/gui/CMakeLists.txt +++ b/gui/CMakeLists.txt @@ -27,7 +27,7 @@ set(GUI_SOURCES ${family}/mainwindow.h ) -qt5_add_resources(GUI_QT_RESOURCES +qt6_add_resources(GUI_QT_RESOURCES base.qrc ${family}/nextpnr.qrc ) @@ -55,13 +55,14 @@ target_include_directories(nextpnr-${target}-gui PRIVATE ) target_link_libraries(nextpnr-${target}-gui PUBLIC - Qt5::Widgets + Qt6::Widgets ) target_link_libraries(nextpnr-${target}-gui PRIVATE nextpnr-${target}-defs nextpnr_version - Qt5::OpenGL + Qt6::OpenGL + Qt6::OpenGLWidgets QtPropertyBrowser pybind11::headers ) diff --git a/gui/designwidget.cc b/gui/designwidget.cc index b7c16d45..014fdfd0 100644 --- a/gui/designwidget.cc +++ b/gui/designwidget.cc @@ -20,6 +20,7 @@ #include "designwidget.h" #include +#include #include #include #include diff --git a/gui/fpgaviewwidget.cc b/gui/fpgaviewwidget.cc index 3787536f..2bc1244e 100644 --- a/gui/fpgaviewwidget.cc +++ b/gui/fpgaviewwidget.cc @@ -22,7 +22,6 @@ #include #include -#include #include #include #include @@ -728,7 +727,7 @@ void FPGAViewWidget::mousePressEvent(QMouseEvent *event) lastDragPos_ = event->pos(); } if (btn_left && !shift) { - auto world = mouseToWorldCoordinates(event->x(), event->y()); + auto world = mouseToWorldCoordinates(event->position().x(), event->position().y()); auto closestOr = pickElement(world.x(), world.y()); if (!closestOr) { // If we clicked on empty space and aren't holding down ctrl, @@ -765,8 +764,8 @@ void FPGAViewWidget::mouseMoveEvent(QMouseEvent *event) bool btn_left = event->buttons() & Qt::LeftButton; if (btn_right || btn_mid || (btn_left && shift)) { - const int dx = event->x() - lastDragPos_.x(); - const int dy = event->y() - lastDragPos_.y(); + const int dx = event->position().x() - lastDragPos_.x(); + const int dy = event->position().y() - lastDragPos_.y(); lastDragPos_ = event->pos(); auto world = mouseToWorldDimensions(dx, dy); @@ -776,7 +775,7 @@ void FPGAViewWidget::mouseMoveEvent(QMouseEvent *event) return; } - auto world = mouseToWorldCoordinates(event->x(), event->y()); + auto world = mouseToWorldCoordinates(event->position().x(), event->position().y()); auto closestOr = pickElement(world.x(), world.y()); // No elements? No decal. if (!closestOr) { @@ -794,8 +793,8 @@ void FPGAViewWidget::mouseMoveEvent(QMouseEvent *event) QMutexLocker locked(&rendererArgsLock_); rendererArgs_->hoveredDecal = closest.decal(ctx_); rendererArgs_->changed = true; - rendererArgs_->x = event->x(); - rendererArgs_->y = event->y(); + rendererArgs_->x = event->position().x(); + rendererArgs_->y = event->position().y(); if (closest.type == ElementType::BEL) { rendererArgs_->hintText = std::string("BEL\n") + ctx_->getBelName(closest.bel).str(ctx_); CellInfo *cell = ctx_->getBoundBelCell(closest.bel); diff --git a/machxo2/README.md b/machxo2/README.md index 37dfb991..e3f94168 100644 --- a/machxo2/README.md +++ b/machxo2/README.md @@ -38,7 +38,7 @@ The following commands are known to work on a near-fresh Linux Mint system ``` sudo apt install cmake clang-format libboost-all-dev build-essential -qt5-default libeigen3-dev build-essential clang bison flex libreadline-dev +qt6-base-dev libeigen3-dev build-essential clang bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev python3-setuptools python3-serial diff --git a/shell.nix b/shell.nix index 75277837..5978a87e 100644 --- a/shell.nix +++ b/shell.nix @@ -10,7 +10,7 @@ in pkgs.mkShell { boostPython pythonPkgs.python pythonPkgs.apycula - libsForQt5.qt5.qtbase + pkgs.qt6.qtbase llvmPackages.openmp icestorm trellis @@ -25,6 +25,6 @@ in pkgs.mkShell { shellHook = '' export TRELLIS_INSTALL_PREFIX=${pkgs.trellis} export ICESTORM_INSTALL_PREFIX=${pkgs.icestorm} - export QT_QPA_PLATFORM_PLUGIN_PATH="${pkgs.libsForQt5.qt5.qtbase.bin}/lib/qt-${pkgs.libsForQt5.qt5.qtbase.version}/plugins"; + export QT_QPA_PLATFORM_PLUGIN_PATH="${pkgs.qt6.qtbase.bin}/lib/qt-${pkgs.qt6.qtbase.version}/plugins"; ''; }