summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Marchal <frederic.marchal@wowtechnology.com>2016-01-25 17:37:16 +0100
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2016-01-26 12:51:23 +0000
commitd3bb2ae020410f486642d63552edb16545ded07b (patch)
tree58450ed715320e9b15e08c7630801e96d9099d17
parentd2b9b4850a5e20b126171e4418fdf1782e244c6f (diff)
Highlight QTabWidget tabs by making them current
If the text to translate is a QTabWidget tab label, the whole QTabWidget is highlighted but the tab inconspicuously remains unselected. The translator wastes precious seconds searching for the text in the preview (at least I do, even with three tabs). Moreover, automatically bringing the tab to the front let the translator see what the (usually terse) tab label refers to. Change-Id: I85ee872403b276ebd740cfb9542efc1f7debb40c Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
-rw-r--r--src/linguist/linguist/formpreviewview.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/linguist/linguist/formpreviewview.cpp b/src/linguist/linguist/formpreviewview.cpp
index 2f5757b04..e21dd0120 100644
--- a/src/linguist/linguist/formpreviewview.cpp
+++ b/src/linguist/linguist/formpreviewview.cpp
@@ -434,10 +434,12 @@ static void highlightTarget(const TranslatableEntry &target, bool on)
#ifndef QT_NO_COMBOBOX
case TranslatableComboBoxItem:
static_cast<QComboBox *>(target.target.object)->setCurrentIndex(target.prop.index);
- // fallthrough
+ goto frontAndHighlight;
#endif
#ifndef QT_NO_TABWIDGET
case TranslatableTabPageText:
+ static_cast<QTabWidget *>(target.target.object)->setCurrentIndex(target.prop.index);
+ goto frontAndHighlight;
# ifndef QT_NO_TOOLTIP
case TranslatableTabPageToolTip:
# endif
@@ -451,6 +453,9 @@ static void highlightTarget(const TranslatableEntry &target, bool on)
case TranslatableToolItemToolTip:
# endif
#endif // QT_NO_TOOLBOX
+#if !defined(QT_NO_COMBOBOX) || !defined(QT_NO_TABWIDGET)
+ frontAndHighlight:
+#endif
bringToFront(static_cast<QWidget *>(target.target.object));
highlightWidget(static_cast<QWidget *>(target.target.object), on);
break;