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:
parent
87728a2330
commit
66e35b71da
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "renderthread.h"
|
#include "renderthread.h"
|
||||||
|
|
||||||
|
#include <QCoreApplication>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
@ -16,7 +17,7 @@ QT_END_NAMESPACE
|
|||||||
//! [0]
|
//! [0]
|
||||||
class MandelbrotWidget : public QWidget
|
class MandelbrotWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_DECLARE_TR_FUNCTIONS(MandelbrotWidget)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MandelbrotWidget(QWidget *parent = nullptr);
|
MandelbrotWidget(QWidget *parent = nullptr);
|
||||||
@ -36,11 +37,9 @@ protected:
|
|||||||
bool event(QEvent *event) override;
|
bool event(QEvent *event) override;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private slots:
|
private:
|
||||||
void updatePixmap(const QImage &image, double scaleFactor);
|
void updatePixmap(const QImage &image, double scaleFactor);
|
||||||
void zoom(double zoomFactor);
|
void zoom(double zoomFactor);
|
||||||
|
|
||||||
private:
|
|
||||||
void scroll(int deltaX, int deltaY);
|
void scroll(int deltaX, int deltaY);
|
||||||
#ifndef QT_NO_GESTURES
|
#ifndef QT_NO_GESTURES
|
||||||
bool gestureEvent(QGestureEvent *event);
|
bool gestureEvent(QGestureEvent *event);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user