Relayout when event delegates change implicit size

This commit is contained in:
Nicolas Werner 2023-10-18 21:37:24 +02:00
parent 85556c9e10
commit fab7805610
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
2 changed files with 4 additions and 1 deletions

View file

@ -21,7 +21,6 @@
#include <QTranslator> #include <QTranslator>
#include "ChatPage.h" #include "ChatPage.h"
#include "Config.h"
#include "Logging.h" #include "Logging.h"
#include "MainWindow.h" #include "MainWindow.h"
#include "MatrixClient.h" #include "MatrixClient.h"

View file

@ -303,6 +303,8 @@ EventDelegateChooser::updatePolish()
auto layoutItem = [this](QQuickItem *item, int inset) { auto layoutItem = [this](QQuickItem *item, int inset) {
if (item) { if (item) {
QObject::disconnect(item, &QQuickItem::implicitWidthChanged, this, &QQuickItem::polish);
auto attached = qobject_cast<EventDelegateChooserAttachedType *>( auto attached = qobject_cast<EventDelegateChooserAttachedType *>(
qmlAttachedPropertiesObject<EventDelegateChooser>(item)); qmlAttachedPropertiesObject<EventDelegateChooser>(item));
Q_ASSERT(attached != nullptr); Q_ASSERT(attached != nullptr);
@ -336,6 +338,8 @@ EventDelegateChooser::updatePolish()
item->setWidth(width); item->setWidth(width);
item->ensurePolished(); item->ensurePolished();
QObject::connect(item, &QQuickItem::implicitWidthChanged, this, &QQuickItem::polish);
} }
}; };