============================================================================
| 94 | |
| 95 | //============================================================================ |
| 96 | void DockAreaTabBarPrivate::updateTabs() |
| 97 | { |
| 98 | // Set active TAB and update all other tabs to be inactive |
| 99 | for (int i = 0; i < _this->count(); ++i) |
| 100 | { |
| 101 | auto TabWidget = _this->tab(i); |
| 102 | if (!TabWidget) |
| 103 | { |
| 104 | continue; |
| 105 | } |
| 106 | |
| 107 | if (i == CurrentIndex) |
| 108 | { |
| 109 | TabWidget->show(); |
| 110 | TabWidget->setActiveTab(true); |
| 111 | // Sometimes the synchronous calculation of the rectangular area fails |
| 112 | // Therefore we use QTimer::singleShot here to execute the call |
| 113 | // within the event loop - see #520 |
| 114 | QTimer::singleShot(0, TabWidget, [&, TabWidget] |
| 115 | { |
| 116 | _this->ensureWidgetVisible(TabWidget); |
| 117 | }); |
| 118 | } |
| 119 | else |
| 120 | { |
| 121 | TabWidget->setActiveTab(false); |
| 122 | } |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | |
| 127 | //============================================================================ |
no test coverage detected