Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CAMP
campvis-public
Commits
4e793774
Commit
4e793774
authored
Aug 16, 2013
by
Christian Schulte zu Berge
Browse files
Merge branch 'issue99' of /mnt/bigone/git/repositories/berge/campvis into development
parents
97a051c5
e28d6127
Changes
2
Hide whitespace changes
Inline
Side-by-side
application/gui/properties/datanamepropertywidget.cpp
View file @
4e793774
...
...
@@ -53,14 +53,9 @@ namespace campvis {
_combobox
->
addItems
(
sl
);
dc
->
s_dataAdded
.
connect
(
this
,
&
DataNamePropertyWidget
::
onDataAdded
);
int
idx
=
_combobox
->
findText
(
QString
::
fromStdString
(
property
->
getValue
()));
if
(
idx
!=
-
1
)
_combobox
->
setCurrentIndex
(
idx
);
else
_combobox
->
setEditText
(
QString
::
fromStdString
(
property
->
getValue
()));
setCurrentComboBoxText
(
QString
::
fromStdString
(
property
->
getValue
()));
}
addWidget
(
_combobox
);
connect
(
_combobox
,
SIGNAL
(
editTextChanged
(
const
QString
&
)),
this
,
SLOT
(
onTextChanged
(
const
QString
&
)));
}
...
...
@@ -80,13 +75,28 @@ namespace campvis {
void
DataNamePropertyWidget
::
updateWidgetFromProperty
()
{
DataNameProperty
*
prop
=
static_cast
<
DataNameProperty
*>
(
_property
);
QString
qs
=
QString
::
fromStdString
(
prop
->
getValue
());
if
(
_lineEdit
->
text
()
!=
qs
)
{
if
(
prop
->
getAccessInfo
()
==
DataNameProperty
::
READ
)
{
_combobox
->
blockSignals
(
true
);
setCurrentComboBoxText
(
qs
);
_combobox
->
blockSignals
(
false
);
}
else
if
(
_lineEdit
->
text
()
!=
qs
)
{
_lineEdit
->
blockSignals
(
true
);
_lineEdit
->
setText
(
qs
);
_lineEdit
->
blockSignals
(
false
);
}
}
void
DataNamePropertyWidget
::
setCurrentComboBoxText
(
const
QString
&
text
)
{
int
idx
=
_combobox
->
findText
(
text
);
if
(
idx
!=
-
1
)
_combobox
->
setCurrentIndex
(
idx
);
else
_combobox
->
setEditText
(
text
);
}
void
DataNamePropertyWidget
::
onTextChanged
(
const
QString
&
text
)
{
DataNameProperty
*
prop
=
static_cast
<
DataNameProperty
*>
(
_property
);
++
_ignorePropertyUpdates
;
...
...
@@ -101,4 +111,4 @@ namespace campvis {
}
}
\ No newline at end of file
}
application/gui/properties/datanamepropertywidget.h
View file @
4e793774
...
...
@@ -45,7 +45,7 @@ namespace campvis {
* Widget for a DataNameProperty
*/
class
DataNamePropertyWidget
:
public
AbstractPropertyWidget
{
Q_OBJECT
;
Q_OBJECT
public:
/**
...
...
@@ -72,6 +72,16 @@ namespace campvis {
void
onTextChanged
(
const
QString
&
text
);
private:
/**
* Set the combo box's current text to the provided value.
*
* If \c text can already be found in the combo box, the corresponding item is made active. Otherwise, \c text
* is set as the contents of the combo box's text edit.
*
* \param text text to be set in the combo box
*/
void
setCurrentComboBoxText
(
const
QString
&
text
);
QLineEdit
*
_lineEdit
;
QComboBox
*
_combobox
;
DataContainer
*
_dc
;
...
...
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