NDEVR
API Documentation
QCustomLabel.h
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Widgets
28File: VerticalLabel
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/BaseValues.h>
35#include <NDEVR/Resource.h>
36#include <NDEVR/TranslatedString.h>
37#include <QLabel>
38namespace NDEVR
39{
40 class String;
46 class NDEVR_WIDGETS_API QCustomLabel : public QLabel
47 {
48 public:
58
62 QCustomLabel(QWidget* parent = nullptr);
68 QCustomLabel(const TranslatedString& text, QWidget* parent = nullptr);
74 QCustomLabel(const QString& text, QWidget* parent = nullptr);
84 void paintEvent(QPaintEvent* e) override;
89 QSize minimumSizeHint() const override;
94 QSize sizeHint() const override;
99 void setVertical(bool vertical);
104 void setFlipped(bool flipped);
109 void setFontMultiplier(fltp04 font_multiplier);
114 void setBold(bool is_bold);
124 void setText(const QString& text);
129 void setText(const char* text);
134 void setText(const String& text);
139 void setLabelTheme(Theme theme);
145 bool event(QEvent* event) override;
148 protected:
152 void init();
157 protected:
161 bool m_is_vertical = false;
162 bool m_is_flipped = false;
163 bool m_is_bold = false;
164 };
165}
fltp04 m_font_multiplier
The current font size multiplier.
TranslatedString m_translated_text
The stored translated text.
Theme
Options for how to display the label.
@ e_header_a
For titles: standard foreground color with bold font.
@ e_label_a
Default label style: uses highlight color.
@ e_label_b
Alternative label style: standard foreground color.
bool event(QEvent *event) override
Handles generic events such as theme and font changes.
QCustomLabel(const TranslatedString &text, QWidget *parent=nullptr)
Constructs a QCustomLabel with translated text and the given parent widget.
void setBold(bool is_bold)
Sets whether the label text is rendered in bold.
QSize minimumSizeHint() const override
Returns the minimum size hint, accounting for vertical orientation.
bool m_is_flipped
Whether the text is rendered upside-down.
void setFontMultiplier(fltp04 font_multiplier)
Sets a multiplier applied to the base font size.
bool m_is_bold
Whether the text is rendered in bold.
void init()
Initializes the label with default settings.
void setText(const char *text)
Sets the label text from a C-string.
QCustomLabel(QWidget *parent=nullptr)
Constructs a QCustomLabel with the given parent widget.
Theme m_theme
The current visual theme.
void setFlipped(bool flipped)
Sets whether the label text is rendered upside-down (flipped 180 degrees).
bool m_is_vertical
Whether the text is rendered vertically.
QSize sizeHint() const override
Returns the recommended size, accounting for vertical orientation.
void setLabelTheme(Theme theme)
Sets the visual theme of the label.
void setVertical(bool vertical)
Sets whether the label text is rendered vertically.
void setText(const String &text)
Sets the label text from an NDEVR String.
TranslatedString text() const
Returns the current label text as a TranslatedString.
static Resource< fltp08 > default_multiplier_touch
Default font multiplier for touch mode.
void setText(const QString &text)
Sets the label text from a QString.
void paintEvent(QPaintEvent *e) override
Custom paint event that handles vertical and flipped text rendering.
static Resource< fltp08 > default_multiplier_desktop
Default font multiplier for desktop mode.
QCustomLabel(const QString &text, QWidget *parent=nullptr)
Constructs a QCustomLabel with a QString and the given parent widget.
void setText(const TranslatedString &text)
Sets the label text from a TranslatedString.
void updateFont()
Updates the font based on the current multiplier, bold, and theme settings.
A core part of the engine, stores variables that can be listened to with ResourceListener which will ...
Definition Resource.h:42
The core String class for the NDEVR API.
Definition String.h:95
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
The primary namespace for the NDEVR SDK.
float fltp04
Defines an alias representing a 4 byte floating-point number Bit layout is as follows: -Sign: 1 bit a...