Show all frame tags on "Go to frame" by default

This commit is contained in:
David Capello 2017-06-23 15:15:17 -03:00
parent 7156c4ae98
commit 08c70cc6ab

View File

@ -158,19 +158,31 @@ private:
: m_frameTags(frameTags) { : m_frameTags(frameTags) {
setEditable(true); setEditable(true);
getEntryWidget()->Change.connect(&TagsEntry::onEntryChange, this); getEntryWidget()->Change.connect(&TagsEntry::onEntryChange, this);
fill(true);
} }
private: private:
void onEntryChange() { void fill(bool all) {
removeAllItems(); removeAllItems();
closeListBox();
MatchWords match(getEntryWidget()->text()); MatchWords match(getEntryWidget()->text());
bool matchAny = false;
for (const auto& frameTag : m_frameTags) { for (const auto& frameTag : m_frameTags) {
if (match(frameTag->name())) if (match(frameTag->name())) {
matchAny = true;
break;
}
}
for (const auto& frameTag : m_frameTags) {
if (all || !matchAny || match(frameTag->name()))
addItem(frameTag->name()); addItem(frameTag->name());
} }
}
void onEntryChange() {
closeListBox();
fill(false);
if (getItemCount() > 0) if (getItemCount() > 0)
openListBox(); openListBox();
} }