MCPcopy Create free account
hub / github.com/KDE/kdevelop / showDockActionToggled

Method showDockActionToggled

kdevplatform/sublime/idealcontroller.cpp:817–851  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

815}
816
817void 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
853IdealDockWidget* IdealController::currentDockWidget() const
854{

Callers

nothing calls this directly

Calls 6

uncheckAllMethod · 0.80
checkAllTrackedMethod · 0.80
emptyMethod · 0.80
actionsMethod · 0.45
firstMethod · 0.45

Tested by

no test coverage detected