Port GUI to Qt6

This commit is contained in:
OpenProgger 2025-07-03 15:50:48 +02:00
parent 1d4b0eeac4
commit c1a6898f77
24 changed files with 95 additions and 98 deletions

View File

@ -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

View File

@ -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)

View File

@ -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
This fork adds CMake and Qt6 support

View File

@ -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()
endmacro()

View File

@ -17,7 +17,7 @@
include(CMakeFindDependencyMacro)
find_dependency(Qt5Widgets)
find_dependency(Qt6Widgets)
# Our library dependencies (contains definitions for IMPORTED targets)
if(NOT TARGET QtPropertyBrowser)

View File

@ -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})

View File

@ -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);

View File

@ -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)

View File

@ -904,7 +904,7 @@ class QtLineEditFactoryPrivate : public EditorFactoryPrivate<QLineEdit>
public:
void slotPropertyChanged(QtProperty *property, const QString &value);
void slotRegExpChanged(QtProperty *property, const QRegExp &regExp);
void slotRegExpChanged(QtProperty *property, const QRegularExpression &regExp);
void slotSetValue(const QString &value);
};
@ -923,7 +923,7 @@ void QtLineEditFactoryPrivate::slotPropertyChanged(QtProperty *property,
}
void QtLineEditFactoryPrivate::slotRegExpChanged(QtProperty *property,
const QRegExp &regExp)
const QRegularExpression &regExp)
{
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);
}

View File

@ -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 *))
};

View File

@ -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);
}

View File

@ -444,7 +444,7 @@ static QList<QLocale::Country> sortCountries(const QList<QLocale::Country> &coun
QListIterator<QLocale::Country> 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<QLocale::Country> 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<const QtProperty *, Data> PropertyValueMap;
@ -1271,7 +1269,7 @@ public:
*/
/*!
\fn void QtStringPropertyManager::regExpChanged(QtProperty *property, const QRegExp &regExp)
\fn void QtStringPropertyManager::regExpChanged(QtProperty *property, const QRegularExpression &regExp)
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<QRegExp>(d_ptr->m_values, &QtStringPropertyManagerPrivate::Data::regExp, property, QRegExp());
return getData<QRegularExpression>(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 &regExp)
void QtStringPropertyManager::setRegExp(QtProperty *property, const QRegularExpression &regExp)
{
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<const QtProperty *, QtProperty *> 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)

View File

@ -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 &regExp);
void setRegExp(QtProperty *property, const QRegularExpression &regExp);
Q_SIGNALS:
void valueChanged(QtProperty *property, const QString &val);
void regExpChanged(QtProperty *property, const QRegExp &regExp);
void regExpChanged(QtProperty *property, const QRegularExpression &regExp);
protected:
QString valueText(const QtProperty *property) const;
virtual void initializeProperty(QtProperty *property);

View File

@ -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));

View File

@ -41,6 +41,7 @@
#include "qtvariantproperty.h"
#include "qtpropertymanager.h"
#include "qteditorfactory.h"
#include <QtCore/QRegularExpression>
#include <QtCore/QVariant>
#include <QtGui/QIcon>
#include <QtCore/QDate>
@ -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 &regExp);
void slotRegExpChanged(QtProperty *property, const QRegularExpression &regExp);
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 &regExp)
void QtVariantPropertyManagerPrivate::slotRegExpChanged(QtProperty *property, const QRegularExpression &regExp)
{
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<QVariant::Type>(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<QtStringPropertyManager *>(manager)) {
if (attribute == d_ptr->m_regExpAttribute)
stringManager->setRegExp(internProp, value.value<QRegExp>());
stringManager->setRegExp(internProp, value.value<QRegularExpression>());
return;
} else if (QtDatePropertyManager *dateManager = qobject_cast<QtDatePropertyManager *>(manager)) {
if (attribute == d_ptr->m_maximumAttribute)

View File

@ -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 &))

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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
)

View File

@ -20,6 +20,7 @@
#include "designwidget.h"
#include <QAction>
#include <QActionGroup>
#include <QApplication>
#include <QGridLayout>
#include <QLineEdit>

View File

@ -22,7 +22,6 @@
#include <QApplication>
#include <QCoreApplication>
#include <QDesktopWidget>
#include <QDir>
#include <QFileInfo>
#include <QImageWriter>
@ -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);

View File

@ -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

View File

@ -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";
'';
}