CVB++ 14.1
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#include <QDir>
16
17#ifdef _MSC_VER
18#pragma warning ( pop)
19#endif
20
21
22#include "_detail/detail_ui.hpp"
23
24
25#include "../global.hpp"
26#include "../string.hpp"
27#include "../image.hpp"
28#include "../rect_lt.hpp"
29#include "../utilities/system_info.hpp"
30
31
32
33namespace Cvb
34{
35
36CVB_BEGIN_INLINE_NS
37
39
51namespace UI
52{
53
54
55
56class ImageView;
57class ImageScene;
58class PropertyGrid;
59
61enum class RefreshMode
62{
81};
82
83
84
85
86
88
91enum class RenderEngine
92{
98 Raster,
104 OpenGL2,
110 OpenGL3
111};
112
113
114
115
116
117
118
121{
125 Unknown,
129 RGB,
133 Mono
134};
135
137
140{
144 int Width = 0;
145
149 int Height = 0;
150
154 int LinePad = 0;
155
160
161
162
164
170 bool operator==(const OpenGLBufferFormat & bufferFormat) const noexcept
171 {
172 return (Width == bufferFormat.Width
173 && Height == bufferFormat.Height
174 && LinePad == bufferFormat.LinePad
175 && TextureFormat == bufferFormat.TextureFormat);
176 }
177
178
180
186 bool operator!=(const OpenGLBufferFormat & bufferFormat) const noexcept
187 {
188 return !(*this == bufferFormat);
189 }
190};
191
192
193
195
198{
207};
208
210
213{
230};
231
232
233
235
240inline Cvb::String QtToCvb(const QString text) noexcept
241{
242#if defined _WIN32 && defined(UNICODE)
243 return text.toStdWString();
244#else
245 return text.toStdString();
246#endif
247}
248
250
255inline QString CvbToQt(const Cvb::String& text) noexcept
256{
257#if defined _WIN32 && defined(UNICODE)
258 return QString::fromStdWString(text);
259#else
260 return QString::fromStdString(text);
261#endif
262}
263
265
270inline QSizeF CvbToQt(Size2D<double> size) noexcept
271{
272 return QSizeF(size.Width(), size.Height());
273}
274
275
277
282inline Size2D<double> QtToCvb(QSizeF size) noexcept
283{
284 return Size2D<double>(size.width(), size.height());
285}
286
288
293inline QRectF CvbToQt(RectLT<double> rect) noexcept
294{
295 return QRectF(rect.Left(), rect.Top(), rect.Width(), rect.Height());
296}
297
299
304inline RectLT<double> QtToCvb(const QRectF & rect) noexcept
305{
306 return RectLT<double>(rect.left(), rect.top(), rect.right(), rect.bottom());
307}
308
309
311
316inline QPointF CvbToQt(Point2D<double> point) noexcept
317{
318 return QPointF(point.X(), point.Y());
319}
320
322
327inline Point2D<double> QtToCvb(const QPointF & point)
328{
329 return Point2D<double>(point.x(), point.y());
330}
331
333
338{
339 QDir qtPluginPath = CvbToQt(Cvb::InstallPath());
340 return QDir(qtPluginPath.filePath("qt")).filePath("plugins");
341}
342
344
349{
350 QDir qtQmlPath = CvbToQt(Cvb::InstallPath());
351 return QDir(qtQmlPath.filePath("qt")).filePath("qml");
352}
353
354
355
356
357
358}
359
360
361
362CVB_END_INLINE_NS
363
364
365
366}
367
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
QString CvbQtQmlPath()
Directory to Qt qml installed with CVB.
Definition: ui.hpp:348
QString CvbQtPluginPath()
Directory to Qt plugins installed with CVB.
Definition: ui.hpp:337
Cvb::String QtToCvb(const QString text) noexcept
Convenience converter for strings.
Definition: ui.hpp:240
RefreshMode
Defines the refresh behavior.
Definition: ui.hpp:62
OpenGLTextureFormat
OpenGL texture format to hold the pixel data.
Definition: ui.hpp:121
RenderEngine
Defines the render engine used for drawing.
Definition: ui.hpp:92
QString CvbToQt(const Cvb::String &text) noexcept
Convenience converter for strings.
Definition: ui.hpp:255
Root namespace for the Image Manager interface.
Definition: version.hpp:12
QString filePath(const QString &fileName) const const
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:140
OpenGLTextureFormat TextureFormat
Definition: ui.hpp:159
int LinePad
Definition: ui.hpp:154
bool operator!=(const OpenGLBufferFormat &bufferFormat) const noexcept
Definition: ui.hpp:186
int Height
Definition: ui.hpp:149
int Width
Definition: ui.hpp:144
bool operator==(const OpenGLBufferFormat &bufferFormat) const noexcept
Definition: ui.hpp:170
Set of all coordinates required to render a texture.
Definition: ui.hpp:213
OpenGLCoord BottomRight
Definition: ui.hpp:225
OpenGLCoord TopRight
Definition: ui.hpp:229
OpenGLCoord TopLeft
Definition: ui.hpp:217
OpenGLCoord BottomLeft
Definition: ui.hpp:221
OpenGL coordinate representing a texture corner.
Definition: ui.hpp:198
QVector2D VerPoint
Definition: ui.hpp:202
QVector2D TexPoint
Definition: ui.hpp:206