Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Frédéric Larue
CommonGUI
Commits
68f3a56d
Commit
68f3a56d
authored
Oct 03, 2018
by
Frédéric Larue
Browse files
SetData() function added to UIParamChoice and UIParamList.
parent
d89db52b
Changes
4
Hide whitespace changes
Inline
Side-by-side
UIParam/UIParamChoice.cpp
View file @
68f3a56d
...
...
@@ -64,6 +64,17 @@ void UIParamChoice::SetValue( const QString& value )
}
void
UIParamChoice
::
SetData
(
int
d
)
{
for
(
auto
b
=
m_ButtonDataMapping
.
begin
();
b
!=
m_ButtonDataMapping
.
end
();
++
b
)
if
(
b
.
value
()
==
d
)
{
b
.
key
()
->
setChecked
(
true
);
break
;
}
}
void
UIParamChoice
::
changeCurrentChoice
(
bool
toggled
)
{
if
(
toggled
)
...
...
UIParam/UIParamChoice.h
View file @
68f3a56d
...
...
@@ -32,6 +32,8 @@ public:
void
SetValue
(
const
QString
&
value
);
inline
QString
Value
()
const
{
return
m_CurrentChoice
->
text
();
}
void
SetData
(
int
d
);
inline
int
Data
()
const
{
return
m_ButtonDataMapping
[
m_CurrentChoice
];
}
inline
const
QWidget
*
Widget
()
const
{
return
m_Widget
;
}
...
...
UIParam/UIParamList.cpp
View file @
68f3a56d
...
...
@@ -44,6 +44,17 @@ void UIParamList::SetValue( const QString& value )
}
void
UIParamList
::
SetData
(
int
d
)
{
for
(
int
i
=
0
;
i
<
Widget
()
->
count
();
++
i
)
if
(
Widget
()
->
itemData
(
i
).
value
<
int
>
()
==
d
)
{
Widget
()
->
setCurrentIndex
(
i
);
break
;
}
}
void
UIParamList
::
triggerValueChanged
(
int
index
)
{
emit
valueChanged
(
Widget
()
->
itemText
(
index
)
);
...
...
UIParam/UIParamList.h
View file @
68f3a56d
...
...
@@ -27,8 +27,10 @@ public:
const
QList
<
int
>&
data
=
QList
<
int
>
()
);
void
SetValue
(
const
QString
&
value
);
inline
QString
Value
()
const
{
return
((
QComboBox
*
)
m_Widget
)
->
currentText
();
}
inline
int
Data
()
const
{
return
((
QComboBox
*
)
m_Widget
)
->
itemData
(
((
QComboBox
*
)
m_Widget
)
->
currentIndex
()
).
value
<
int
>
();
}
inline
QString
Value
()
const
{
return
Widget
()
->
currentText
();
}
void
SetData
(
int
d
);
inline
int
Data
()
const
{
return
Widget
()
->
itemData
(
Widget
()
->
currentIndex
()
).
value
<
int
>
();
}
inline
const
QComboBox
*
Widget
()
const
{
return
(
QComboBox
*
)
m_Widget
;
}
inline
QComboBox
*
Widget
()
{
return
(
QComboBox
*
)
m_Widget
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment