API Documentation
Loading...
Searching...
No Matches
UnitsDialog.h
Go to the documentation of this file.
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: UnitsDialog
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/Unit.h>
35#include <NDEVR/Pointer.h>
36#include <QWidget>
37namespace Ui
38{
39 class UnitsDialogUI;
40}
41namespace NDEVR
42{
43 class UnitManager;
44 class UnitOption;
45 class CustomUnit;
46 class QCustomComboBox;
47 class QTResourceListener;
48 /**--------------------------------------------------------------------------------------------------
49 \brief A dialog which can be used to set various units for different unit categories, such as selecting
50 the various properties by which to show angles.
51 **/
52 class NDEVR_WIDGETS_API UnitsDialog : public QWidget
53 {
54 Q_OBJECT
55 public:
56 UnitsDialog(QWidget* parent = nullptr);
57 UnitsDialog(UnitManager* manager, QWidget* parent = nullptr);
58 void setManager(UnitManager* manager);
59 void setAutosize(bool auto_size);
60 void setAllowSubUnit(bool allow_sub_unit);
69 signals:
70 void edited();
71 protected:
73 void setupCombo(UnitCategory type, QCustomComboBox* combo, QCustomComboBox* subcombo = nullptr);
74 void setupCombo(const Buffer<ConstPointer<UnitOption>>& options, const ConstPointer<Unit>& unit, QCustomComboBox* combo, QCustomComboBox* subcombo);
77 ConstPointer<Unit> selectedUnit(const Buffer<ConstPointer<UnitOption>>& options, const ConstPointer<Unit>& reference_unit, QCustomComboBox* combo, QCustomComboBox* subcombo = nullptr);
78 void setSelectedUnit(UnitCategory type, QCustomComboBox* combo, QCustomComboBox* subcombo = nullptr);
79 void initialize();
80 bool event(QEvent* event) override;
82 void setup();
85 protected slots:
91 protected:
95 bool m_update_posted = false;
96 Ui::UnitsDialogUI* ui;
97 };
98}
#define NDEVR_WIDGETS_API
Definition DLLInfo.h:59
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
Provides a constant, unmodifiable pointer that has shared ownership of a dynamically allocated object...
Definition GraphicsPipeline.h:42
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
Definition Pointer.hpp:320
A compact way to present a list of options to the user.
Definition QCustomCombobox.h:53
Definition QTTools.h:168
Handles a grouping of units that can describe any number of data categories.
Definition UnitManager.h:143
A dialog which can be used to set various units for different unit categories, such as selecting the ...
Definition UnitsDialog.h:53
Ui::UnitsDialogUI * ui
Definition UnitsDialog.h:96
ConstPointer< Unit > selectedUnit(const Buffer< ConstPointer< UnitOption > > &options, const ConstPointer< Unit > &reference_unit, QCustomComboBox *combo, QCustomComboBox *subcombo=nullptr)
void setupCombo(UnitCategory type, QCustomComboBox *combo, QCustomComboBox *subcombo=nullptr)
void setAutosize(bool auto_size)
void setManager(UnitManager *manager)
void setAllowSubUnit(bool allow_sub_unit)
UnitManager * m_manager
Definition UnitsDialog.h:92
bool event(QEvent *event) override
void updateSurfaceAreaUnitFromUISlot()
void updateWeightUnitFromUISlot()
ConstPointer< Unit > selectedUnit(UnitCategory type, QCustomComboBox *combo, QCustomComboBox *subcombo=nullptr)
void setSelectedUnit(UnitCategory type, QCustomComboBox *combo, QCustomComboBox *subcombo=nullptr)
ConstPointer< UnitOption > setupCombo(const Buffer< ConstPointer< UnitOption > > &options, const ConstPointer< Unit > &unit, QCustomComboBox *combo)
UnitsDialog(UnitManager *manager, QWidget *parent=nullptr)
void setupCombo(const Buffer< ConstPointer< UnitOption > > &options, const ConstPointer< Unit > &unit, QCustomComboBox *combo, QCustomComboBox *subcombo)
UnitsDialog(QWidget *parent=nullptr)
void updateVolumeUnitFromUISlot()
QWidget * extraUnitWidget(DynamicPointer< CustomUnit > custom_unit)
void updateOrientationUnitFromUISlot()
void updateSpacialUnitFromUISlot()
bool m_allow_sub_unit
Definition UnitsDialog.h:94
void updateComboContents()
QTResourceListener * m_resource_listener
Definition UnitsDialog.h:93
void hideSurfaceVolumeUnit()
void resetToDefaultUnits()
Definition ACIColor.h:37
UnitCategory
A category of unit describing what it relates to. Any category can have some number of units defined ...
Definition Unit.h:14
Definition FontEditor.h:6