| 815 | } |
| 816 | |
| 817 | void IdealController::showDockActionToggled(QObject* senderAction, const IdealButtonBarWidget& buttonBarWidget, |
| 818 | bool show) |
| 819 | { |
| 820 | auto& actionTracker = buttonBarWidget.lastCheckedActionsTracker(); |
| 821 | |
| 822 | const auto toggleShowDockActionQuietly = [senderAction, show] { |
| 823 | auto* const action = qobject_cast<QAction*>(senderAction); |
| 824 | Q_ASSERT(action); |
| 825 | Q_ASSERT(action->isChecked() == show); |
| 826 | const QSignalBlocker blocker(action); |
| 827 | action->toggle(); |
| 828 | }; |
| 829 | |
| 830 | if (!show) { |
| 831 | if (actionTracker.activateLastShownDockWidget(currentDockWidget())) { |
| 832 | // we just focused a dock widget instead of hiding it => check the Show Dock action |
| 833 | toggleShowDockActionQuietly(); |
| 834 | } else { |
| 835 | actionTracker.uncheckAll(); |
| 836 | } |
| 837 | return; |
| 838 | } |
| 839 | |
| 840 | // Open last shown tool view(s) (or the first one). |
| 841 | // The last of the opened tool views ends up focused. |
| 842 | if (!actionTracker.checkAllTracked()) { |
| 843 | const auto barActions = buttonBarWidget.actions(); |
| 844 | if (barActions.empty()) { |
| 845 | // no tool view to show => uncheck the Show Dock action |
| 846 | toggleShowDockActionQuietly(); |
| 847 | } else { |
| 848 | barActions.first()->setChecked(true); |
| 849 | } |
| 850 | } |
| 851 | } |
| 852 | |
| 853 | IdealDockWidget* IdealController::currentDockWidget() const |
| 854 | { |
nothing calls this directly
no test coverage detected