uic: Do not generate QComboBox::AdjustToMinimumContentsLength into code
The enumeration value was removed in Qt 6 by1a342b2db1
. Ignore it. Add a check to helper function checkProperty() and move the code froma5e2f2ddad
there as well. Pick-to: 6.0 Task-number: QTBUG-89093 Fixes: QTBUG-89700 Change-Id: I0890be8fff155d7342e2386b7f6b0783a5f3a192 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
parent
1dc4e5d3eb
commit
179696fcb8
@ -136,8 +136,29 @@ namespace {
|
||||
// Check on properties. Filter out empty legacy pixmap/icon properties
|
||||
// as Designer pre 4.4 used to remove missing resource references.
|
||||
// This can no longer be handled by the code as we have 'setIcon(QIcon())' as well as 'QIcon icon'
|
||||
static bool checkProperty(const QString &fileName, const DomProperty *p) {
|
||||
static bool checkProperty(const CustomWidgetsInfo *customWidgetsInfo,
|
||||
const QString &fileName, const QString &className,
|
||||
const DomProperty *p) {
|
||||
switch (p->kind()) {
|
||||
// ### fixme Qt 7 remove this: Exclude deprecated properties of Qt 5.
|
||||
case DomProperty::Set:
|
||||
if (p->attributeName() == u"features"
|
||||
&& customWidgetsInfo->extends(className, QLatin1String("QDockWidget"))
|
||||
&& p->elementSet() == u"QDockWidget::AllDockWidgetFeatures") {
|
||||
const QString msg = fileName + QLatin1String(": Warning: Deprecated enum value QDockWidget::AllDockWidgetFeatures was encountered.");
|
||||
qWarning("%s", qPrintable(msg));
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case DomProperty::Enum:
|
||||
if (p->attributeName() == u"sizeAdjustPolicy"
|
||||
&& customWidgetsInfo->extends(className, QLatin1String("QComboBox"))
|
||||
&& p->elementEnum() == u"QComboBox::AdjustToMinimumContentsLength") {
|
||||
const QString msg = fileName + QLatin1String(": Warning: Deprecated enum value QComboBox::AdjustToMinimumContentsLength was encountered.");
|
||||
qWarning("%s", qPrintable(msg));
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case DomProperty::IconSet:
|
||||
if (const DomResourceIcon *dri = p->elementIconSet()) {
|
||||
if (!isIconFormat44(dri)) {
|
||||
@ -1204,7 +1225,7 @@ void WriteInitialization::writeProperties(const QString &varName,
|
||||
bool frameShadowEncountered = false;
|
||||
|
||||
for (const DomProperty *p : lst) {
|
||||
if (!checkProperty(m_option.inputFile, p))
|
||||
if (!checkProperty(m_uic->customWidgetsInfo(), m_option.inputFile, className, p))
|
||||
continue;
|
||||
QString propertyName = p->attributeName();
|
||||
QString propertyValue;
|
||||
@ -1297,10 +1318,6 @@ void WriteInitialization::writeProperties(const QString &varName,
|
||||
propertyName = QLatin1String("digitCount");
|
||||
} else if (propertyName == QLatin1String("frameShadow")) {
|
||||
frameShadowEncountered = true;
|
||||
} else if (p->kind() == DomProperty::Set && propertyName == u"features"
|
||||
&& m_uic->customWidgetsInfo()->extends(className, QLatin1String("QDockWidget"))
|
||||
&& p->elementSet() == u"QDockWidget::AllDockWidgetFeatures") {
|
||||
continue; // ### fixme Qt 7 remove this: Exclude deprecated value of Qt 5.
|
||||
}
|
||||
|
||||
bool stdset = m_stdsetdef;
|
||||
|
Loading…
Reference in New Issue
Block a user