Keep object name of QWidgetWindow in sync with the widget.
Use new objectNameChanged() signal. Change-Id: I247566bd51d23ec65ff74ba9ac7be0d18e8ff160 Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
This commit is contained in:
parent
fe59f15a5b
commit
78b9de746c
@ -9074,16 +9074,6 @@ void QWidget::ensurePolished() const
|
||||
QChildEvent e(QEvent::ChildPolished, const_cast<QWidget *>(this));
|
||||
QCoreApplication::sendEvent(d->parent, &e);
|
||||
}
|
||||
if (d->extra && d->extra->topextra && d->extra->topextra->window
|
||||
&& d->extra->topextra->window->objectName().isEmpty()) {
|
||||
QString on = objectName();
|
||||
if (on.isEmpty()) {
|
||||
on = QString::fromUtf8(metaObject()->className());
|
||||
on += QStringLiteral("Class");
|
||||
}
|
||||
on += QStringLiteral("Window");
|
||||
d->extra->topextra->window->setObjectName(on);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -60,6 +60,8 @@ extern bool qt_try_modal(QWidget *widget, QEvent::Type type);
|
||||
QWidgetWindow::QWidgetWindow(QWidget *widget)
|
||||
: m_widget(widget)
|
||||
{
|
||||
updateObjectName();
|
||||
connect(m_widget, &QObject::objectNameChanged, this, &QWidgetWindow::updateObjectName);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
@ -507,4 +509,13 @@ bool QWidgetWindow::nativeEvent(const QByteArray &eventType, void *message, long
|
||||
return m_widget->nativeEvent(eventType, message, result);
|
||||
}
|
||||
|
||||
void QWidgetWindow::updateObjectName()
|
||||
{
|
||||
QString name = m_widget->objectName();
|
||||
if (name.isEmpty())
|
||||
name = QString::fromUtf8(m_widget->metaObject()->className()) + QStringLiteral("Class");
|
||||
name += QStringLiteral("Window");
|
||||
setObjectName(name);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -83,6 +83,9 @@ protected:
|
||||
void handleWindowStateChangedEvent(QWindowStateChangeEvent *event);
|
||||
bool nativeEvent(const QByteArray &eventType, void *message, long *result);
|
||||
|
||||
private slots:
|
||||
void updateObjectName();
|
||||
|
||||
private:
|
||||
void updateGeometry();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user