diff options
Diffstat (limited to 'src/designer/src/lib/shared/qdesigner_propertysheet.cpp')
-rw-r--r-- | src/designer/src/lib/shared/qdesigner_propertysheet.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/designer/src/lib/shared/qdesigner_propertysheet.cpp b/src/designer/src/lib/shared/qdesigner_propertysheet.cpp index c142ee7b1..b860c2dad 100644 --- a/src/designer/src/lib/shared/qdesigner_propertysheet.cpp +++ b/src/designer/src/lib/shared/qdesigner_propertysheet.cpp @@ -54,6 +54,7 @@ #include <QtWidgets/qtoolbar.h> #include <QtWidgets/qmainwindow.h> #include <QtWidgets/qmenubar.h> +#include <QtWidgets/qheaderview.h> QT_BEGIN_NAMESPACE @@ -561,6 +562,7 @@ QDesignerPropertySheet::PropertyType QDesignerPropertySheet::propertyTypeFromNam propertyTypeHash.insert(QStringLiteral("checkable"), PropertyCheckable); propertyTypeHash.insert(QStringLiteral("accessibleName"), PropertyAccessibility); propertyTypeHash.insert(QStringLiteral("accessibleDescription"), PropertyAccessibility); + propertyTypeHash.insert(QStringLiteral("visible"), PropertyVisible); propertyTypeHash.insert(QStringLiteral("windowTitle"), PropertyWindowTitle); propertyTypeHash.insert(QStringLiteral("windowIcon"), PropertyWindowIcon); propertyTypeHash.insert(QStringLiteral("windowFilePath"), PropertyWindowFilePath); @@ -1066,7 +1068,22 @@ QVariant QDesignerPropertySheet::property(int index) const return QVariant::fromValue(value); } - return metaProperty(index); + QVariant result = metaProperty(index); + // QTBUG-49591: "visible" is only exposed for QHeaderView as a fake + // property ("headerVisible") for the item view. If the item view is not + // visible (on a page based container), check the WA_WState_Hidden instead, + // since otherwise false is returned when saving. + if (result.type() == QVariant::Bool && !result.toBool() + && d->m_object->isWidgetType() + && propertyType(index) == PropertyVisible) { + if (auto *hv = qobject_cast<QHeaderView *>(d->m_object)) { + if (auto *parent = hv->parentWidget()) { + if (!parent->isVisible()) + result = QVariant(!hv->testAttribute(Qt::WA_WState_Hidden)); + } + } + } + return result; } QVariant QDesignerPropertySheet::metaProperty(int index) const |