CVB++ 15.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#include <QDir>
16
17#ifdef _MSC_VER
18# pragma warning(pop)
19#endif
20
21#include "_detail/detail_ui.hpp"
22
23#include "../global.hpp"
24#include "../string.hpp"
25#include "../image.hpp"
26#include "../rect_lt.hpp"
27#include "../utilities/system_info.hpp"
28
29namespace Cvb
30{
31
32 CVB_BEGIN_INLINE_NS
33
35
71 namespace UI
72 {
73
74 class ImageView;
75 class ImageScene;
76 class PropertyGrid;
77
102
104
129
146
148
151 {
155 int Width = 0;
156
160 int Height = 0;
161
165 int LinePad = 0;
166
171
173
179 bool operator==(const OpenGLBufferFormat &bufferFormat) const noexcept
180 {
181 return (Width == bufferFormat.Width && Height == bufferFormat.Height && LinePad == bufferFormat.LinePad
182 && TextureFormat == bufferFormat.TextureFormat);
183 }
184
186
192 bool operator!=(const OpenGLBufferFormat &bufferFormat) const noexcept
193 {
194 return !(*this == bufferFormat);
195 }
196 };
197
199
202 {
206 QVector2D VerPoint;
210 QVector2D TexPoint;
211 };
212
214
235
237
242 inline Cvb::String QtToCvb(const QString text) noexcept
243 {
244#if defined _WIN32 && defined(UNICODE)
245 return text.toStdWString();
246#else
247 return text.toStdString();
248#endif
249 }
250
252
257 inline QString CvbToQt(const Cvb::String &text) noexcept
258 {
259#if defined _WIN32 && defined(UNICODE)
260 return QString::fromStdWString(text);
261#else
262 return QString::fromStdString(text);
263#endif
264 }
265
267
272 inline QSizeF CvbToQt(Size2D<double> size) noexcept
273 {
274 return QSizeF(size.Width(), size.Height());
275 }
276
278
283 inline Size2D<double> QtToCvb(QSizeF size) noexcept
284 {
285 return Size2D<double>(size.width(), size.height());
286 }
287
289
294 inline QRectF CvbToQt(RectLT<double> rect) noexcept
295 {
296 return QRectF(rect.Left(), rect.Top(), rect.Width(), rect.Height());
297 }
298
300
305 inline RectLT<double> QtToCvb(const QRectF &rect) noexcept
306 {
307 return RectLT<double>(rect.left(), rect.top(), rect.right(), rect.bottom());
308 }
309
311
316 inline QPointF CvbToQt(Point2D<double> point) noexcept
317 {
318 return QPointF(point.X(), point.Y());
319 }
320
322
327 inline Point2D<double> QtToCvb(const QPointF &point)
328 {
329 return Point2D<double>(point.x(), point.y());
330 }
331
333
337 inline QString CvbQtPluginPath()
338 {
339 QDir qtPluginPath = CvbToQt(Cvb::InstallPath());
340 return QDir(qtPluginPath.filePath("qt")).filePath("plugins");
341 }
342
344
348 inline QString CvbQtQmlPath()
349 {
350 QDir qtQmlPath = CvbToQt(Cvb::InstallPath());
351 return QDir(qtQmlPath.filePath("qt")).filePath("qml");
352 }
353
354 } // namespace UI
355
356 CVB_END_INLINE_NS
357
358} // namespace Cvb
Multi-purpose 2D vector class.
Definition point_2d.hpp:20
Rectangle object.
Definition rect_lt.hpp:22
Stores a pair of numbers that represents the width and the height of a subject, typically a rectangle...
Definition size_2d.hpp:20
Scene to provide a convenient display for an image.
Definition decl_image_scene.hpp:49
View to display an image.
Definition decl_image_view.hpp:69
View to display a device's nodemap.
Definition property_grid.hpp:150
Namespace for user interface components.
Definition decl_image_scene.hpp:39
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:242
RefreshMode
Defines the refresh behavior.
Definition ui.hpp:80
@ UploadAndWaitForRepaint
Definition ui.hpp:100
@ UploadAndScheduleRepaint
Definition ui.hpp:94
@ UploadOnly
Definition ui.hpp:85
OpenGLTextureFormat
OpenGL texture format to hold the pixel data.
Definition ui.hpp:132
@ Mono
Definition ui.hpp:144
@ Unknown
Definition ui.hpp:136
@ RGB
Definition ui.hpp:140
RenderEngine
Defines the render engine used for drawing.
Definition ui.hpp:108
@ Raster
Definition ui.hpp:114
@ OpenGL3
Definition ui.hpp:127
@ OpenGL2
Definition ui.hpp:121
QString CvbToQt(const Cvb::String &text) noexcept
Convenience converter for strings.
Definition ui.hpp:257
Root namespace for the Image Manager interface.
Definition c_bayer_to_rgb.h:17
std::string String
String for wide characters or unicode characters.
Definition string.hpp:49
String InstallPath()
Directory Common Vision Blox has been installed to.
Definition system_info.hpp:234
Buffer format description for a texture to hold the pixel data.
Definition ui.hpp:151
OpenGLTextureFormat TextureFormat
Definition ui.hpp:170
int LinePad
Definition ui.hpp:165
bool operator!=(const OpenGLBufferFormat &bufferFormat) const noexcept
Definition ui.hpp:192
int Height
Definition ui.hpp:160
int Width
Definition ui.hpp:155
bool operator==(const OpenGLBufferFormat &bufferFormat) const noexcept
Definition ui.hpp:179
Set of all coordinates required to render a texture.
Definition ui.hpp:217
OpenGLCoord BottomRight
Definition ui.hpp:229
OpenGLCoord TopRight
Definition ui.hpp:233
OpenGLCoord TopLeft
Definition ui.hpp:221
OpenGLCoord BottomLeft
Definition ui.hpp:225
OpenGL coordinate representing a texture corner.
Definition ui.hpp:202
QVector2D VerPoint
Definition ui.hpp:206
QVector2D TexPoint
Definition ui.hpp:210