From 6c7b0cbc835be9cd544cf944e53a4f9f09d47bba Mon Sep 17 00:00:00 2001 From: budomino Date: Fri, 2 Apr 2021 10:05:49 +0800 Subject: [PATCH] Version 0.1.4 - Program should now stay at the same tab when refreshing --- TFV_LabelFunctions.cpp | 5 +++-- TFV_Viewer.cpp | 3 +++ alphanum.hpp | 0 fdl-1.2.md | 0 4 files changed, 6 insertions(+), 2 deletions(-) mode change 100755 => 100644 alphanum.hpp mode change 100755 => 100644 fdl-1.2.md diff --git a/TFV_LabelFunctions.cpp b/TFV_LabelFunctions.cpp index cd942ea..a10fec2 100644 --- a/TFV_LabelFunctions.cpp +++ b/TFV_LabelFunctions.cpp @@ -191,7 +191,8 @@ QTabWidget *PopulateTabs(QTabWidget *tabList, vector tabs) } else { - // (2/3) then check if the item has been flagged for another day + // (2/3) color all lables white by default and then check if the item has been flagged for another day + itemLabel->setStyleSheet("QLabel { background-color : #FFFFFF }"); //cout << "Checking if status is MOVED" << endl; if (i.GetMTOD()) { @@ -212,7 +213,7 @@ QTabWidget *PopulateTabs(QTabWidget *tabList, vector tabs) moved.append(itemLabel); } - // (3/3) finally, do the rest + // (3/3) finally, color the labels to match their status else { //cout << "Status is not 'MOVED'" << endl; diff --git a/TFV_Viewer.cpp b/TFV_Viewer.cpp index a2bad80..aa47927 100644 --- a/TFV_Viewer.cpp +++ b/TFV_Viewer.cpp @@ -36,6 +36,7 @@ void Viewer::RunViewer(vector tabs, QWidget *newWidget) gridLayout->setMargin(0); + // Step3c. Set the grid layout as a main layout newWidget->setLayout(gridLayout); @@ -46,6 +47,7 @@ void Viewer::RunViewer(vector tabs, QWidget *newWidget) // Step4. If the window is already open, just put a new widget on top of the old one. Otherwise, open a new window if (s->isVisible()) { + int currentTabIndex = s->currentWidget()->findChild()->currentIndex(); s->setCurrentWidget(newWidget); // loop just in case I somehow end up with multiple widgets for (int i = s->count(); i > 0; i--) @@ -58,6 +60,7 @@ void Viewer::RunViewer(vector tabs, QWidget *newWidget) toDelete->deleteLater(); } } + s->currentWidget()->findChild()->setCurrentIndex(currentTabIndex); } else diff --git a/alphanum.hpp b/alphanum.hpp old mode 100755 new mode 100644 diff --git a/fdl-1.2.md b/fdl-1.2.md old mode 100755 new mode 100644