CVB++ 14.0
ui.hpp
1#pragma once
2
3#ifdef _MSC_VER
4#pragma warning ( push, 1)
5#pragma warning ( disable : 4127)
6#pragma warning ( disable : 4005) // macro redefinition // TODO
7#endif
8
9#include <QtGlobal>
10#include <QVector2D>
11#include <QString>
12#include <QObject>
13#include <QSizeF>
14#include <QRectF>
15
16#ifdef _MSC_VER
17#pragma warning ( pop)
18#endif
19
20
21#include "_detail/detail_ui.hpp"
22
23
24#include "../global.hpp"
25#include "../string.hpp"
26#include "../image.hpp"
27#include "../rect_lt.hpp"
28
29
30
31namespace Cvb
32{
33
34CVB_BEGIN_INLINE_NS
35
37
49namespace UI
50{
51
52
53
54class ImageView;
55class ImageScene;
56class PropertyGrid;
57class PropertyModel;
58
60enum class RefreshMode
61{
80};
81
82
83
84
85
87
90enum class RenderEngine
91{
97 Raster,
103 OpenGL2,
109 OpenGL3
110};
111
112
113
114
115
116
117
120{
124 Unknown,
128 RGB,
132 Mono
133};
134
136
139{
143 int Width = 0;
144
148 int Height = 0;
149
153 int LinePad = 0;
154
159
160
161
163
169 bool operator==(const OpenGLBufferFormat & bufferFormat) const noexcept
170 {
171 return (Width == bufferFormat.Width
172 && Height == bufferFormat.Height
173 && LinePad == LinePad
174 && TextureFormat == bufferFormat.TextureFormat);
175 }
176
177
179
185 bool operator!=(const OpenGLBufferFormat & bufferFormat) const noexcept
186 {
187 return !(*this == bufferFormat);
188 }
189};
190
191
192
194
197{
206};
207
209
212{
229};
230
231
232
234
239inline Cvb::String QtToCvb(const QString text) noexcept
240{
241#if defined _WIN32 && defined(UNICODE)
242 return text.toStdWString();
243#else
244 return text.toStdString();
245#endif
246}
247
249
254inline QString CvbToQt(const Cvb::String& text) noexcept
255{
256#if defined _WIN32 && defined(UNICODE)
257 return QString::fromStdWString(text);
258#else
259 return QString::fromStdString(text);
260#endif
261}
262
264
269inline QSizeF CvbToQt(Size2D<double> size) noexcept
270{
271 return QSizeF(size.Width(), size.Height());
272}
273
274
276
281inline Size2D<double> QtToCvb(QSizeF size) noexcept
282{
283 return Size2D<double>(size.width(), size.height());
284}
285
287
292inline QRectF CvbToQt(RectLT<double> rect) noexcept
293{
294 return QRectF(rect.Left(), rect.Top(), rect.Width(), rect.Height());
295}
296
298
303inline RectLT<double> QtToCvb(const QRectF & rect) noexcept
304{
305 return RectLT<double>(rect.left(), rect.top(), rect.right(), rect.bottom());
306}
307
308
310
315inline QPointF CvbToQt(Point2D<double> point) noexcept
316{
317 return QPointF(point.X(), point.Y());
318}
319
321
326inline Point2D<double> QtToCvb(const QPointF & point)
327{
328 return Point2D<double>(point.x(), point.y());
329}
330
331
332
333
334
335
336}
337
338
339
340CVB_END_INLINE_NS
341
342
343
344}
345
T Height() const noexcept
Gets the vertical component of the size.
Definition: size_2d.hpp:79
T Width() const noexcept
Gets the horizontal component of the size.
Definition: size_2d.hpp:59
Cvb::String QtToCvb(const QString text) noexcept
Convenience converter for strings.
Definition: ui.hpp:239
RefreshMode
Defines the refresh behavior.
Definition: ui.hpp:61
OpenGLTextureFormat
OpenGL texture format to hold the pixel data.
Definition: ui.hpp:120
RenderEngine
Defines the render engine used for drawing.
Definition: ui.hpp:91
QString CvbToQt(const Cvb::String &text) noexcept
Convenience converter for strings.
Definition: ui.hpp:254
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24
qreal x() const const
qreal y() const const
QString fromStdString(const std::string &str)
QString fromStdWString(const std::wstring &str)
Buffer format description for a texture to hold the pixel data.
Definition: ui.hpp:139
OpenGLTextureFormat TextureFormat
Definition: ui.hpp:158
int LinePad
Definition: ui.hpp:153
bool operator!=(const OpenGLBufferFormat &bufferFormat) const noexcept
Definition: ui.hpp:185
int Height
Definition: ui.hpp:148
int Width
Definition: ui.hpp:143
bool operator==(const OpenGLBufferFormat &bufferFormat) const noexcept
Definition: ui.hpp:169
Set of all coordinates required to render a texture.
Definition: ui.hpp:212
OpenGLCoord BottomRight
Definition: ui.hpp:224
OpenGLCoord TopRight
Definition: ui.hpp:228
OpenGLCoord TopLeft
Definition: ui.hpp:216
OpenGLCoord BottomLeft
Definition: ui.hpp:220
OpenGL coordinate representing a texture corner.
Definition: ui.hpp:197
QVector2D VerPoint
Definition: ui.hpp:201
QVector2D TexPoint
Definition: ui.hpp:205