From 66e35b71da738dc43d6c09bda08c254d08ac6884 Mon Sep 17 00:00:00 2001 From: Rym Bouabid Date: Mon, 11 Sep 2023 10:56:06 +0200 Subject: [PATCH] Revamp Mandelbrot example: Declare slots as methods instead Declare zoom as a method because it's never used as a slot. Declare updatePixmap as a method because it's used as a slot as pointer-to-member-function, so it doesn't need help from moc. Q_OBJECT is not needed anymore as the MandelbrotWidget class doesn't contain signals ans slots anymore. It's replaced by Q_DECLARE_TR_FUNCTIONS because we are using tr() function. Fixes: QTBUG-108861 Change-Id: I9a1d66711cdc9f0ca5a1bc6645f7e0ed3395645c Reviewed-by: Ivan Solovev (cherry picked from commit 2a2275756b31ae870b5735aecb21a6e8f4c6bd55) --- examples/corelib/threads/mandelbrot/mandelbrotwidget.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/corelib/threads/mandelbrot/mandelbrotwidget.h b/examples/corelib/threads/mandelbrot/mandelbrotwidget.h index 642feebdd83..0d0fce56b36 100644 --- a/examples/corelib/threads/mandelbrot/mandelbrotwidget.h +++ b/examples/corelib/threads/mandelbrot/mandelbrotwidget.h @@ -6,6 +6,7 @@ #include "renderthread.h" +#include #include #include @@ -16,7 +17,7 @@ QT_END_NAMESPACE //! [0] class MandelbrotWidget : public QWidget { - Q_OBJECT + Q_DECLARE_TR_FUNCTIONS(MandelbrotWidget) public: MandelbrotWidget(QWidget *parent = nullptr); @@ -36,11 +37,9 @@ protected: bool event(QEvent *event) override; #endif -private slots: +private: void updatePixmap(const QImage &image, double scaleFactor); void zoom(double zoomFactor); - -private: void scroll(int deltaX, int deltaY); #ifndef QT_NO_GESTURES bool gestureEvent(QGestureEvent *event);