34#include <NDEVR/PopupInfo.h>
35#include <NDEVR/StringStream.h>
36#include <NDEVR/BaseValues.h>
37#include <NDEVR/Resource.h>
38#include <NDEVR/Translator.h>
39#include <NDEVR/Event.h>
40#if NDEVR_SUPPORTS_THREADING
44#include <QAbstractEventDispatcher>
59 struct FEvent final :
public QEvent {
60 using Fun =
typename std::decay<F>::type;
90 static void postToThread(std::function<
void()>&& fun, QThread * thread =
nullptr);
91 static void postToThread(QObject* target, std::function<
void()>&& fun);
92 static void requestScreenOrientation(
bool horizontal);
99 static void MultiplyFontSize(QFont& font,
fltp08 multiplier);
100 static QSize ScaleFontSizeToFit(QFont& font,
const QString& text,
const QRect& rect,
bool shrink =
true,
bool grow =
false);
101 static void FitTextToRect(QString& text, QFont& font,
const QRectF& size,
bool allow_new_line =
true);
102 static QString AutoWrapText(
const QString& value,
const QFontMetrics& metrics,
fltp08 length);
104 static void SetFontRecursive(QWidget* widget,
const QFont& font);
105 static void SetFontRecursive(QWidget* widget,
const Buffer<QFont>& font);
106 static void SetStyleRecursive(QWidget* widget, QStyle* style);
107 static fltp08 PointSize(
const QFont& font);
108 static fltp08 PixelSize(
const QFont& font);
110 static void ForceSizeCalculation(QWidget* widget,
bool process_events =
false);
111 static bool IsWidgetVisibleOnScreen(QWidget* widget);
112 static QScreen* ScreenForWidget(
const QWidget* widget);
113 static QPixmap* DrawAnimationWidget(QWidget* widget,
bool draw_background, QPixmap* pixmap =
nullptr, QSize size = QSize());
114 static QPixmap* DrawFullWidget(QWidget* widget,
bool draw_background, QPixmap* pixmap =
nullptr, QSize size = QSize());
115 static qreal DevicePixelRatio(QWindow* window =
nullptr);
118 static QRect PopupMenuLocation(QWidget* widget,
const QSize& size);
119 static QRect PopupMenuLocation(QRect popup_origin,
const QSize& size);
120 static void ClearLayout(QLayout* layout,
bool delete_objects =
false);
123 static bool IsVisibleToUser(QWidget* widget);
125 , QMessageBox::StandardButtons buttons = { QMessageBox::StandardButton::Ok }
126 , std::function<void(QMessageBox::StandardButton,
PopupInfo info)> on_select = nullptr
129 , QMessageBox::StandardButtons buttons = { QMessageBox::StandardButton::Ok }
130 , std::function<void(QMessageBox::StandardButton,
PopupInfo info)> on_select = nullptr
148 static fltp08 DefaultAnimationScale();
149 static QSurfaceFormat DefaultSurfaceFormat();
150 static void FormatPallete(
bool error, QWidget* widget);
151 static void ClearPallete(QWidget* widget);
152 static void ServiceQT();
157 template<
typename EnumType>
160 const char* enumName = qt_getEnumName(enumValue);
161 const QMetaObject* metaObject = qt_getEnumMetaObject(enumValue);
164 const int enumIndex = metaObject->indexOfEnumerator(enumName);
165 return String(metaObject->className()) +
" : "+
String(enumName) +
" : "+
String(metaObject->enumerator(enumIndex).valueToKey(enumValue));
168 return String(enumName) +
" : "+
String(
static_cast<int>(enumValue));
178 void onValueChanged() override final;
179 bool m_has_been_posted;
180 bool m_safe_to_delete;
187 void onChanged()
override final;
192 #define _tqa(var) (_t(var).translation().getAs<QString>())
193 #define _tqs(var) (String(_t(var)).getAs<QString>())
194 #define _tdq(var, def) (_td(var, def).translation().getAs<QString>())
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
Definition MemoryManager.h:283
Definition ProgressInfo.hpp:43
virtual void onChanged()=0
const std::function< void()> m_callback
Definition QTTools.h:188
Represents a color in the RGB space with optional alpha transparency.
Definition RGBColor.h:53
Definition ResourceListener.h:55
Definition StringStream.h:62
Definition TranslatedString.h:9
An element of a vector space. An element of the real coordinate space Rn Basis vector,...
Definition Vector.hpp:62
int64_t sint08
-Defines an alias representing an 8 byte, signed integer -Can represent exact integer values -9223372...
Definition BaseValues.hpp:86
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:120
aiColor4D convert(RGBColor value)
Definition AssimpFactory.cpp:271
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:181
Definition GenericOptions.h:53
Definition ModuleManager.h:54
FEvent(Fun &&fun)
Definition QTTools.h:62
typename std::decay< F >::type Fun
Definition QTTools.h:60
~FEvent()
Definition QTTools.h:64
Fun fun
Definition QTTools.h:61
FEvent(const Fun &fun)
Definition QTTools.h:63