QmlDesigner.PropertyEditor: Remove workarounds and unnecessary code

The workaround and optimizations do not seem to be required anymore.
The property editor is now fast enough and no delay using a timer
is required anymore. We also do not have to setup the Item pane upfront.

Change-Id: Ieb64fcf5e37b74f1e755bc06674deede66a6f666
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
Thomas Hartmann
2024-11-28 13:38:16 +01:00
committed by Thomas Hartmann
parent 4bdb0fb968
commit 0eab8c88b6
2 changed files with 5 additions and 75 deletions

View File

@@ -82,8 +82,7 @@ PropertyEditorView::PropertyEditorView(AsynchronousImageCache &imageCache,
, m_propertyComponentGenerator{QmlDesigner::PropertyEditorQmlBackend::propertyEditorResourcesPath(),
model()}
, m_locked(false)
, m_setupCompleted(false)
, m_singleShotTimer(new QTimer(this))
{
m_qmlDir = PropertyEditorQmlBackend::propertyEditorResourcesPath();
@@ -109,32 +108,6 @@ PropertyEditorView::~PropertyEditorView()
qDeleteAll(m_qmlBackendHash);
}
void PropertyEditorView::setupPane([[maybe_unused]] const TypeName &typeName)
{
#ifndef QDS_USE_PROJECTSTORAGE
NodeMetaInfo metaInfo = model()->metaInfo(typeName);
QUrl qmlFile = PropertyEditorQmlBackend::getQmlFileUrl("Qt/ItemPane", metaInfo);
QUrl qmlSpecificsFile;
qmlSpecificsFile = PropertyEditorQmlBackend::getQmlFileUrl(typeName + "Specifics", metaInfo);
PropertyEditorQmlBackend *qmlBackend = m_qmlBackendHash.value(qmlFile.toString());
if (!qmlBackend) {
qmlBackend = new PropertyEditorQmlBackend(this, m_imageCache);
qmlBackend->initialSetup(typeName, qmlSpecificsFile, this);
qmlBackend->setSource(qmlFile);
m_stackedWidget->addWidget(qmlBackend->widget());
m_qmlBackendHash.insert(qmlFile.toString(), qmlBackend);
} else {
qmlBackend->initialSetup(typeName, qmlSpecificsFile, this);
}
#endif // QDS_USE_PROJECTSTORAGE
}
void PropertyEditorView::changeValue(const QString &name)
{
PropertyName propertyName = name.toUtf8();
@@ -441,30 +414,6 @@ void PropertyEditorView::updateSize()
frame->resize(m_stackedWidget->size());
}
void PropertyEditorView::setupPanes()
{
if (isAttached()) {
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
setupPane("QtQuick.Item");
resetView();
m_setupCompleted = true;
QApplication::restoreOverrideCursor();
}
}
void PropertyEditorView::delayedResetView()
{
if (m_timerId)
killTimer(m_timerId);
m_timerId = startTimer(50);
}
void PropertyEditorView::timerEvent(QTimerEvent *timerEvent)
{
if (m_timerId == timerEvent->timerId())
resetView();
}
void PropertyEditorView::resetView()
{
if (model() == nullptr)
@@ -780,20 +729,6 @@ void PropertyEditorView::modelAttached(Model *model)
if (debug)
qDebug() << Q_FUNC_INFO;
m_locked = true;
if (!m_setupCompleted) {
QTimer::singleShot(50, this, [this] {
if (isAttached()) {
PropertyEditorView::setupPanes();
/* workaround for QTBUG-75847 */
reloadQml();
}
});
}
m_locked = false;
resetView();
}
@@ -982,7 +917,7 @@ void PropertyEditorView::select()
if (m_qmlBackEndForCurrentType)
m_qmlBackEndForCurrentType->emitSelectionToBeChanged();
delayedResetView();
resetView();
auto nodes = selectedModelNodes();
@@ -1026,7 +961,7 @@ void PropertyEditorView::currentStateChanged(const ModelNode &node)
Q_ASSERT(newQmlModelState.isValid());
if (debug)
qDebug() << Q_FUNC_INFO << newQmlModelState.name();
delayedResetView();
resetView();
}
void PropertyEditorView::instancePropertyChanged(const QList<QPair<ModelNode, PropertyName> > &propertyList)
@@ -1065,13 +1000,13 @@ void PropertyEditorView::instancePropertyChanged(const QList<QPair<ModelNode, Pr
void PropertyEditorView::rootNodeTypeChanged(const QString &/*type*/, int /*majorVersion*/, int /*minorVersion*/)
{
delayedResetView();
resetView();
}
void PropertyEditorView::nodeTypeChanged(const ModelNode &node, const TypeName &, int, int)
{
if (node == m_selectedNode)
delayedResetView();
resetView();
}
void PropertyEditorView::nodeReparented(const ModelNode &node,

View File

@@ -98,15 +98,12 @@ public:
const QString &propertyName);
protected:
void timerEvent(QTimerEvent *event) override;
void setupPane(const TypeName &typeName);
void setValue(const QmlObjectNode &fxObjectNode, PropertyNameView name, const QVariant &value);
bool eventFilter(QObject *obj, QEvent *event) override;
private: //functions
void reloadQml();
void updateSize();
void setupPanes();
void select();
void setSelelectedModelNode();
@@ -133,8 +130,6 @@ private: //variables
PropertyComponentGenerator m_propertyComponentGenerator;
PropertyEditorComponentGenerator m_propertyEditorComponentGenerator{m_propertyComponentGenerator};
bool m_locked;
bool m_setupCompleted;
QTimer *m_singleShotTimer;
bool m_textureAboutToBeRemoved = false;
};