From 050ff82bcc94256581eaa840f39f5f7f08b33023 Mon Sep 17 00:00:00 2001 From: Mavridis Philippe Date: Wed, 4 Oct 2023 22:56:39 +0300 Subject: KTabBar: add way to revert tab color to default This commit adds a resetTabColor(...) method to TQTabBar and TQTabWidget which allows the color of the appropriate tab to be reset to the default as specified by the desktop color scheme. It also changes how invalid color values are handled; before, an invalid value would be used as a valid color, resulting in 0,0,0 (black). Seeing that an invalid color is returned by KColorDialog when the default color checkbox is checked, it makes more sense to ignore invalid colors, using the appropriate color from the color scheme instead. Signed-off-by: Mavridis Philippe (cherry picked from commit c28a87c7d2e5c170a84bd8d1e7feece3ef9521ec) --- tdeui/ktabwidget.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tdeui/ktabwidget.cpp') diff --git a/tdeui/ktabwidget.cpp b/tdeui/ktabwidget.cpp index d6800ab9a..943598022 100644 --- a/tdeui/ktabwidget.cpp +++ b/tdeui/ktabwidget.cpp @@ -135,6 +135,14 @@ void KTabWidget::setTabColor( TQWidget *w, const TQColor& color ) } } +void KTabWidget::resetTabColor( TQWidget *w ) +{ + TQTab *t = tabBar()->tabAt( indexOf( w ) ); + if (t) { + static_cast(tabBar())->resetTabColor( t->identifier() ); + } +} + TQColor KTabWidget::tabColor( TQWidget *w ) const { TQTab *t = tabBar()->tabAt( indexOf( w ) ); -- cgit v1.2.1