SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
smtk
extension
qt
qtInfixExpressionEditor.h
1
//=========================================================================
2
// Copyright (c) Kitware, Inc.
3
// All rights reserved.
4
// See LICENSE.txt for details.
5
//
6
// This software is distributed WITHOUT ANY WARRANTY; without even
7
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8
// PURPOSE. See the above copyright notice for more information.
9
//=========================================================================
10
#ifndef smtk_extension_qtInfixExpressionEditor_h
11
#define smtk_extension_qtInfixExpressionEditor_h
12
13
#include "smtk/extension/qt/Exports.h"
14
#include "smtk/extension/qt/qtAttributeItemInfo.h"
15
#include "smtk/extension/qt/qtInfixExpressionEditorRow.h"
16
#include "smtk/extension/qt/qtItem.h"
17
18
#include "smtk/attribute/Evaluator.h"
19
20
#include <memory>
21
22
#include <QString>
23
24
class
QLineEdit;
25
26
namespace
smtk
27
{
28
namespace
extension
29
{
30
31
class
qtInfixExpressionEditorInternals;
32
33
// A qtItem ItemView for editing infix expressions. qtInfixExpressionEditor
34
// behaves similarly to qtInputsItem except its input is only expected to be
35
// a StringItem, because the user will be creating, modifying, and deleting
36
// infix expressions written as strings.
37
//
38
// Contains one or more qtInfixExpressionEditorRows.
39
class
SMTKQTEXT_EXPORT
qtInfixExpressionEditor
:
public
qtItem
40
{
41
Q_OBJECT
42
43
public
:
44
static
qtItem
* createItemWidget(
const
qtAttributeItemInfo
& info);
45
qtInfixExpressionEditor
(
const
qtAttributeItemInfo
& info);
46
~
qtInfixExpressionEditor
()
override
;
47
48
void
setLabelVisible(
bool
)
override
;
49
bool
isFixedWidth()
const override
;
50
51
public
Q_SLOTS:
52
// Updates the UI elements to reconcile any differences with the underlying
53
// StringItem.
54
void
updateItemData()
override
;
55
// Updates the underlying StringItem with |text| at element |elementIdx|.
56
void
onInputValueChanged(
const
QString& text,
int
elementIdx);
57
58
protected
:
59
void
createWidget()
override
;
60
void
loadInputValues();
61
// Deletes tool buttons and editors when the StringItem is extensible.
62
void
clearChildWidgets();
63
64
// Adds a qtInfixExpressionEditorRow for the StringItem's |i|th value.
65
void
addInputEditor(
int
i);
66
// Refreshes this item's widget and calls loadInputValues().
67
void
updateUI();
68
// Sets the enabled state of remove buttons when the StringItem is extensible
69
// to match the StringItem's min and max number of allowed values.
70
void
updateExtensibleState();
71
72
// Creates a new qtInfixExpressionEditorRow and sets its input line edit's
73
// color.
74
qtInfixExpressionEditorRow
* createInputWidget(
int
elementIdx);
75
76
private
:
77
qtInfixExpressionEditorInternals
* mp_internals;
78
79
private
Q_SLOTS:
80
// Adds a new value to the StringItem and calls addInputEditor().
81
void
onAddNewValue();
82
// Removes the value corresponding to the minus button which sent the signal.
83
// Then calls clearChildWidgets() and loadInputValues().
84
void
onRemoveValue();
85
};
86
87
}
// namespace extension
88
}
// namespace smtk
89
90
#endif // smtk_extension_qtInfixExpressionEditor_h
smtk
The main namespace for the Simulation Modeling Tool Kit (SMTK).
Definition:
doc.h:33
smtk::extension::qtItem
an abstract UI class for attribute item
Definition:
qtItem.h:61
smtk::extension::qtInfixExpressionEditorRow
Definition:
qtInfixExpressionEditorRow.h:34
smtk::extension::qtAttributeItemInfo
Class used to generate widgets for Attribute Items.
Definition:
qtAttributeItemInfo.h:39
smtk::extension::qtInfixExpressionEditor
Definition:
qtInfixExpressionEditor.h:39
smtk::extension::qtInfixExpressionEditorInternals
Definition:
qtInfixExpressionEditor.cxx:42
Generated by
1.8.17