Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
1bd6a3e6
Commit
1bd6a3e6
authored
Jul 11, 2013
by
Michael Carpenter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added forgotten ParamWidget
parent
d7def6d4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
191 additions
and
0 deletions
+191
-0
ParamWidget.cc
src/ui/configuration/ParamWidget.cc
+79
-0
ParamWidget.h
src/ui/configuration/ParamWidget.h
+34
-0
ParamWidget.ui
src/ui/configuration/ParamWidget.ui
+78
-0
No files found.
src/ui/configuration/ParamWidget.cc
0 → 100644
View file @
1bd6a3e6
#include "ParamWidget.h"
ParamWidget
::
ParamWidget
(
QWidget
*
parent
)
:
QWidget
(
parent
)
{
ui
.
setupUi
(
this
);
}
ParamWidget
::~
ParamWidget
()
{
}
void
ParamWidget
::
setupInt
(
QString
title
,
QString
description
,
int
value
,
int
min
,
int
max
)
{
type
=
INT
;
ui
.
titleLabel
->
setText
(
"<h3>"
+
title
+
"</h3>"
);
ui
.
descriptionLabel
->
setText
(
description
);
ui
.
valueComboBox
->
hide
();
ui
.
valueSlider
->
show
();
ui
.
intSpinBox
->
show
();
ui
.
doubleSpinBox
->
hide
();
m_min
=
min
;
m_max
=
max
;
}
void
ParamWidget
::
setupDouble
(
QString
title
,
QString
description
,
double
value
,
double
min
,
double
max
)
{
type
=
DOUBLE
;
ui
.
titleLabel
->
setText
(
"<h3>"
+
title
+
"</h3>"
);
ui
.
descriptionLabel
->
setText
(
description
);
ui
.
valueComboBox
->
hide
();
ui
.
valueSlider
->
show
();
ui
.
intSpinBox
->
hide
();
ui
.
doubleSpinBox
->
show
();
m_min
=
min
;
m_max
=
max
;
}
void
ParamWidget
::
setupCombo
(
QString
title
,
QString
description
,
QList
<
QPair
<
int
,
QString
>
>
list
)
{
type
=
COMBO
;
ui
.
titleLabel
->
setText
(
"<h3>"
+
title
+
"</h3>"
);
ui
.
descriptionLabel
->
setText
(
description
);
ui
.
valueComboBox
->
show
();
ui
.
valueSlider
->
hide
();
ui
.
intSpinBox
->
hide
();
ui
.
doubleSpinBox
->
hide
();
m_valueList
=
list
;
ui
.
valueComboBox
->
clear
();
for
(
int
i
=
0
;
i
<
m_valueList
.
size
();
i
++
)
{
ui
.
valueComboBox
->
addItem
(
m_valueList
[
i
].
second
);
}
}
void
ParamWidget
::
setValue
(
double
value
)
{
if
(
type
==
INT
)
{
ui
.
intSpinBox
->
setValue
(
value
);
ui
.
valueSlider
->
setValue
(((
value
+
m_min
)
/
(
m_max
+
m_min
))
*
100.0
);
}
else
if
(
type
==
DOUBLE
)
{
ui
.
doubleSpinBox
->
setValue
(
value
);
ui
.
valueSlider
->
setValue
(((
value
+
m_min
)
/
(
m_max
+
m_min
))
*
100.0
);
}
else
if
(
type
==
COMBO
)
{
for
(
int
i
=
0
;
i
<
m_valueList
.
size
();
i
++
)
{
if
((
int
)
value
==
m_valueList
[
i
].
first
)
{
ui
.
valueComboBox
->
setCurrentIndex
(
i
);
return
;
}
}
}
}
src/ui/configuration/ParamWidget.h
0 → 100644
View file @
1bd6a3e6
#ifndef PARAMWIDGET_H
#define PARAMWIDGET_H
#include <QWidget>
#include "ui_ParamWidget.h"
class
ParamWidget
:
public
QWidget
{
Q_OBJECT
public:
explicit
ParamWidget
(
QWidget
*
parent
=
0
);
~
ParamWidget
();
void
setupInt
(
QString
title
,
QString
description
,
int
value
,
int
min
,
int
max
);
void
setupDouble
(
QString
title
,
QString
description
,
double
value
,
double
min
,
double
max
);
void
setupCombo
(
QString
title
,
QString
description
,
QList
<
QPair
<
int
,
QString
>
>
list
);
void
setValue
(
double
value
);
private:
enum
VIEWTYPE
{
INT
,
DOUBLE
,
COMBO
};
double
m_min
;
double
m_max
;
double
m_dvalue
;
int
m_ivalue
;
VIEWTYPE
type
;
QList
<
QPair
<
int
,
QString
>
>
m_valueList
;
Ui
::
ParamWidget
ui
;
};
#endif // PARAMWIDGET_H
src/ui/configuration/ParamWidget.ui
0 → 100644
View file @
1bd6a3e6
<?xml version="1.0" encoding="UTF-8"?>
<ui
version=
"4.0"
>
<class>
ParamWidget
</class>
<widget
class=
"QWidget"
name=
"ParamWidget"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
619
</width>
<height>
207
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Form
</string>
</property>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_2"
>
<item>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
>
<item>
<widget
class=
"QLabel"
name=
"titleLabel"
>
<property
name=
"text"
>
<string>
TextLabel
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QLabel"
name=
"descriptionLabel"
>
<property
name=
"text"
>
<string>
TextLabel
</string>
</property>
<property
name=
"wordWrap"
>
<bool>
true
</bool>
</property>
</widget>
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
>
<item>
<widget
class=
"QSpinBox"
name=
"intSpinBox"
/>
</item>
<item>
<widget
class=
"QDoubleSpinBox"
name=
"doubleSpinBox"
/>
</item>
<item>
<widget
class=
"QSlider"
name=
"valueSlider"
>
<property
name=
"maximum"
>
<number>
100
</number>
</property>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
</widget>
</item>
<item>
<widget
class=
"QComboBox"
name=
"valueComboBox"
/>
</item>
</layout>
</item>
</layout>
</item>
<item>
<spacer
name=
"horizontalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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