Try to force a native menu item sync after adding the item
Hopefully this makes it visible and enabled properly.
This commit is contained in:
parent
e9bbd61110
commit
5fe8ebf335
3 changed files with 17 additions and 4 deletions
|
|
@ -420,12 +420,12 @@ Item {
|
|||
else
|
||||
link = "";
|
||||
|
||||
messageActionsCFilter.updateTarget();
|
||||
|
||||
if (showAt_)
|
||||
popup(showAt_);
|
||||
else
|
||||
popup();
|
||||
|
||||
messageActionsCFilter.updateTarget();
|
||||
}
|
||||
|
||||
Component {
|
||||
|
|
@ -659,8 +659,8 @@ Item {
|
|||
link = link_;
|
||||
eventId = eventId_;
|
||||
|
||||
popup();
|
||||
replyContextMenuCFilter.updateTarget();
|
||||
popup();
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ Menu {
|
|||
title: modelData != undefined ? modelData.name : qsTr("Add or remove from community")
|
||||
property bool loadChildren: false
|
||||
|
||||
onOpened: {
|
||||
onAboutToShow: {
|
||||
loadChildren = true;
|
||||
menuFilter.updateTarget();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <QQmlListReference>
|
||||
#include <QQuickItem>
|
||||
#include <QTimer>
|
||||
|
||||
#include "Logging.h"
|
||||
|
||||
|
|
@ -130,6 +131,18 @@ NhekoMenuVisibilityFilter::updateTarget()
|
|||
}
|
||||
}
|
||||
|
||||
QTimer::singleShot(0, this, [this] {
|
||||
auto createdItems = qvariant_cast<QQmlListReference>(targetProperty.read());
|
||||
// newItems.clear(); <- does not remove the visual items
|
||||
|
||||
for (qsizetype i = createdItems.size(); i > 0; i--) {
|
||||
// only remove items, not other random stuff in there!
|
||||
if (auto item = qobject_cast<QQuickItem *>(createdItems.at(i - 1))) {
|
||||
item->enabledChanged();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// targetProperty.write(QVariant::fromValue(std::move(newItems)));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue