Functions
dbutils::gui::CustomTabBehaviors Namespace Reference

Functions

void updateTabTextColors (QTabWidget *tabWidget, QTabBar *tabBar)
 

Detailed Description

Class for providing local behavior enhancements for the QTabWidget class (e.g. colorized tab text).

Author
Kurt Biery
Version
Revision
1.1.28.1
Date
2019/09/27 00:07:04

Function Documentation

void dbutils::gui::CustomTabBehaviors::updateTabTextColors ( QTabWidget *  tabWidget,
QTabBar *  tabBar 
)

Updates the text colors for the specified tabWidget and tabBar combination to show whether uncommitted changes have been made on each tab.

NOTE that the specified tabBar should be the one that is associated with the specified tabWidget. They only need to be passed to this method separately because the method to fetch the tabBar from a tabWidget is protected, by default.

Definition at line 20 of file CustomTabBehaviors.cpp.

References dbutils::gui::Changeable::hasChanges(), and compare_h5_caf::idx.

Referenced by dbutils::gui::CustomTabWidget::reactToDataChange(), dbutils::gui::CustomTabWidget::reactToDataSave(), dbutils::gui::TabbedSetOfTableEditors::reactToDataSave(), dbutils::gui::TabbedSetOfTreeEditors::reactToDataSave(), dbutils::gui::TabbedSetOfTableEditors::reactToEditorDataChange(), and dbutils::gui::TabbedSetOfTreeEditors::reactToEditorDataChange().

21 {
22  QColor stdColor("black");
23  QColor colorForChanges(184, 0, 0);
24 
25  for (int idx = 0; idx < tabWidget->count(); ++idx) {
26  QWidget* theWidget = tabWidget->widget(idx);
27  Changeable* changeableObject = dynamic_cast<Changeable*>(theWidget);
28  if (changeableObject->hasChanges()) {
29  tabBar->setTabTextColor(idx, colorForChanges);
30  }
31  else {
32  tabBar->setTabTextColor(idx, stdColor);
33  }
34  }
35 }