1
0
Fork 0

GUI: fix performance bottleneck with Qt signals

This commit is contained in:
Duncan Ogilvie 2018-05-14 20:09:43 +02:00
parent 8af904fad6
commit 34279ebf08
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
5 changed files with 18 additions and 8 deletions

1
.gitignore vendored
View File

@ -76,3 +76,4 @@ src/build-*/
.scannerwork/
bw-output/
build-wrapper*
My Amplifier Results - */

View File

@ -611,6 +611,7 @@ void AbstractTableView::resizeEvent(QResizeEvent* event)
if(event->size().height() != event->oldSize().height())
{
updateScrollBarRange(getRowCount());
emit viewableRowsChanged(getViewableRowsCount());
mShouldReload = true;
}
QWidget::resizeEvent(event);
@ -852,8 +853,6 @@ void AbstractTableView::updateScrollBarRange(dsint range)
verticalScrollBar()->setRange(0, 0);
verticalScrollBar()->setSingleStep(getRowHeight());
verticalScrollBar()->setPageStep(viewableRowsCount * getRowHeight());
emit viewableRowsChanged(viewableRowsCount);
}
/************************************************************************************

View File

@ -48,19 +48,20 @@ public:
void filter(const QString & filter, FilterType type, int startColumn) override
{
mSearchList->setRowCount(0);
int newRowCount = 0;
mSearchList->mData.clear();
mSearchList->mData.reserve(mList->mData.size());
mSearchList->mModules = mList->mModules;
int rows = mList->getRowCount();
for(int i = 0, j = 0; i < rows; i++)
for(int i = 0; i < rows; i++)
{
if(rowMatchesFilter(filter, type, i, startColumn))
{
mSearchList->setRowCount(j + 1);
newRowCount++;
mSearchList->mData.push_back(mList->mData.at(i));
j++;
}
}
mSearchList->setRowCount(newRowCount);
}
void addAction(QAction* action)

View File

@ -37,6 +37,10 @@ ZehSymbolTable::ZehSymbolTable(QWidget* parent)
addColumnAt(2000, tr("Symbol (undecorated)"), true);
loadColumnFromConfig("Symbol");
updateColors();
trImport = tr("Import");
trExport = tr("Export");
trSymbol = tr("Symbol");
}
QString ZehSymbolTable::getCellContent(int r, int c)
@ -54,11 +58,11 @@ QString ZehSymbolTable::getCellContent(int r, int c)
switch(info->type)
{
case sym_import:
return tr("Import");
return trImport;
case sym_export:
return tr("Export");
return trExport;
case sym_symbol:
return tr("Symbol");
return trSymbol;
default:
__debugbreak();
}

View File

@ -22,6 +22,11 @@ private:
std::vector<SYMBOLPTR> mData;
QMutex mMutex;
//Caching of translations to fix a bottleneck
QString trImport;
QString trExport;
QString trSymbol;
enum
{
ColAddr,