![]() |
NDEVR
API Documentation
|
Manages static logic dealing with Qt and relating to the application. More...
Static Public Member Functions | |
| static void | AutosetName (QWidget *widget, const TranslatedString &title, const StringView &object_class) |
| Automatically sets the object name on a widget based on the title and class. | |
| static QString | AutoWrapText (const QString &value, const QFontMetrics &metrics, fltp08 length) |
| Wraps text automatically at word boundaries to fit within a given pixel length. | |
| static void | ClearLayout (QLayout *layout, bool delete_objects=false) |
| Removes all items from a layout, optionally deleting the child widgets. | |
| static void | ClearPallete (QWidget *widget) |
| Resets a widget's palette to the default application palette. | |
| static QFont | convert (const Font &font) |
| Converts an NDEVR Font to a QFont. | |
| static RGBColor | convert (const QColor &color) |
| Converts a QColor to an NDEVR RGBColor. | |
| static File | convert (const QFile &file) |
| Converts a QFile to an NDEVR File. | |
| static Font | convert (const QFont &q_font) |
| Converts a QFont to an NDEVR Font. | |
| static QColor | convert (const RGBColor &color) |
| Converts an NDEVR RGBColor to a QColor. | |
| static KeyEvent | convert (QKeyEvent *event) |
| Converts a Qt QKeyEvent to an NDEVR KeyEvent. | |
| static KeyEvent::KEY | ConvertNativeKeyEvent (sint08 key) |
| Converts a native platform key code to an NDEVR KeyEvent::KEY value. | |
| static fltp08 | DefaultAnimationScale () |
| Returns the default animation time scale factor. | |
| static QSurfaceFormat | DefaultSurfaceFormat (bool debug) |
| Returns the default QSurfaceFormat for OpenGL surfaces. | |
| static qreal | DevicePixelRatio (QWindow *window=nullptr) |
| Returns the device pixel ratio for the given window, or the primary screen if null. | |
| static fltp08 | DPI () |
| Returns the current screen DPI. | |
| static QPixmap * | DrawAnimationWidget (QWidget *widget, bool draw_background, QPixmap *pixmap=nullptr, QSize size=QSize()) |
| Renders a widget into a pixmap suitable for animation snapshots. | |
| static QPixmap * | DrawFullWidget (QWidget *widget, bool draw_background, QPixmap *pixmap=nullptr, QSize size=QSize()) |
| Renders a complete widget and its children into a pixmap. | |
| template<typename EnumType> | |
| static String | EnumString (const EnumType &enumValue) |
| Converts a Qt enum value to a human-readable String including class and enum name. | |
| static void | FitTextToCircle (QString &text, QFont &font, const fltp08 radius, fltp08 split_y_fraction, bool allow_new_line=true) |
| Adjusts text and font so the text fits within a circle. | |
| static void | FitTextToRect (QString &text, QFont &font, const QRectF &size, bool allow_new_line=true) |
| Adjusts text and font so the text fits within a rectangle, potentially adding line breaks. | |
| static void | ForceSizeCalculation (QWidget *widget, bool process_events=false) |
| Forces a widget to recalculate its size, optionally processing pending events. | |
| static void | FormatPallete (bool error, QWidget *widget) |
| Applies an error or normal formatting to a widget's palette. | |
| static Buffer< QFont > | GetFontRecursive (QWidget *widget) |
| Recursively collects the fonts used by a widget and all its children. | |
| static void | HideDialog (QWidget *widget, PopupInfo end_location=PopupInfo()) |
| Hides a dialog widget with an optional animation to an end location. | |
| static bool | IsVisibleToUser (QWidget *widget) |
| Checks whether a widget is visible to the user, accounting for popups and tabs. | |
| static bool | IsWidgetVisibleOnScreen (QWidget *widget) |
| Checks whether a widget is currently visible on any screen. | |
| static LogPtr | log () |
| Returns the global log for the Widgets module. | |
| static void | MultiplyFontSize (QFont &font, fltp08 multiplier) |
| Multiplies the font size by a given factor. | |
| static fltp08 | PixelSize (const QFont &font) |
| Returns the pixel size of a font, converting from point size if necessary. | |
| static fltp08 | PointSize (const QFont &font) |
| Returns the point size of a font, converting from pixel size if necessary. | |
| static QRect | PopupMenuLocation (QWidget *widget, const QSize &size) |
| Calculates a suitable popup menu location relative to a widget. | |
| static QRect | PopupMenuLocation (QWidget *widget, QRect popup_origin, const QSize &size) |
| Calculates a suitable popup menu location relative to a widget with a given origin. | |
| static void | PostToThread (QObject *target, std::function< void()> &&fun) |
| Posts a function to be executed on the thread that owns the target QObject. | |
| static void | PostToThread (std::function< void()> &&fun, QThread *thread=nullptr) |
| Posts a function to be executed on the specified thread, or the main thread if none is given. | |
| static Module | QTModule () |
| Returns the Module descriptor for the Qt integration module. | |
| static void | RequestExit (bool relaunch, const PopupInfo &popup_origin=PopupInfo()) |
| Requests the application to exit, optionally relaunching afterward. | |
| static void | RequestScreenOrientation (bool horizontal) |
| Requests the screen orientation to be horizontal or vertical. | |
| static void | RequestScreenResolution (const Vector< 2, uint04 > &size) |
| Requests a specific screen resolution. | |
| static QSize | ScaleFontSizeToFit (QFont &font, const QString &text, const QRect &rect, bool shrink=true, bool grow=false) |
| Scales a font size so that the given text fits within the specified rectangle. | |
| static QScreen * | ScreenForWidget (const QWidget *widget) |
| Returns the QScreen that contains the given widget. | |
| static void | ServiceQT () |
| Processes pending Qt events in the current event loop. | |
| static void | SetFontRecursive (QWidget *widget, const Buffer< QFont > &font) |
| Recursively restores fonts on a widget and all its children from a buffer. | |
| static void | SetFontRecursive (QWidget *widget, const QFont &font) |
| Recursively sets the font on a widget and all its children. | |
| static void | SetStyleRecursive (QWidget *widget, QStyle *style) |
| Recursively sets the QStyle on a widget and all its children. | |
| static bool | ShowDialog (QWidget *widget, PopupInfo info, PopupInfo end_location=PopupInfo()) |
| Shows a dialog widget with animation and positioning specified by PopupInfo. | |
| static void | ShowExperimentalFeatureDialog (const TranslatedString &feature) |
| Shows a dialog informing the user that a feature is experimental. | |
| static bool | ShowMessageBox (const GenericOption &options, const StringView &image, std::function< bool(GenericOption, PopupInfo info)> on_select, const PopupInfo &popup_origin=PopupInfo()) |
| Shows a message box configured by a GenericOption with an image. | |
| static bool | ShowMessageBox (const GenericOption &options, std::function< bool(GenericOption, PopupInfo info)> on_select, const PopupInfo &popup_origin=PopupInfo()) |
| Shows a message box configured by a GenericOption. | |
| static bool | ShowMessageBox (const TranslatedString &title, const StringView &image, const TranslatedString &text, const TranslatedStringBuffer &button_labels, std::function< void(TranslatedString, PopupInfo info)> on_select=nullptr, const PopupInfo &popup_origin=PopupInfo()) |
| Shows a message box with an image and custom-labeled buttons. | |
| static bool | ShowMessageBox (const TranslatedString &title, const StringView &image, const TranslatedString &text, QMessageBox::StandardButtons buttons={ QMessageBox::StandardButton::Ok }, std::function< void(QMessageBox::StandardButton, PopupInfo info)> on_select=nullptr, const PopupInfo &popup_origin=PopupInfo()) |
| Shows a message box with an image and standard buttons. | |
| static bool | ShowMessageBox (const TranslatedString &title, const TranslatedString &text, const TranslatedStringBuffer &button_labels, std::function< void(TranslatedString, PopupInfo info)> on_select=nullptr, const PopupInfo &popup_origin=PopupInfo()) |
| Shows a message box with custom-labeled buttons. | |
| static bool | ShowMessageBox (const TranslatedString &title, const TranslatedString &text, QMessageBox::StandardButtons buttons={ QMessageBox::StandardButton::Ok }, std::function< void(QMessageBox::StandardButton, PopupInfo info)> on_select=nullptr, const PopupInfo &popup_origin=PopupInfo()) |
| Shows a message box with standard buttons. | |
Static Public Attributes | |
| static Resource< bool > | is_horizontal |
| Resource tracking whether the screen is in horizontal (landscape) orientation. | |
Manages static logic dealing with Qt and relating to the application.
|
static |
Automatically sets the object name on a widget based on the title and class.
| [in] | widget | The widget to name. |
| [in] | title | The translated title. |
| [in] | object_class | The class name prefix. |
|
static |
Wraps text automatically at word boundaries to fit within a given pixel length.
| [in] | value | The text to wrap. |
| [in] | metrics | The font metrics used for measuring text width. |
| [in] | length | The maximum line length in pixels. |
|
static |
Removes all items from a layout, optionally deleting the child widgets.
| [in] | layout | The layout to clear. |
| [in] | delete_objects | Whether to delete the child widget objects. |
|
static |
Resets a widget's palette to the default application palette.
| [in] | widget | The widget to reset. |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Converts a native platform key code to an NDEVR KeyEvent::KEY value.
| [in] | key | The native key code. |
|
static |
Returns the default animation time scale factor.
|
static |
Returns the default QSurfaceFormat for OpenGL surfaces.
| [in] | debug | Whether to enable debug context. |
|
static |
Returns the device pixel ratio for the given window, or the primary screen if null.
| [in] | window | The window to query, or nullptr for the default. |
|
static |
Returns the current screen DPI.
|
static |
Renders a widget into a pixmap suitable for animation snapshots.
| [in] | widget | The widget to render. |
| [in] | draw_background | Whether to include the background. |
| [in] | pixmap | An optional existing pixmap to reuse. |
| [in] | size | The target rendering size, or default for the widget's size. |
|
static |
Renders a complete widget and its children into a pixmap.
| [in] | widget | The widget to render. |
| [in] | draw_background | Whether to include the background. |
| [in] | pixmap | An optional existing pixmap to reuse. |
| [in] | size | The target rendering size, or default for the widget's size. |
|
inlinestatic |
|
static |
Adjusts text and font so the text fits within a circle.
| [in] | text | The text to modify in-place. |
| [in] | font | The font to modify in-place. |
| [in] | radius | The circle radius. |
| [in] | split_y_fraction | Vertical fraction at which to split text lines. |
| [in] | allow_new_line | Whether line breaks may be inserted. |
|
static |
Adjusts text and font so the text fits within a rectangle, potentially adding line breaks.
| [in] | text | The text to modify in-place. |
| [in] | font | The font to modify in-place. |
| [in] | size | The target rectangle. |
| [in] | allow_new_line | Whether line breaks may be inserted. |
|
static |
Forces a widget to recalculate its size, optionally processing pending events.
| [in] | widget | The widget to recalculate. |
| [in] | process_events | Whether to process pending Qt events during the calculation. |
|
static |
Applies an error or normal formatting to a widget's palette.
| [in] | error | Whether to apply error formatting (true) or normal formatting (false). |
| [in] | widget | The widget to format. |
|
static |
Recursively collects the fonts used by a widget and all its children.
| [in] | widget | The root widget. |
Hides a dialog widget with an optional animation to an end location.
| [in] | widget | The dialog widget to hide. |
| [in] | end_location | Optional end location for the hide animation. |
|
static |
Checks whether a widget is visible to the user, accounting for popups and tabs.
| [in] | widget | The widget to check. |
|
static |
Checks whether a widget is currently visible on any screen.
| [in] | widget | The widget to check. |
|
static |
Returns the global log for the Widgets module.
Referenced by RealSenseServer::updateServer().
|
static |
Multiplies the font size by a given factor.
| [in] | font | The font to modify in-place. |
| [in] | multiplier | The scaling factor to apply to the font size. |
|
static |
Returns the pixel size of a font, converting from point size if necessary.
| [in] | font | The font to query. |
|
static |
Returns the point size of a font, converting from pixel size if necessary.
| [in] | font | The font to query. |
|
static |
Calculates a suitable popup menu location relative to a widget.
| [in] | widget | The anchor widget. |
| [in] | size | The popup menu size. |
|
static |
Calculates a suitable popup menu location relative to a widget with a given origin.
| [in] | widget | The anchor widget. |
| [in] | popup_origin | The origin rectangle for the popup. |
| [in] | size | The popup menu size. |
|
static |
Posts a function to be executed on the thread that owns the target QObject.
| [in] | target | The QObject whose thread will execute the function. |
| [in] | fun | The function to execute. |
|
static |
Posts a function to be executed on the specified thread, or the main thread if none is given.
| [in] | fun | The function to execute. |
| [in] | thread | The target thread, or nullptr for the main UI thread. |
|
static |
Requests the application to exit, optionally relaunching afterward.
| [in] | relaunch | Whether to relaunch the application after exiting. |
| [in] | popup_origin | Optional origin for the confirmation popup. |
|
static |
Requests the screen orientation to be horizontal or vertical.
| [in] | horizontal | True for horizontal (landscape), false for vertical (portrait). |
Requests a specific screen resolution.
| [in] | size | The desired screen resolution in pixels. |
|
static |
Scales a font size so that the given text fits within the specified rectangle.
| [in] | font | The font to modify in-place. |
| [in] | text | The text to fit. |
| [in] | rect | The target rectangle. |
| [in] | shrink | Whether to allow shrinking the font. |
| [in] | grow | Whether to allow growing the font. |
|
static |
Returns the QScreen that contains the given widget.
| [in] | widget | The widget to query. |
|
static |
Recursively restores fonts on a widget and all its children from a buffer.
| [in] | widget | The root widget. |
| [in] | font | The buffer of fonts matching the widget hierarchy. |
|
static |
Recursively sets the font on a widget and all its children.
| [in] | widget | The root widget. |
| [in] | font | The font to apply. |
|
static |
Recursively sets the QStyle on a widget and all its children.
| [in] | widget | The root widget. |
| [in] | style | The style to apply. |
|
static |
Shows a dialog widget with animation and positioning specified by PopupInfo.
| [in] | widget | The dialog widget to show. |
| [in] | info | Popup configuration for display behavior. |
| [in] | end_location | Optional end location for the show animation. |
Referenced by ProgressWidgetDemo::OptionsButton().
|
static |
Shows a dialog informing the user that a feature is experimental.
| [in] | feature | The translated name of the experimental feature. |
|
static |
Shows a message box configured by a GenericOption with an image.
| [in] | options | The generic option configuration. |
| [in] | image | The icon resource to display. |
| [in] | on_select | Callback invoked with the selected option. |
| [in] | popup_origin | Optional origin for popup positioning. |
|
static |
Shows a message box configured by a GenericOption.
| [in] | options | The generic option configuration. |
| [in] | on_select | Callback invoked with the selected option. |
| [in] | popup_origin | Optional origin for popup positioning. |
|
static |
Shows a message box with an image and custom-labeled buttons.
| [in] | title | The dialog title. |
| [in] | image | The icon resource to display. |
| [in] | text | The dialog body text. |
| [in] | button_labels | The translated labels for each button. |
| [in] | on_select | Optional callback invoked with the selected button label. |
| [in] | popup_origin | Optional origin for popup positioning. |
|
static |
Shows a message box with an image and standard buttons.
| [in] | title | The dialog title. |
| [in] | image | The icon resource to display. |
| [in] | text | The dialog body text. |
| [in] | buttons | The standard buttons to display. |
| [in] | on_select | Optional callback invoked with the selected button. |
| [in] | popup_origin | Optional origin for popup positioning. |
|
static |
Shows a message box with custom-labeled buttons.
| [in] | title | The dialog title. |
| [in] | text | The dialog body text. |
| [in] | button_labels | The translated labels for each button. |
| [in] | on_select | Optional callback invoked with the selected button label. |
| [in] | popup_origin | Optional origin for popup positioning. |
|
static |
Shows a message box with standard buttons.
| [in] | title | The dialog title. |
| [in] | text | The dialog body text. |
| [in] | buttons | The standard buttons to display. |
| [in] | on_select | Optional callback invoked with the selected button. |
| [in] | popup_origin | Optional origin for popup positioning. |