From 4b17d5da439fca7c3312b2d5c7d2459604d5147b Mon Sep 17 00:00:00 2001 From: Capostrophic Date: Tue, 25 Feb 2020 15:21:06 +0300 Subject: [PATCH] Make search fields behave more consistently --- apps/openmw/mwgui/companionwindow.cpp | 4 ++++ apps/openmw/mwgui/inventorywindow.cpp | 4 ++++ apps/openmw/mwgui/keyboardnavigation.cpp | 3 --- apps/openmw/mwgui/spellwindow.cpp | 2 +- apps/openmw/mwgui/tradewindow.cpp | 2 ++ 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwgui/companionwindow.cpp b/apps/openmw/mwgui/companionwindow.cpp index acbe2ca52..426894451 100644 --- a/apps/openmw/mwgui/companionwindow.cpp +++ b/apps/openmw/mwgui/companionwindow.cpp @@ -48,6 +48,9 @@ CompanionWindow::CompanionWindow(DragAndDrop *dragAndDrop, MessageBoxManager* ma getWidget(mEncumbranceBar, "EncumbranceBar"); getWidget(mFilterEdit, "FilterEdit"); getWidget(mItemView, "ItemView"); + + mFilterEdit->setUserString("AcceptTab", "true"); + mItemView->eventBackgroundClicked += MyGUI::newDelegate(this, &CompanionWindow::onBackgroundSelected); mItemView->eventItemClicked += MyGUI::newDelegate(this, &CompanionWindow::onItemSelected); mFilterEdit->eventEditTextChange += MyGUI::newDelegate(this, &CompanionWindow::onNameFilterChanged); @@ -121,6 +124,7 @@ void CompanionWindow::setPtr(const MWWorld::Ptr& npc) mModel = new CompanionItemModel(npc); mSortModel = new SortFilterItemModel(mModel); + mFilterEdit->setCaption(std::string()); mItemView->setModel(mSortModel); mItemView->resetScrollBars(); diff --git a/apps/openmw/mwgui/inventorywindow.cpp b/apps/openmw/mwgui/inventorywindow.cpp index 77a14101a..6c85fe016 100644 --- a/apps/openmw/mwgui/inventorywindow.cpp +++ b/apps/openmw/mwgui/inventorywindow.cpp @@ -91,6 +91,8 @@ namespace MWGui getWidget(mArmorRating, "ArmorRating"); getWidget(mFilterEdit, "FilterEdit"); + mFilterEdit->setUserString("AcceptTab", "true"); + mAvatarImage->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryWindow::onAvatarClicked); mAvatarImage->setRenderItemTexture(mPreviewTexture.get()); mAvatarImage->getSubWidgetMain()->_setUVSet(MyGUI::FloatRect(0.f, 0.f, 1.f, 1.f)); @@ -134,6 +136,8 @@ namespace MWGui else mSortModel = new SortFilterItemModel(mTradeModel); + mSortModel->setNameFilter(mFilterEdit->getCaption()); + mItemView->setModel(mSortModel); mFilterAll->setStateSelected(true); diff --git a/apps/openmw/mwgui/keyboardnavigation.cpp b/apps/openmw/mwgui/keyboardnavigation.cpp index 7355dc1f4..3f98b8607 100644 --- a/apps/openmw/mwgui/keyboardnavigation.cpp +++ b/apps/openmw/mwgui/keyboardnavigation.cpp @@ -16,9 +16,6 @@ namespace MWGui bool shouldAcceptKeyFocus(MyGUI::Widget* w) { - if (w && w->getUserString("IgnoreTabKey") == "y") - return false; - return w && !w->castType(false) && w->getInheritedEnabled() && w->getInheritedVisible() && w->getVisible() && w->getEnabled(); } diff --git a/apps/openmw/mwgui/spellwindow.cpp b/apps/openmw/mwgui/spellwindow.cpp index d0be05dfb..406ff1222 100644 --- a/apps/openmw/mwgui/spellwindow.cpp +++ b/apps/openmw/mwgui/spellwindow.cpp @@ -45,7 +45,7 @@ namespace MWGui getWidget(mEffectBox, "EffectsBox"); getWidget(mFilterEdit, "FilterEdit"); - mFilterEdit->setUserString("IgnoreTabKey", "y"); + mFilterEdit->setUserString("AcceptTab", "true"); mSpellView->eventSpellClicked += MyGUI::newDelegate(this, &SpellWindow::onModelIndexSelected); mFilterEdit->eventEditTextChange += MyGUI::newDelegate(this, &SpellWindow::onFilterChanged); diff --git a/apps/openmw/mwgui/tradewindow.cpp b/apps/openmw/mwgui/tradewindow.cpp index b102b13ce..9d977e603 100644 --- a/apps/openmw/mwgui/tradewindow.cpp +++ b/apps/openmw/mwgui/tradewindow.cpp @@ -71,6 +71,8 @@ namespace MWGui getWidget(mBottomPane, "BottomPane"); getWidget(mFilterEdit, "FilterEdit"); + mFilterEdit->setUserString("AcceptTab", "true"); + getWidget(mItemView, "ItemView"); mItemView->eventItemClicked += MyGUI::newDelegate(this, &TradeWindow::onItemSelected);