Efficiency fix for Qt TAS history view. Only redraw if it is visible in tabbed widget.

This commit is contained in:
mjbudd77 2021-12-29 21:48:53 -05:00
parent 52792378c0
commit 199a3d8d72
3 changed files with 22 additions and 5 deletions

View File

@ -1360,11 +1360,19 @@ void TasEditorWindow::updateCheckedItems(void)
showToolTipsAct->setChecked( taseditorConfig.tooltipsEnabled );
}
//----------------------------------------------------------------------------
void TasEditorWindow::updateHistoryItems(void)
bool TasEditorWindow::updateHistoryItems(void)
{
int i, cursorPos;
QTreeWidgetItem *item;
const char *txt;
bool isVisible;
isVisible = histTree->isVisible();
if ( !isVisible )
{
return false;
}
cursorPos = history.getCursorPos();
@ -1408,6 +1416,8 @@ void TasEditorWindow::updateHistoryItems(void)
}
}
histTree->viewport()->update();
return true;
}
//----------------------------------------------------------------------------
QPoint TasEditorWindow::getPreviewPopupCoordinates(void)

View File

@ -387,6 +387,7 @@ class TasEditorWindow : public QDialog
bool handleColumnSetUsingPattern(void);
bool handleInputColumnSet(int joy, int button);
bool handleInputColumnSetUsingPattern(int joy, int button);
bool updateHistoryItems(void);
QPoint getPreviewPopupCoordinates(void);
@ -494,11 +495,11 @@ class TasEditorWindow : public QDialog
void saveRecentProjectMenu(void);
void addRecentProject(const char *prog);
public slots:
void closeWindow(void);
void frameUpdate(void);
void updateCheckedItems(void);
void updateHistoryItems(void);
void updateRecordStatus(void);
private slots:
void openProject(void);

View File

@ -170,8 +170,8 @@ void HISTORY::update()
if ( updateScheduled )
{
redrawList();
updateScheduled = false;
redrawList();
}
//if (oldShowUndoHint != showUndoHint)
// pianoRoll.redrawRow(undoHintPos);
@ -1207,7 +1207,10 @@ void HISTORY::updateList(void)
if (currLVItemCount != historyTotalItems)
{
tasWin->updateHistoryItems();
if ( tasWin->updateHistoryItems() == false )
{
updateScheduled = true;
}
}
}
@ -1219,7 +1222,10 @@ void HISTORY::redrawList(void)
updateScheduled = true;
return;
}
tasWin->updateHistoryItems();
if ( tasWin->updateHistoryItems() == false )
{
updateScheduled = true;
}
//ListView_SetItemState(hwndHistoryList, historyCursorPos, LVIS_FOCUSED|LVIS_SELECTED, LVIS_FOCUSED|LVIS_SELECTED);
//ListView_EnsureVisible(hwndHistoryList, historyCursorPos, FALSE);
//InvalidateRect(hwndHistoryList, 0, FALSE);