Kstars

sensorgraphic.h
1/*
2 SPDX-FileCopyrightText: 2023 John Evans <john.e.evans.email@googlemail.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "aberrationinspectorutils.h"
10#include <QtWidgets/QWidget>
11
12// The SensorGraphic class renders a graphic of a camera sensor with the mosaic tiles drawn on it.
13// The tiles occupy the correct proportion and position of the sensor.
14// Each tile is labelled appropriately, e.g. T = top, TL = top left.
15// There is a highlight method where a single tile is highlighted in its appropriate colour.
16//
17// SensorGraphic behaves like a tooltip. Tooltips seem to only allow text. This class creates a popup window.
18// It is a subclass of QWidget where the paintEvent method has been reimplemented.
19//
20namespace Ekos
21{
22
23class SensorGraphic : public QWidget
24{
25 public:
26 /**
27 * @brief create a SensorGraphic with the associated dimensions
28 * @param parent widget
29 * @param sensor width (pixels)
30 * @param sensor height (pixels)
31 * @param tile size
32 */
33 SensorGraphic(const QWidget *parent, const int SW, const int SH, const int tileSize);
34 ~SensorGraphic();
35
36 /**
37 * @brief set the tile to highlight
38 * @param highlight
39 */
40 void setHighlight(int highlight);
41
42 /**
43 * @brief set the tiles to use
44 * @param useTile array
45 */
46 void setTiles(bool useTile[NUM_TILES]);
47
48 protected:
49 /**
50 * @brief implemented paintEvent
51 * @param paint event
52 */
53 void paintEvent(QPaintEvent *) override;
54
55 private:
56 const QWidget * m_Parent;
57 int m_Highlight { 0 };
58
59 // Picture variables
60 int m_PW { 0 };
61 int m_PH { 0 };
62
63 // Sensor variables
64 int m_SW { 0 };
65 int m_SH { 0 };
66 int m_tileSize { 0 };
67
68 // Path to picture resource
69 QString m_picturePath { ":/icons/sensorgraphic.png" };
70
71 bool m_useTile[NUM_TILES] = { true, true, true, true, true, true, true, true, true };
72};
73
74}
Ekos is an advanced Astrophotography tool for Linux.
Definition align.cpp:83
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:38:43 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.