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
|
|
@ -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