NDEVR
API Documentation
FieldChooser.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: NDEVR
28File: FieldChooser
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/DesignParameter.h>
34#include <NDEVR/TypeInfo.h>
35#include <QWidget>
36namespace Ui
37{
38 class FieldChooserUI;
39}
40namespace NDEVR
41{
42 struct Unit;
46 class FieldChooser : public QWidget
47 {
48 Q_OBJECT
49 public:
54 FieldChooser(QWidget* parent = nullptr);
64 bool allowInt() const;
69 bool allowDecimal() const;
74 bool allowColor() const;
88 void refreshUI();
104 TypeInfo getType() const { return m_type; }
109 void setAllowDefaultValue(bool allow_default);
114 void setAllowCustom(bool allow_custom);
119 void setSpacialUnit(const ConstPointer<Unit> spacial_unit);
124 void setOrientationUnit(const ConstPointer<Unit> spacial_unit);
134 void setExtraContexMenu(QMenu* menu);
135 protected:
152 signals:
156 void accepted();
160 void cleared();
164 void edited();
165 public slots:
169 void onDelete()
170 {
171 emit cleared();
172 }
173
177 {
178 emit accepted();
179 }
180
188 {
189 }
190
210 protected:
213 Ui::FieldChooserUI* ui;
214 bool is_valid;
219 };
220}
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
Provides a constant, unmodifiable pointer that has shared ownership of a dynamically allocated object...
Definition Pointer.hpp:276
A definition of data that is logically stored in the Model hierarchy.
void setAllowDefaultValue(bool allow_default)
Sets whether a default value input is allowed.
bool allowPolarCoordinates() const
Returns whether polar coordinate types are allowed in the chooser.
void edited()
Emitted when the field selection is edited.
void setExtraContexMenu(QMenu *menu)
Sets an extra context menu to be shown with the field chooser.
void stopClearSignalTimer()
Slot to stop the clear signal timer.
void dimensionsEditedSlot()
Slot called when the dimensions selection is edited.
bool allowColor() const
Returns whether color types are allowed in the chooser.
void channelChanged()
Handles a change in the selected channel.
DesignParameter m_ascii_chosen
The currently chosen design parameter.
bool m_allow_custom
Whether custom field definitions are allowed.
void cleared()
Emitted when the field selection is cleared.
void refreshUI()
Refreshes the UI to reflect the current state and options.
void defaultValueEditedSlot()
Slot called when the default value is edited.
void setSelected(DesignParameter param, const TypeInfo &type)
Sets the currently selected parameter and type.
void setOrientationUnit(const ConstPointer< Unit > spacial_unit)
Sets the orientation unit used for angular fields.
bool allowDecimal() const
Returns whether decimal types are allowed in the chooser.
void onAccepted()
Slot that emits the accepted signal when the accept action is triggered.
void setAllowCustom(bool allow_custom)
Sets whether custom field definitions are allowed.
void typeChanged()
Handles a change in the selected type.
void setClearButtonText(const TranslatedString &text)
Sets the text displayed on the clear button.
ConstPointer< Unit > m_orientation_unit
The orientation unit for angular fields.
void onDelete()
Slot that emits the cleared signal when the delete action is triggered.
DesignParameter getOption() const
Returns the currently chosen design parameter.
void setOptions(const Buffer< DesignParameter > &items)
Sets the available design parameter options for the chooser.
FieldChooser(QWidget *parent=nullptr)
Constructs a FieldChooser widget.
void clearButtonClicked()
Slot called when the clear button is clicked.
void dimensionIndexEdited()
Slot called when the dimension index is edited.
void dimensionsChanged()
Handles a change in the selected dimensions.
void channelEditedSlot()
Slot called when the channel selection is edited.
bool allowCartesianCoordinates() const
Returns whether Cartesian coordinate types are allowed in the chooser.
void typeEditedSlot()
Slot called when the type selection is edited.
void accepted()
Emitted when the field selection is accepted.
void setSpacialUnit(const ConstPointer< Unit > spacial_unit)
Sets the spatial unit used for coordinate fields.
TypeInfo m_type
The currently chosen type information.
TypeInfo getType() const
Returns the currently chosen type information.
bool allowInt() const
Returns whether integer types are allowed in the chooser.
void uncheckAll()
Unchecks all options in the chooser.
bool is_valid
Whether the current selection is valid.
Buffer< DesignParameter > m_options
The available design parameter options.
Ui::FieldChooserUI * ui
The UI form for this widget.
ConstPointer< Unit > m_spacial_unit
The spatial unit for coordinate fields.
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
Stores information about a type, relevant for certain templated functions.
Definition TypeInfo.h:43
The primary namespace for the NDEVR SDK.
@ type
The type identifier string for this model node.
Definition Model.h:58
Defines a unit of measurement for converting and displaying data values.
Definition Unit.h:39