uic: Write fully qualified enum values for QMainWindow enumerations
Task-number: PYSIDE-2492 Task-number: PYSIDE-1735 Task-number: QTBUG-118473 Change-Id: Ief50914bae3cc8e55f61113e8c8b6d6d24fe2c0f Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
parent
39ce0e3982
commit
effe9bd026
@ -42,6 +42,16 @@ namespace {
|
||||
return expandEnum(value, "QSizePolicy::Policy"_L1);
|
||||
}
|
||||
|
||||
inline QString expandToolBarArea(const QString &value)
|
||||
{
|
||||
return expandEnum(value, "Qt::ToolBarArea"_L1);
|
||||
}
|
||||
|
||||
inline QString expandDockWidgetArea(const QString &value)
|
||||
{
|
||||
return expandEnum(value, "Qt::DockWidgetArea"_L1);
|
||||
}
|
||||
|
||||
// figure out the toolbar area of a DOM attrib list.
|
||||
// By legacy, it is stored as an integer. As of 4.3.0, it is the enumeration value.
|
||||
QString toolBarAreaStringFromDOMAttributes(const CPP::WriteInitialization::DomPropertyMap &attributes) {
|
||||
@ -59,9 +69,7 @@ namespace {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (!result.startsWith("Qt::"_L1))
|
||||
result.prepend("Qt::"_L1);
|
||||
return result + ", "_L1;
|
||||
return expandToolBarArea(result) + ", "_L1;
|
||||
}
|
||||
|
||||
// Write a statement to create a spacer item.
|
||||
@ -709,8 +717,8 @@ void WriteInitialization::acceptWidget(DomWidget *node)
|
||||
} else if (cwi->extends(className, "QDockWidget")) {
|
||||
m_output << m_indent << parentWidget << language::derefPointer << "addDockWidget(";
|
||||
if (DomProperty *pstyle = attributes.value("dockWidgetArea"_L1)) {
|
||||
m_output << "Qt" << language::qualifier
|
||||
<< language::dockWidgetArea(pstyle->elementNumber()) << ", ";
|
||||
QString a = expandDockWidgetArea(language::dockWidgetArea(pstyle->elementNumber()));
|
||||
m_output << language::enumValue(a) << ", ";
|
||||
}
|
||||
m_output << varName << ")" << language::eol;
|
||||
} else if (m_uic->customWidgetsInfo()->extends(className, "QStatusBar")) {
|
||||
|
@ -94,7 +94,7 @@ public:
|
||||
mainToolBar = new QToolBar(TrPreviewToolClass);
|
||||
mainToolBar->setObjectName("mainToolBar");
|
||||
mainToolBar->setOrientation(Qt::Horizontal);
|
||||
TrPreviewToolClass->addToolBar(Qt::TopToolBarArea, mainToolBar);
|
||||
TrPreviewToolClass->addToolBar(Qt::ToolBarArea::TopToolBarArea, mainToolBar);
|
||||
statusBar = new QStatusBar(TrPreviewToolClass);
|
||||
statusBar->setObjectName("statusBar");
|
||||
TrPreviewToolClass->setStatusBar(statusBar);
|
||||
@ -115,7 +115,7 @@ public:
|
||||
vboxLayout->addWidget(viewForms);
|
||||
|
||||
dwForms->setWidget(dockWidgetContents);
|
||||
TrPreviewToolClass->addDockWidget(Qt::LeftDockWidgetArea, dwForms);
|
||||
TrPreviewToolClass->addDockWidget(Qt::DockWidgetArea::LeftDockWidgetArea, dwForms);
|
||||
|
||||
menuBar->addAction(menuFile->menuAction());
|
||||
menuBar->addAction(menuView->menuAction());
|
||||
|
Loading…
Reference in New Issue
Block a user