From a43c6de0d3d13c76d409fafd09d514e2b3cc8e56 Mon Sep 17 00:00:00 2001 From: Ahmed <10769951+holazt@users.noreply.github.com> Date: Sat, 4 Jul 2026 21:22:24 +0800 Subject: [PATCH 1/5] ci: update linux distro build matrix (#4777) * ci: update linux distro build matrix - add debian 13 amd64/arm64/armhf, drop debian 12 - add fedora 43/44 amd64 - add ubuntu 26.04 amd64/arm64, drop ubuntu 22.04 - add opensuse leap 16.0 amd64 * ci: remove opensuse-leap-16.0 - because there is no official `qt6-svg` package available for openSUSE Leap 16.0, https://software.opensuse.org/package/qt6-svg * ci: correct qt6-qtsvg package name in fedora --- .github/workflows/Linux-pack.yml | 36 ++++++++++++++++---------------- packaging/rpm/flameshot.spec | 4 ++++ 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/.github/workflows/Linux-pack.yml b/.github/workflows/Linux-pack.yml index 62202d3de9..59aee196d8 100644 --- a/.github/workflows/Linux-pack.yml +++ b/.github/workflows/Linux-pack.yml @@ -37,51 +37,51 @@ jobs: matrix: dist: - { - name: debian-12, + name: debian-13, os: debian, - symbol: bookworm, + symbol: trixie, arch: amd64, runs-on: ubuntu-latest } - { - name: ubuntu-22.04, + name: ubuntu-24.04, os: ubuntu, - symbol: jammy, + symbol: noble, arch: amd64, runs-on: ubuntu-latest } - { - name: ubuntu-24.04, + name: ubuntu-26.04, os: ubuntu, - symbol: noble, + symbol: resolute, arch: amd64, runs-on: ubuntu-latest } - { - name: debian-12, + name: debian-13, os: debian, - symbol: bookworm, + symbol: trixie, arch: arm64, runs-on: ubuntu-24.04-arm } - { - name: debian-12, + name: debian-13, os: debian, - symbol: bookworm, + symbol: trixie, arch: armhf, runs-on: ubuntu-24.04-arm } - { - name: ubuntu-22.04, + name: ubuntu-24.04, os: ubuntu, - symbol: jammy, + symbol: noble, arch: arm64, runs-on: ubuntu-24.04-arm } - { - name: ubuntu-24.04, + name: ubuntu-26.04, os: ubuntu, - symbol: noble, + symbol: resolute, arch: arm64, runs-on: ubuntu-24.04-arm } @@ -179,15 +179,15 @@ jobs: matrix: dist: - { - name: fedora-41, + name: fedora-43, os: fedora, - symbol: 41, + symbol: 43, arch: x86_64 } - { - name: fedora-42, + name: fedora-44, os: fedora, - symbol: 42, + symbol: 44, arch: x86_64 } steps: diff --git a/packaging/rpm/flameshot.spec b/packaging/rpm/flameshot.spec index 191997d626..b822bc49c5 100644 --- a/packaging/rpm/flameshot.spec +++ b/packaging/rpm/flameshot.spec @@ -44,8 +44,12 @@ Requires: hicolor-icon-theme %if 0%{?suse_version} Requires: qt6-svg %else +%if 0%{?fedora} || 0%{?rhel} +Requires: qt6-qtsvg%{?_isa} +%else Requires: qt6-svg%{?_isa} %endif +%endif %if 0%{?suse_version} Recommends: qt6-imageformats From 67dd77276a9312c931e4c01915dc93b67e880724 Mon Sep 17 00:00:00 2001 From: Mehrad Mahmoudian Date: Sat, 4 Jul 2026 16:23:54 +0300 Subject: [PATCH 2/5] update the flatpak yaml file to be on-par with flathub repo (#4764) * update the flatpak yaml file to be on-par with flathub repo * fix the flatpak yaml file I forgot to comment out the tag and comment in previous commit. * add the branch back for flameshot repo --- packaging/flatpak/org.flameshot.Flameshot.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packaging/flatpak/org.flameshot.Flameshot.yml b/packaging/flatpak/org.flameshot.Flameshot.yml index a3c77d04eb..c1f410611d 100644 --- a/packaging/flatpak/org.flameshot.Flameshot.yml +++ b/packaging/flatpak/org.flameshot.Flameshot.yml @@ -1,6 +1,6 @@ app-id: org.flameshot.Flameshot runtime: org.kde.Platform -runtime-version: '6.9' +runtime-version: '6.10' sdk: org.kde.Sdk command: flameshot finish-args: @@ -29,18 +29,20 @@ modules: sources: - type: git url: https://gitlab.com/mattbas/Qt-Color-Widgets.git - commit: 352bc8f99bf2174d5724ee70623427aa31ddc26a + commit: 5d52e907e50dc88cf969b41cea44665ff6c475b1 dest: external/Qt-Color-Widgets - type: git url: https://github.com/KDAB/KDSingleApplication.git tag: v1.2.0 + commit: 3186a158f8e6565e89f5983b4028c892737844ff dest: external/KDSingleApplication - + - type: git url: https://github.com/flameshot-org/flameshot.git branch: master - #tag: v13.0.0 + # tag: v14.0.0 + # commit: e408812d77ff1835957f85796c4cf737466bd69d cleanup: - /share/bash-completion From b92a5783118c4caf24f64cb66883a9e447007278 Mon Sep 17 00:00:00 2001 From: Hackintosh HD Date: Sat, 4 Jul 2026 15:43:35 +0200 Subject: [PATCH 3/5] Update MacOS-pack.yml (#4795) Troubleshooting the currently flawed macOS packaging for x64 (Intel) --- .github/workflows/MacOS-pack.yml | 69 +++++++++++++++++++++++--------- 1 file changed, 49 insertions(+), 20 deletions(-) diff --git a/.github/workflows/MacOS-pack.yml b/.github/workflows/MacOS-pack.yml index 1dfa757808..62d004e233 100644 --- a/.github/workflows/MacOS-pack.yml +++ b/.github/workflows/MacOS-pack.yml @@ -5,41 +5,42 @@ on: branches: - master paths-ignore: - - '*.md' - - 'LICENSE' - - 'docs/**' + - "*.md" + - "LICENSE" + - "docs/**" pull_request: paths-ignore: - - '*.md' - - 'LICENSE' - - 'docs/**' - - 'data/translations/*.ts' + - "*.md" + - "LICENSE" + - "docs/**" + - "data/translations/*.ts" workflow_dispatch: env: PRODUCT: flameshot + MACOSX_DEPLOYMENT_TARGET: "14.0" jobs: dmg-pack: name: Build dmg on ${{ matrix.dist.os }} ${{ matrix.dist.arch }} + strategy: fail-fast: false matrix: dist: - - { - os: macos-26, - arch: arm64 - } - - { - os: macos-26-intel, - arch: intel - } + - os: macos-26 + arch: arm64 + - os: macos-26-intel + arch: intel + runs-on: ${{ matrix.dist.os }} + env: APP_NAME: flameshot DIR_BUILD: build + steps: - name: Checkout Source code if: github.event_name == 'push' @@ -64,28 +65,56 @@ jobs: git_revno=$(git rev-list $(git describe --tags --abbrev=0)..HEAD --count) git_hash=$(git rev-parse --short HEAD) ver_info=${last_committed_tag}+git${git_revno}.${git_hash} + echo "=======FLAMESHOT VERSION========" echo ${last_committed_tag:1} echo "Details: ${ver_info}" echo "================================" - # This will allow to build pre-preleases without git tag - # echo "VERSION=${last_committed_tag:1}" >> $GITHUB_ENV - echo "VERSION=$(cat CMakeLists.txt |grep 'set.*(.*FLAMESHOT_VERSION' | sed 's/[^0-9.]*//' |sed 's/)//g')" >> $GITHUB_ENV + + echo "VERSION=$(grep 'set.*(.*FLAMESHOT_VERSION' CMakeLists.txt | sed 's/[^0-9.]*//' | sed 's/)//g')" >> $GITHUB_ENV echo "VER_INFO=${ver_info}" >> $GITHUB_ENV echo "GIT_HASH=${git_hash}" >> $GITHUB_ENV - name: Install Qt run: brew install qt@6 + - name: Print build environment + run: | + echo "Deployment target: ${MACOSX_DEPLOYMENT_TARGET}" + xcodebuild -version + xcrun --sdk macosx --show-sdk-path + clang --version + cmake --version + brew info qt@6 + brew --prefix qt@6 + - name: Configure run: | - rm -rf "${DIR_BUILD}"/src/flameshot.dmg "${DIR_BUILD}"/src/flameshot.app/ - cmake -GNinja -S . -B "${DIR_BUILD}" -DQt6_DIR=$(brew --prefix qt6)/lib/cmake/Qt6 -DUSE_MONOCHROME_ICON=True + rm -rf "${DIR_BUILD}/src/flameshot.dmg" + rm -rf "${DIR_BUILD}/src/flameshot.app" + + cmake \ + -GNinja \ + -S . \ + -B "${DIR_BUILD}" \ + -DQt6_DIR="$(brew --prefix qt@6)/lib/cmake/Qt6" \ + -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \ + -DCMAKE_OSX_SYSROOT="$(xcrun --sdk macosx --show-sdk-path)" \ + -DUSE_MONOCHROME_ICON=True + + - name: Show CMake deployment target + run: | + grep CMAKE_OSX_DEPLOYMENT_TARGET "${DIR_BUILD}/CMakeCache.txt" || true - name: Compile run: | cmake --build "${DIR_BUILD}" + - name: Inspect resulting executable + run: | + otool -l "${DIR_BUILD}/src/flameshot.app/Contents/MacOS/flameshot" | \ + sed -n '/LC_BUILD_VERSION/,/cmd/p' + - name: Build dmg package run: | cd "${DIR_BUILD}" From cb607c1559ecf7218ae1e48d3fdf9556862c260b Mon Sep 17 00:00:00 2001 From: Mykyta Serebriakov <109741983+serebryakov02@users.noreply.github.com> Date: Sat, 4 Jul 2026 15:44:08 +0200 Subject: [PATCH 4/5] Add arrow style selector (#4769) * Add arrow style selector * Fix curved arrow artifact at large thickness --------- Co-authored-by: serebryakov02 --- flameshot.example.ini | 3 + src/tools/arrow/arrowtool.cpp | 112 +++++++++++++++++++++++++++++++++- src/tools/arrow/arrowtool.h | 11 ++++ src/utils/confighandler.cpp | 1 + src/utils/confighandler.h | 1 + 5 files changed, 125 insertions(+), 3 deletions(-) diff --git a/flameshot.example.ini b/flameshot.example.ini index 0137e2926f..8bd0c7bb75 100644 --- a/flameshot.example.ini +++ b/flameshot.example.ini @@ -64,6 +64,9 @@ ;; Last used tool thickness; same thickness shared by Pencil, Line, Arrow, Rectangular Selection, Circle (int) ;drawThickness=3 ; +;; Arrow style: 0 = default, 1 = curved (int) +;arrowStyle=0 +; ;; Last used font size (int) ;drawFontSize=8 ; diff --git a/src/tools/arrow/arrowtool.cpp b/src/tools/arrow/arrowtool.cpp index 269350122e..ffabfe5bf7 100644 --- a/src/tools/arrow/arrowtool.cpp +++ b/src/tools/arrow/arrowtool.cpp @@ -4,11 +4,22 @@ #include "arrowtool.h" #include "utils/confighandler.h" +#include +#include +#include +#include #include namespace { const int ArrowWidth = 10; const int ArrowHeight = 18; +const int MinArrowStyle = 0; +const int MaxArrowStyle = 1; + +bool isValidArrowStyle(int style) +{ + return style >= MinArrowStyle && style <= MaxArrowStyle; +} QPainterPath getArrowHead(QPoint p1, QPoint p2, const int thickness) { @@ -58,11 +69,67 @@ QLine getShorterLine(QPoint p1, QPoint p2, const int thickness) return l.toLine(); } +QPainterPath getCurvedArrowHead(QPointF p1, QPointF p2, const int thickness) +{ + QLineF line(p1, p2); + if (line.length() <= 0) { + return {}; + } + + const QPointF direction = (p2 - p1) / line.length(); + const QPointF normal(-direction.y(), direction.x()); + const QPointF baseCenter = + getShorterLine(p1.toPoint(), p2.toPoint(), thickness).p2(); + const qreal halfWidth = (ArrowWidth + thickness * 2) / 2.0; + const qreal baseDistance = QLineF(baseCenter, p2).length(); + const qreal notchDepth = std::min(baseDistance * 0.45, halfWidth); + + const QPointF baseLeft = baseCenter + normal * halfWidth; + const QPointF baseRight = baseCenter - normal * halfWidth; + const QPointF notch = baseCenter + direction * notchDepth; + const QPointF leftControl = baseCenter + normal * halfWidth * 0.25; + const QPointF rightControl = baseCenter - normal * halfWidth * 0.25; + + QPainterPath path; + path.moveTo(p2); + path.lineTo(baseLeft); + path.quadTo(leftControl, notch); + path.quadTo(rightControl, baseRight); + path.lineTo(p2); + return path; +} + +QLineF getCurvedArrowShaft(QPointF p1, QPointF p2, const int thickness) +{ + QLineF line(p1, p2); + if (line.length() <= 0) { + return {}; + } + + const QPointF direction = (p2 - p1) / line.length(); + QLineF shaft(getShorterLine(p1.toPoint(), p2.toPoint(), thickness)); + const qreal notchDepth = + std::min(QLineF(shaft.p2(), p2).length() * 0.45, + (ArrowWidth + thickness * 2) / 2.0); + constexpr qreal overlap = 1.0; + + // The curved head has a concave back, so extend the straight shaft + // slightly into the head to avoid a visible gap without leaking past + // the head outline at large thicknesses. + shaft.setP2(shaft.p2() + direction * (notchDepth + overlap)); + return shaft; +} + } // unnamed namespace ArrowTool::ArrowTool(QObject* parent) : AbstractTwoPointTool(parent) { + const int configuredArrowStyle = ConfigHandler().arrowStyle(); + if (isValidArrowStyle(configuredArrowStyle)) { + m_arrowStyle = static_cast(configuredArrowStyle); + } + setPadding(ArrowWidth / 2); m_supportsOrthogonalAdj = true; m_supportsDiagonalAdj = true; @@ -135,6 +202,27 @@ QRect ArrowTool::boundingRect() const return rect.normalized(); } +QWidget* ArrowTool::configurationWidget() +{ + auto* widget = new QWidget(); + auto* layout = new QHBoxLayout(widget); + auto* label = new QLabel(tr("Arrow style:"), widget); + auto* styleSelector = new QComboBox(widget); + + styleSelector->addItem(tr("Default")); + styleSelector->addItem(tr("Curved")); + styleSelector->setCurrentIndex(static_cast(m_arrowStyle)); + connect(styleSelector, + qOverload(&QComboBox::currentIndexChanged), + this, + &ArrowTool::setArrowStyle); + + layout->addWidget(label); + layout->addWidget(styleSelector); + + return widget; +} + CaptureTool* ArrowTool::copy(QObject* parent) { auto* tool = new ArrowTool(parent); @@ -145,7 +233,8 @@ CaptureTool* ArrowTool::copy(QObject* parent) void ArrowTool::copyParams(const ArrowTool* from, ArrowTool* to) { AbstractTwoPointTool::copyParams(from, to); - to->m_arrowPath = this->m_arrowPath; + to->m_arrowPath = from->m_arrowPath; + to->m_arrowStyle = from->m_arrowStyle; } void ArrowTool::process(QPainter& painter, const QPixmap& pixmap) @@ -157,8 +246,16 @@ void ArrowTool::process(QPainter& painter, const QPixmap& pixmap) Q_UNUSED(pixmap) painter.setPen(QPen(color(), size())); - painter.drawLine(getShorterLine(head, tail, size())); - m_arrowPath = getArrowHead(head, tail, size()); + if (m_arrowStyle == ArrowStyle::Default) { + painter.drawLine(getShorterLine(head, tail, size())); + m_arrowPath = getArrowHead(head, tail, size()); + painter.fillPath(m_arrowPath, QBrush(color())); + return; + } + + painter.setPen(QPen(color(), size(), Qt::SolidLine, Qt::FlatCap)); + painter.drawLine(getCurvedArrowShaft(head, tail, size())); + m_arrowPath = getCurvedArrowHead(head, tail, size()); painter.fillPath(m_arrowPath, QBrush(color())); } @@ -166,3 +263,12 @@ void ArrowTool::pressed(CaptureContext& context) { Q_UNUSED(context) } + +void ArrowTool::setArrowStyle(int style) +{ + if (!isValidArrowStyle(style)) { + style = static_cast(ArrowStyle::Default); + } + m_arrowStyle = static_cast(style); + ConfigHandler().setArrowStyle(style); +} diff --git a/src/tools/arrow/arrowtool.h b/src/tools/arrow/arrowtool.h index 9b84149d3d..d92a126e6a 100644 --- a/src/tools/arrow/arrowtool.h +++ b/src/tools/arrow/arrowtool.h @@ -18,6 +18,7 @@ class ArrowTool : public AbstractTwoPointTool QString name() const override; QString description() const override; QRect boundingRect() const override; + QWidget* configurationWidget() override; CaptureTool* copy(QObject* parent = nullptr) override; void process(QPainter& painter, const QPixmap& pixmap) override; @@ -29,6 +30,16 @@ class ArrowTool : public AbstractTwoPointTool public slots: void pressed(CaptureContext& context) override; +private slots: + void setArrowStyle(int style); + private: + enum class ArrowStyle + { + Default = 0, + Curved = 1, + }; + QPainterPath m_arrowPath; + ArrowStyle m_arrowStyle = ArrowStyle::Default; }; diff --git a/src/utils/confighandler.cpp b/src/utils/confighandler.cpp index fd01171762..1a7c91d8f7 100644 --- a/src/utils/confighandler.cpp +++ b/src/utils/confighandler.cpp @@ -136,6 +136,7 @@ static QMap> OPTION("showSelectionGeometryHideTime", LowerBoundedInt ( 0, 3000 )), OPTION("jpegQuality" , BoundedInt ( 0,100,75 )), OPTION("reverseArrow" ,Bool ( false )), + OPTION("arrowStyle" ,BoundedInt ( 0, 1, 0 )), OPTION("insecurePixelate" ,Bool ( false )), #if defined(Q_OS_WIN) // Not visible on settings dialog diff --git a/src/utils/confighandler.h b/src/utils/confighandler.h index ea3742cb8d..38ee31e42c 100644 --- a/src/utils/confighandler.h +++ b/src/utils/confighandler.h @@ -139,6 +139,7 @@ class ConfigHandler : public QObject CONFIG_GETTER_SETTER(showSelectionGeometry, setShowSelectionGeometry, int) CONFIG_GETTER_SETTER(jpegQuality, setJpegQuality, int) CONFIG_GETTER_SETTER(reverseArrow, setReverseArrow, bool) + CONFIG_GETTER_SETTER(arrowStyle, setArrowStyle, int) CONFIG_GETTER_SETTER(insecurePixelate, setInsecurePixelate, bool) CONFIG_GETTER_SETTER(showSelectionGeometryHideTime, showSelectionGeometryHideTime, From b7773808c56d1782bb1f9a51706f0d9275f6996d Mon Sep 17 00:00:00 2001 From: Maxim Inozemtsev Date: Sat, 4 Jul 2026 06:52:34 -0700 Subject: [PATCH 5/5] Increment/decrement circle counter on mouse wheel (#4698) * Increment/decrement circle counter on mouse wheel * Cap circle counter tool to 999 --------- Co-authored-by: Maxim Inozemtsev --- src/tools/capturetool.h | 6 +++ src/tools/circlecount/circlecounttool.cpp | 47 +++++++++++++++++++---- src/tools/circlecount/circlecounttool.h | 1 + src/widgets/capture/capturewidget.cpp | 23 +++++------ 4 files changed, 58 insertions(+), 19 deletions(-) diff --git a/src/tools/capturetool.h b/src/tools/capturetool.h index daadcbbad6..34d4706e36 100644 --- a/src/tools/capturetool.h +++ b/src/tools/capturetool.h @@ -105,6 +105,12 @@ class CaptureTool : public QObject return {}; }; virtual QRect boundingRect() const = 0; + virtual bool handleMouseWheelEvent(int delta, + bool adjustmentButtonPressed, + CaptureContext& context) + { + return false; + } // The icon of the tool. // inEditor is true when the icon is requested inside the editor diff --git a/src/tools/circlecount/circlecounttool.cpp b/src/tools/circlecount/circlecounttool.cpp index 2a8aef1f6d..ee27e35f92 100644 --- a/src/tools/circlecount/circlecounttool.cpp +++ b/src/tools/circlecount/circlecounttool.cpp @@ -10,6 +10,8 @@ namespace { #define PADDING_VALUE 2 #define THICKNESS_OFFSET 15 +int const MIN_COUNTER = 1; +int const MAX_COUNTER = 999; } CircleCountTool::CircleCountTool(QObject* parent) @@ -180,21 +182,50 @@ void CircleCountTool::paintMousePreview(QPainter& painter, // Thickness for pen is *2 to range from radius to diameter to match the // ellipse draw function - auto orig_pen = painter.pen(); - auto orig_opacity = painter.opacity(); + auto const previewWidth = (size() + THICKNESS_OFFSET) * 2; + painter.save(); painter.setOpacity(0.35); - painter.setPen(QPen(context.color, - (size() + THICKNESS_OFFSET) * 2, - Qt::SolidLine, - Qt::RoundCap)); + painter.setPen( + QPen(context.color, previewWidth, Qt::SolidLine, Qt::RoundCap)); painter.drawLine(context.mousePos, { context.mousePos.x() + 1, context.mousePos.y() + 1 }); - painter.setOpacity(orig_opacity); - painter.setPen(orig_pen); + + auto font = painter.font(); + font.setPixelSize(previewWidth / 2); + font.setBold(true); + painter.setFont(font); + + painter.setPen(QPen("white")); + painter.drawText(QRect{ context.mousePos.x() - previewWidth / 2, + context.mousePos.y() - previewWidth / 2, + previewWidth, + previewWidth }, + Qt::AlignCenter, + QString::number(context.circleCount)); + + painter.restore(); +} + +bool CircleCountTool::handleMouseWheelEvent(int delta, + bool adjustmentButtonPressed, + CaptureContext& ctx) +{ + if (adjustmentButtonPressed) { + ctx.circleCount = + qBound(MIN_COUNTER, ctx.circleCount + delta, MAX_COUNTER); + } + return adjustmentButtonPressed; } void CircleCountTool::drawStart(const CaptureContext& context) { + setCount(context.circleCount); + // ------------------------------------------------------------------ + // Temporary solution until the circle count variable removed from + // the context altogether and made part of Circle count tool + CaptureContext& ctx = const_cast(context); + ctx.circleCount = qBound(MIN_COUNTER, ctx.circleCount + 1, MAX_COUNTER); + // ------------------------------------------------------------------ AbstractTwoPointTool::drawStart(context); m_valid = true; } diff --git a/src/tools/circlecount/circlecounttool.h b/src/tools/circlecount/circlecounttool.h index 5c800cee52..0c8461b657 100644 --- a/src/tools/circlecount/circlecounttool.h +++ b/src/tools/circlecount/circlecounttool.h @@ -24,6 +24,7 @@ class CircleCountTool : public AbstractTwoPointTool void process(QPainter& painter, const QPixmap& pixmap) override; void paintMousePreview(QPainter& painter, const CaptureContext& context) override; + bool handleMouseWheelEvent(int, bool, CaptureContext& ctx) override; protected: CaptureTool::Type type() const override; diff --git a/src/widgets/capture/capturewidget.cpp b/src/widgets/capture/capturewidget.cpp index 25a887a8dc..73222e3dfe 100644 --- a/src/widgets/capture/capturewidget.cpp +++ b/src/widgets/capture/capturewidget.cpp @@ -45,6 +45,8 @@ #define MOUSE_DISTANCE_TO_START_MOVING 3 +auto const MOUSE_WHEEL_TRESHOLD = 60; + // CaptureWidget is the main component used to capture the screen. It contains // an area of selection with its respective buttons. @@ -834,11 +836,6 @@ bool CaptureWidget::startDrawObjectTool(const QPoint& pos) m_context.mousePos = m_displayGrid ? snapToGrid(pos) : pos; m_activeTool->drawStart(m_context); - // TODO this is the wrong place to do this - - if (m_activeTool->type() == CaptureTool::TYPE_CIRCLECOUNT) { - m_activeTool->setCount(m_context.circleCount++); - } return true; } @@ -1145,12 +1142,16 @@ void CaptureWidget::wheelEvent(QWheelEvent* e) * not accept events faster that one in 200ms. * */ int toolSizeOffset = 0; - if (e->angleDelta().y() >= 60) { - // mouse scroll (wheel) increment - toolSizeOffset = 1; - } else if (e->angleDelta().y() <= -60) { - // mouse scroll (wheel) decrement - toolSizeOffset = -1; + if (qAbs(e->angleDelta().y()) >= MOUSE_WHEEL_TRESHOLD) { + auto const delta = + qMax(qMin(e->angleDelta().y() / MOUSE_WHEEL_TRESHOLD, 1), -1); + if (activeButtonTool() && + activeButtonTool()->handleMouseWheelEvent( + delta, m_adjustmentButtonPressed, m_context)) { + this->repaint(); + return; + } + toolSizeOffset = delta; } else { // touchpad scroll qint64 current = QDateTime::currentMSecsSinceEpoch();