From d9b1c253dbc894765cf27655e94ba07a5b317996 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Du=C5=A1an=20Poizl?= Date: Sat, 17 Jun 2023 21:45:35 +0200 Subject: [PATCH] Move initialization of member variables --- imagescrollareagl.cpp | 14 -------------- imagescrollareagl.h | 45 +++++++++++++++++++++---------------------- 2 files changed, 22 insertions(+), 37 deletions(-) diff --git a/imagescrollareagl.cpp b/imagescrollareagl.cpp index 59eb851..2f3fefa 100644 --- a/imagescrollareagl.cpp +++ b/imagescrollareagl.cpp @@ -60,23 +60,9 @@ ImageWidget::ImageWidget(Database *database, QWidget *parent) : QOpenGLWidget(pa , m_database(database) { setFocusPolicy(Qt::ClickFocus); - m_range = UINT16_MAX; - m_low = 0; - m_mid = 0.5; - m_high = 1; - m_dx = m_dy = 0; - m_scale = 1.0f; - m_blockRepaint = false; - m_range = UINT16_MAX; - m_imgWidth = m_imgHeight = -1; - m_superpixel = m_invert = false; - m_showThumbnails = false; - m_selecting = false; - m_thumbnailCount = 0; m_updateTimer = new QTimer(this); m_updateTimer->setInterval(500); m_updateTimer->setSingleShot(true); - m_sizesDirty = false; connect(m_updateTimer, SIGNAL(timeout()), this, SLOT(update())); setAcceptDrops(true); QTimer::singleShot(1000, [this](){ diff --git a/imagescrollareagl.h b/imagescrollareagl.h index 8b2c7a9..428e4f7 100644 --- a/imagescrollareagl.h +++ b/imagescrollareagl.h @@ -27,9 +27,9 @@ struct ImageThumb class ImageWidget : public QOpenGLWidget { Q_OBJECT - QOpenGLFunctions *f; - QOpenGLFunctions_3_3_Core *f3; - QTimer *m_updateTimer; + QOpenGLFunctions *f = nullptr; + QOpenGLFunctions_3_3_Core *f3 = nullptr; + QTimer *m_updateTimer = nullptr; std::unique_ptr m_program; std::unique_ptr m_thumbnailProgram; std::unique_ptr m_debayerProgram; @@ -44,31 +44,30 @@ class ImageWidget : public QOpenGLWidget std::shared_ptr m_rawImage; std::shared_ptr m_wcs; int m_width, m_height; - int m_imgWidth, m_imgHeight; - int m_currentImg; - float m_low; - float m_mid; - float m_high; - float m_range; - float m_dx, m_dy; - float m_scale; + int m_imgWidth = -1, m_imgHeight = -1; + int m_currentImg = 0; + float m_low = 0.0f; + float m_mid = 0.5f; + float m_high = 1.0; + float m_dx = 0, m_dy = 0; + float m_scale = 1.0f; int m_scaleStop = 0; bool m_bestFit = false; float m_whiteBalance[3] = {1.0f, 1.0f, 1.0f}; - bool m_blockRepaint; - bool m_bwImg; + bool m_blockRepaint = false; + bool m_bwImg = false; bool m_falseColor = false; - bool m_invert; - bool m_superpixel; - bool m_showThumbnails; - bool m_selecting; - bool m_sizesDirty; - bool m_srgb; - int m_thumbnailCount; - int m_maxTextureSize; - int m_maxArrayLayers; + bool m_invert = false; + bool m_superpixel = false; + bool m_showThumbnails = false; + bool m_selecting = false; + bool m_sizesDirty = false; + bool m_srgb = false; + int m_thumbnailCount = 0; + int m_maxTextureSize = 0; + int m_maxArrayLayers = 0; QVector m_thumnails; - Database *m_database; + Database *m_database = nullptr; QPointF m_lastPos; public: explicit ImageWidget(Database *database, QWidget *parent = nullptr);