Made search bar in resource browser feel more responsive
This commit is contained in:
parent
678ca01fb1
commit
5ac292ebc5
|
@ -45,6 +45,7 @@ CResourceBrowser::CResourceBrowser(QWidget *pParent)
|
|||
connect(mpUI->DirectoryTreeView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(OnDirectorySelectionChanged(QModelIndex,QModelIndex)));
|
||||
connect(mpUI->ResourceTableView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(OnDoubleClickResource(QModelIndex)));
|
||||
connect(pImportFromContentsTxtAction, SIGNAL(triggered()), this, SLOT(OnImportPakContentsTxt()));
|
||||
connect(&mUpdateFilterTimer, SIGNAL(timeout()), this, SLOT(UpdateFilter()));
|
||||
}
|
||||
|
||||
CResourceBrowser::~CResourceBrowser()
|
||||
|
@ -79,7 +80,8 @@ void CResourceBrowser::OnSortModeChanged(int Index)
|
|||
|
||||
void CResourceBrowser::OnSearchStringChanged()
|
||||
{
|
||||
mpProxyModel->SetSearchString( TO_TWIDESTRING(mpUI->SearchBar->text()) );
|
||||
const int kUpdateWaitTime = 500;
|
||||
mUpdateFilterTimer.start(kUpdateWaitTime);
|
||||
}
|
||||
|
||||
void CResourceBrowser::OnDirectorySelectionChanged(const QModelIndex& rkNewIndex, const QModelIndex& /*rkPrevIndex*/)
|
||||
|
@ -139,3 +141,8 @@ void CResourceBrowser::OnImportPakContentsTxt()
|
|||
|
||||
RefreshResources();
|
||||
}
|
||||
|
||||
void CResourceBrowser::UpdateFilter()
|
||||
{
|
||||
mpProxyModel->SetSearchString( TO_TWIDESTRING(mpUI->SearchBar->text()) );
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ class CResourceBrowser : public QDialog
|
|||
CResourceTableModel *mpModel;
|
||||
CResourceProxyModel *mpProxyModel;
|
||||
CVirtualDirectoryModel *mpDirectoryModel;
|
||||
QTimer mUpdateFilterTimer;
|
||||
|
||||
public:
|
||||
explicit CResourceBrowser(QWidget *pParent = 0);
|
||||
|
@ -31,6 +32,7 @@ public slots:
|
|||
void OnDirectorySelectionChanged(const QModelIndex& rkNewIndex, const QModelIndex& rkPrevIndex);
|
||||
void OnDoubleClickResource(QModelIndex Index);
|
||||
void OnImportPakContentsTxt();
|
||||
void UpdateFilter();
|
||||
};
|
||||
|
||||
#endif // CRESOURCEBROWSER_H
|
||||
|
|
|
@ -13,8 +13,6 @@
|
|||
<property name="windowTitle">
|
||||
<string>Resource Browser</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QWidget" name="SidebarContainerWidget" native="true">
|
||||
|
@ -134,6 +132,20 @@
|
|||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="ImportNamesButton">
|
||||
<property name="text">
|
||||
<string>Import Names</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="ExportNamesButton">
|
||||
<property name="text">
|
||||
<string>Export Names</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -186,22 +198,6 @@
|
|||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="ImportNamesButton">
|
||||
<property name="text">
|
||||
<string>Import Names</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="ExportNamesButton">
|
||||
<property name="text">
|
||||
<string>Export Names</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
|
Loading…
Reference in New Issue