QmlDesigner: Fix showing Component Library module context menu

The context menu for modules and categories was not working properly
during search. The menu is now disabled whenever the search is
ongoing, as it's unnecessary to show it at that time.

Fixes: QDS-4230
Change-Id: If0465f973188d199982e87e765fbfe1efb641bb7
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
Miina Puuronen
2021-05-18 17:25:09 +03:00
parent bc58589dee
commit 2c8a9a6761
3 changed files with 10 additions and 2 deletions

View File

@@ -225,7 +225,8 @@ ScrollView {
importToRemove = importRemovable ? importUrl : ""
currentImport = model
currentCategory = null
moduleContextMenu.popup()
if (!rootView.isSearchActive())
moduleContextMenu.popup()
}
Column {
@@ -251,7 +252,8 @@ ScrollView {
onShowContextMenu: {
currentCategory = model
currentImport = parent.currentImportModel
moduleContextMenu.popup()
if (!rootView.isSearchActive())
moduleContextMenu.popup()
}
Grid {

View File

@@ -301,6 +301,11 @@ void ItemLibraryWidget::handleAddImport(int index)
updateSearch();
}
bool ItemLibraryWidget::isSearchActive() const
{
return !m_filterText.isEmpty();
}
void ItemLibraryWidget::delayedUpdateModel()
{
static bool disableTimer = DesignerSettings::getValue(DesignerSettingsKey::DISABLE_ITEM_LIBRARY_UPDATE_TIMER).toBool();

View File

@@ -96,6 +96,7 @@ public:
Q_INVOKABLE void handleAddAsset();
Q_INVOKABLE void handleSearchfilterChanged(const QString &filterText);
Q_INVOKABLE void handleAddImport(int index);
Q_INVOKABLE bool isSearchActive() const;
signals:
void itemActivated(const QString& itemName);