summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/Trellis')
-rw-r--r--Swift/QtUI/Trellis/QtDynamicGridLayout.cpp20
-rw-r--r--Swift/QtUI/Trellis/QtDynamicGridLayout.h1
2 files changed, 21 insertions, 0 deletions
diff --git a/Swift/QtUI/Trellis/QtDynamicGridLayout.cpp b/Swift/QtUI/Trellis/QtDynamicGridLayout.cpp
index 3d80d95..5600cc8 100644
--- a/Swift/QtUI/Trellis/QtDynamicGridLayout.cpp
+++ b/Swift/QtUI/Trellis/QtDynamicGridLayout.cpp
@@ -48,6 +48,7 @@ int QtDynamicGridLayout::addTab(QtTabbable* tab, const QString& title) {
if (tabWidget) {
tabWidget->addTab(tab, title);
}
+ tab->setEmphasiseFocus(getDimension().width() > 1 || getDimension().height() > 1);
return tabWidget ? indexOf(tab) : -1;
}
@@ -318,6 +319,25 @@ void QtDynamicGridLayout::setDimensions(const QSize& dim) {
resizing_ = false;
setCurrentWidget(restoredWidget);
+
+ updateEmphasiseFocusOnTabs();
+}
+
+void QtDynamicGridLayout::updateEmphasiseFocusOnTabs() {
+ const auto currentDimensions = getDimension();
+
+ for (int y = 0; y < gridLayout_->rowCount(); y++) {
+ for (int x = 0; x < gridLayout_->columnCount(); x++) {
+ QLayoutItem* layoutItem = gridLayout_->itemAtPosition(y, x);
+ QtTabWidget* tabWidget = dynamic_cast<QtTabWidget*>(layoutItem->widget());
+ assert(tabWidget);
+ for (int index = 0; index < tabWidget->count(); index++) {
+ QtTabbable* tab = dynamic_cast<QtTabbable*>(tabWidget->widget(index));
+ assert(tab);
+ tab->setEmphasiseFocus(currentDimensions.height() > 1 || currentDimensions.width() > 1);
+ }
+ }
+ }
}
void QtDynamicGridLayout::moveCurrentTabRight() {
diff --git a/Swift/QtUI/Trellis/QtDynamicGridLayout.h b/Swift/QtUI/Trellis/QtDynamicGridLayout.h
index 4aed0df..682ae41 100644
--- a/Swift/QtUI/Trellis/QtDynamicGridLayout.h
+++ b/Swift/QtUI/Trellis/QtDynamicGridLayout.h
@@ -70,6 +70,7 @@ namespace Swift {
private:
void moveTab(QtTabWidget* tabWidget, int oldIndex, int newIndex);
QtTabWidget* createDNDTabWidget(QWidget* parent);
+ void updateEmphasiseFocusOnTabs();
private:
QGridLayout *gridLayout_;