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>
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);
- }
}
/*!
QWidgetWindow::QWidgetWindow(QWidget *widget)
: m_widget(widget)
{
+ updateObjectName();
+ connect(m_widget, &QObject::objectNameChanged, this, &QWidgetWindow::updateObjectName);
}
#ifndef QT_NO_ACCESSIBILITY
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
void handleWindowStateChangedEvent(QWindowStateChangeEvent *event);
bool nativeEvent(const QByteArray &eventType, void *message, long *result);
+private slots:
+ void updateObjectName();
+
private:
void updateGeometry();