Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.
C++
[android] Collapse toolbars on canvas-only switch
Carsten Hartenfelse07b4aa30bee
diff --git a/libs/ui/KisViewManager.cpp b/libs/ui/KisViewManager.cppindex 94e7f81674..0b58ecfe79 100644--- a/libs/ui/KisViewManager.cpp+++ b/libs/ui/KisViewManager.cpp@@ -1276,6 +1276,30 @@ void KisViewManager::switchCanvasOnly(bool toggled)return;}+#ifdef Q_OS_ANDROID+ // On Android, expanded tool bars will crash when canvas-only mode is+ // toggled. To avoid this, we go looking for expanded toolbars and close+ // them instead of switching the mode and hitting a crash. Note that this+ // only works properly because we turn off main window animations on+ // Android, since that means clicking the extension button will instantly+ // hide the menu. With animations, the user could still trigger a crash if+ // they tried switching the mode while the extension animation is running.+ QList<QToolBar *> toolBars = main->findChildren<QToolBar *>();+ bool wasToolBarPopupOpen = false;+ for (QToolBar *toolBar : toolBars) {+ for (QToolButton *button : toolBar->findChildren<QToolButton *>(QStringLiteral("qt_toolbar_ext_button"))) {+ if (button->isChecked()) {+ wasToolBarPopupOpen = true;+ button->click();+ }+ }+ }++ if(wasToolBarPopupOpen) {+ return;+ }+#endif+cfg.writeEntry("CanvasOnlyActive", toggled);KisViewManagerPrivate::CanvasOnlyOptions options(cfg);@@ -1395,7 +1419,10 @@ void KisViewManager::switchCanvasOnly(bool toggled)}if (options.hideToolbarFullscreen) {+ // We already went searching for these on Android above.+#ifndef Q_OS_ANDROIDQList<QToolBar*> toolBars = main->findChildren<QToolBar*>();+#endifQ_FOREACH (QToolBar* toolbar, toolBars) {if (!toggled) {if (toolbar->dynamicPropertyNames().contains("wasvisible")) {