NDEVR
API Documentation
QCustomTextEdit.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: QCustomTextEdit
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <QTextEdit>
35#include <NDEVR/String.h>
36#include <NDEVR/TranslatedString.h>
37namespace NDEVR
38{
39 class TranslatedString;
41 template<class t_type>
42 class Resource;
43 struct GenericOption;
48 class NDEVR_WIDGETS_API QCustomTextEdit : public QTextEdit
49 {
50 Q_OBJECT
51 public:
56 QCustomTextEdit(QWidget* parent = nullptr);
57 virtual ~QCustomTextEdit();
62 virtual void mousePressEvent(QMouseEvent* e) override;
67 virtual void focusInEvent(QFocusEvent* e) override;
77 QSize sizeHint() const override;
82 QSize minimumSizeHint() const override;
87 void setEditable(bool is_editable);
92 void setValue(const String& text);
97 void setTitle(const TranslatedString& title);
102 void setup(GenericOption& option);
107 void setHeightMultiplier(fltp04 multiplier);
113 void setup(const TranslatedString& title, Resource<String>& value);
118 void keyPressEvent(QKeyEvent* e) override;
119 protected:
125 bool event(QEvent* event) override;
130 signals:
143 protected:
147 };
148}
void inputHintChangedSignal()
Signal emitted when the input hint changes due to focus or content changes.
String getValue() const
Returns the current text content as an NDEVR String.
void keyPressEvent(QKeyEvent *e) override
Handles key press events, including special handling for Enter/Return keys.
void editingFinishedSignal()
Signal emitted when the user finishes editing (focus lost or Enter pressed).
void setEditable(bool is_editable)
Sets whether the text edit is editable by the user.
TranslatedString m_title
The title text used as a placeholder label.
void setValue(const String &text)
Sets the text content of the text edit.
QSize minimumSizeHint() const override
Returns the minimum recommended size for the text edit.
QCustomTextEdit(QWidget *parent=nullptr)
Constructs a multi-line text edit widget.
QTResourceListener * m_resource_changed_listener
Listener for external resource changes to update the text.
void setHeightMultiplier(fltp04 multiplier)
Sets a multiplier for the height component of the size hint.
virtual void focusInEvent(QFocusEvent *e) override
Handles focus-in events to update placeholder and input hint state.
fltp04 m_height_hint_multiplier
Multiplier applied to the height component of size hints.
void editedSignal()
Signal emitted when the user edits the text content.
bool event(QEvent *event) override
Handles general events including tooltip and palette change events.
virtual void mousePressEvent(QMouseEvent *e) override
Handles mouse press events for touch-friendly interaction.
void setTitle(const TranslatedString &title)
Sets the title used as a placeholder or label for the text edit.
void setup(GenericOption &option)
Sets up the text edit from a GenericOption, binding the value and title.
void onUserEditedCore()
Processes user edits, emitting signals and updating bound resources.
void setup(const TranslatedString &title, Resource< String > &value)
Sets up the text edit with a title and two-way binding to a string resource.
QSize sizeHint() const override
Returns the recommended size for the text edit.
A ResourceListener which will always be executed on the main UI thread and can be tied to a Qt Object...
Definition QTTools.h:493
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...
Stores a generic option of any type as well as some information about how the user might interact wit...