CVB++ 15.0
Loading...
Searching...
No Matches
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#include "_detail/detail_ui.hpp"
21
22#include "../global.hpp"
23#include "../string.hpp"
24#include "../image.hpp"
25#include "../rect_lt.hpp"
26
27namespace Cvb
28{
29
30 CVB_BEGIN_INLINE_NS
31
33
46 namespace UI
47 {
48
49 class ImageView;
50 class ImageScene;
51 class PropertyGrid;
52
77
79
82 enum class RenderEngine
83 {
103 };
104
121
123
126 {
130 int Width = 0;
131
135 int Height = 0;
136
140 int LinePad = 0;
141
146
148
154 bool operator==(const OpenGLBufferFormat &bufferFormat) const noexcept
155 {
156 return (Width == bufferFormat.Width && Height == bufferFormat.Height && LinePad == bufferFormat.LinePad
157 && TextureFormat == bufferFormat.TextureFormat);
158 }
159
161
167 bool operator!=(const OpenGLBufferFormat &bufferFormat) const noexcept
168 {
169 return !(*this == bufferFormat);
170 }
171 };
172
174
177 {
181 QVector2D VerPoint;
185 QVector2D TexPoint;
186 };
187
189
210
212
217 inline Cvb::String QtToCvb(const QString text) noexcept
218 {
219#if defined _WIN32 && defined(UNICODE)
220 return text.toStdWString();
221#else
222 return text.toStdString();
223#endif
224 }
225
227
232 inline QString CvbToQt(const Cvb::String &text) noexcept
233 {
234#if defined _WIN32 && defined(UNICODE)
235 return QString::fromStdWString(text);
236#else
237 return QString::fromStdString(text);
238#endif
239 }
240
242
247 inline QSizeF CvbToQt(Size2D<double> size) noexcept
248 {
249 return QSizeF(size.Width(), size.Height());
250 }
251
253
258 inline Size2D<double> QtToCvb(QSizeF size) noexcept
259 {
260 return Size2D<double>(size.width(), size.height());
261 }
262
264
269 inline QRectF CvbToQt(RectLT<double> rect) noexcept
270 {
271 return QRectF(rect.Left(), rect.Top(), rect.Width(), rect.Height());
272 }
273
275
280 inline RectLT<double> QtToCvb(const QRectF &rect) noexcept
281 {
282 return RectLT<double>(rect.left(), rect.top(), rect.right(), rect.bottom());
283 }
284
286
291 inline QPointF CvbToQt(Point2D<double> point) noexcept
292 {
293 return QPointF(point.X(), point.Y());
294 }
295
297
302 inline Point2D<double> QtToCvb(const QPointF &point)
303 {
304 return Point2D<double>(point.x(), point.y());
305 }
306
307 } // namespace UI
308
309 CVB_END_INLINE_NS
310
311} // 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
Cvb::String QtToCvb(const QString text) noexcept
Convenience converter for strings.
Definition ui.hpp:217
RefreshMode
Defines the refresh behavior.
Definition ui.hpp:55
@ UploadAndWaitForRepaint
Definition ui.hpp:75
@ UploadAndScheduleRepaint
Definition ui.hpp:69
@ UploadOnly
Definition ui.hpp:60
OpenGLTextureFormat
OpenGL texture format to hold the pixel data.
Definition ui.hpp:107
@ Mono
Definition ui.hpp:119
@ Unknown
Definition ui.hpp:111
@ RGB
Definition ui.hpp:115
RenderEngine
Defines the render engine used for drawing.
Definition ui.hpp:83
@ Raster
Definition ui.hpp:89
@ OpenGL3
Definition ui.hpp:102
@ OpenGL2
Definition ui.hpp:96
QString CvbToQt(const Cvb::String &text) noexcept
Convenience converter for strings.
Definition ui.hpp:232
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
Buffer format description for a texture to hold the pixel data.
Definition ui.hpp:126
OpenGLTextureFormat TextureFormat
Definition ui.hpp:145
int LinePad
Definition ui.hpp:140
bool operator!=(const OpenGLBufferFormat &bufferFormat) const noexcept
Definition ui.hpp:167
int Height
Definition ui.hpp:135
int Width
Definition ui.hpp:130
bool operator==(const OpenGLBufferFormat &bufferFormat) const noexcept
Definition ui.hpp:154
Set of all coordinates required to render a texture.
Definition ui.hpp:192
OpenGLCoord BottomRight
Definition ui.hpp:204
OpenGLCoord TopRight
Definition ui.hpp:208
OpenGLCoord TopLeft
Definition ui.hpp:196
OpenGLCoord BottomLeft
Definition ui.hpp:200
OpenGL coordinate representing a texture corner.
Definition ui.hpp:177
QVector2D VerPoint
Definition ui.hpp:181
QVector2D TexPoint
Definition ui.hpp:185