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 <ivan.solovev@qt.io>
(cherry picked from commit 2a2275756b31ae870b5735aecb21a6e8f4c6bd55)
This commit is contained in:
Rym Bouabid 2023-09-11 10:56:06 +02:00
parent 87728a2330
commit 66e35b71da

View File

@ -6,6 +6,7 @@
#include "renderthread.h"
#include <QCoreApplication>
#include <QPixmap>
#include <QWidget>
@ -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);