summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-09-08 16:07:05 (GMT)
committerTobias Markmann <tm@ayena.de>2016-09-08 16:07:05 (GMT)
commit3fe4d78c15c289011493136c6360c14e755cabb3 (patch)
tree2306aa96d59aa1b0977aa5cc160c63e44a4c6cc3 /Swift/QtUI/Trellis
parent615b87497cd8d4eedc386f002931d6d353f53ccd (diff)
downloadswift-3fe4d78c15c289011493136c6360c14e755cabb3.zip
swift-3fe4d78c15c289011493136c6360c14e755cabb3.tar.bz2
Improve visibility of currently focused chat input in trellis mode
The default focus indicator on the text input fields in chat windows becomes harder to notice in trellis mode as there are many similar looking chat windows visible at the same time. This change increases the visibility of the focus indication border on Windows and will enable the standard blue focus halo on OS X for focused chat inputs in trellis mode. Test-Information: Tested with Qt 5.5.1 on OS X 10.11.6 and Qt 5.5.1 on Windows 8. Change-Id: If9fe9edea6fef292bb99eabbb125c7a9ec20dcc2
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_;