Commit 04d11744 authored by Eoin O'Neill's avatar Eoin O'Neill 🍀

Add Graceful Assert for `KoToolBox::buttonSize` Display Indexing

Something about my specific development environment was causing a crash due
to QGuiApplication::screens() indexing throwing an Out of Range error.
It likely has something to do with my vertical-right oriented display I
just set up. I'll do more investigation of this issue, and whether its a
QT or GNOME bug. For now, preventing a hard crash for simple GUI
button size scaling is probably appropriate.
parent 1464bed1
......@@ -22,6 +22,7 @@
#include "KoToolBox_p.h"
#include "KoToolBoxLayout_p.h"
#include "KoToolBoxButton_p.h"
#include "kis_assert.h"
#include <QButtonGroup>
#include <QToolButton>
......@@ -47,6 +48,8 @@
static int buttonSize(int screen)
KIS_ASSERT_RECOVER_RETURN_VALUE(screen < QGuiApplication::screens().size() && screen >= 0, 16);
QRect rc = QGuiApplication::screens().at(screen)->availableGeometry();
if (rc.width() <= 1024) {
return 12;
......@@ -60,6 +63,7 @@ static int buttonSize(int screen)
else {
return 22;
class KoToolBox::Private
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment