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
07c10d10
Commit
07c10d10
authored
Jun 18, 2013
by
Michael Carpenter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
QuickView selection dialog now sorts items by category and lists them in an easier to read format
parent
3a3085ad
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
11 deletions
+78
-11
UASQuickViewItemSelect.cc
src/ui/uas/UASQuickViewItemSelect.cc
+55
-6
UASQuickViewItemSelect.h
src/ui/uas/UASQuickViewItemSelect.h
+5
-0
UASQuickViewItemSelect.ui
src/ui/uas/UASQuickViewItemSelect.ui
+18
-5
No files found.
src/ui/uas/UASQuickViewItemSelect.cc
View file @
07c10d10
...
...
@@ -6,26 +6,75 @@ UASQuickViewItemSelect::UASQuickViewItemSelect(QWidget *parent) : QWidget(parent
ui
.
setupUi
(
this
);
currcol
=
0
;
currrow
=
0
;
ui
.
gridLayout
->
setSpacing
(
0
);
ui
.
gridLayout
->
setSpacing
(
5
);
ui
.
gridLayout
->
setMargin
(
0
);
}
void
UASQuickViewItemSelect
::
addItem
(
QString
item
,
bool
enabled
)
{
QString
category
=
"."
;
QString
name
=
item
;
if
(
item
.
indexOf
(
":"
)
!=
-
1
&&
item
.
indexOf
(
"."
)
!=
-
1
)
{
//Item has a subcateogry
category
=
item
.
mid
(
item
.
indexOf
(
":"
)
+
1
,
item
.
indexOf
(
"."
)
-
item
.
indexOf
(
":"
)
-
1
);
name
=
item
.
mid
(
item
.
indexOf
(
"."
)
+
1
);
}
int
col
=
-
1
;
if
(
m_categoryToIndexMap
.
contains
(
category
))
{
col
=
m_categoryToIndexMap
[
category
];
}
else
{
m_categoryToIndexMap
[
category
]
=
currcol
++
;
col
=
m_categoryToIndexMap
[
category
];
//New column.
QLabel
*
titlelabel
=
new
QLabel
(
this
);
titlelabel
->
setText
(
category
);
titlelabel
->
show
();
ui
.
gridLayout
->
addWidget
(
titlelabel
,
0
,
col
);
}
QCheckBox
*
label
=
new
QCheckBox
(
this
);
m_checkBoxList
.
append
(
label
);
if
(
enabled
)
{
label
->
setChecked
(
true
);
}
connect
(
label
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
checkBoxClicked
(
bool
)));
label
->
setText
(
item
);
label
->
setText
(
name
);
label
->
show
();
ui
.
gridLayout
->
addWidget
(
label
,
currrow
,
currcol
++
);
if
(
currcol
>
10
)
//ui.gridLayout->addWidget(label,currrow,currcol++);
bool
breakout
=
false
;
int
row
=
-
1
;
while
(
!
breakout
)
{
currcol
=
0
;
currrow
++
;
if
(
!
ui
.
gridLayout
->
itemAtPosition
(
++
row
,
col
)
||
row
>
100
)
{
breakout
=
true
;
}
}
//Row is the next invalid object, and col is the proper column.
ui
.
gridLayout
->
addWidget
(
label
,
row
,
col
);
}
void
UASQuickViewItemSelect
::
resizeEvent
(
QResizeEvent
*
event
)
{
/*for (int i=0;i<m_checkBoxList.size();i++)
{
ui.gridLayout->removeWidget(m_checkBoxList[i]);
}
int row = 0;
int col = 0;
for (int i=0;i<m_checkBoxList.size();i++)
{
ui.gridLayout->addWidget(m_checkBoxList[i],row,col);
col++;
ui.gridLayout->widget()->width() > this->width();
//need to reduce column number.
}*/
}
void
UASQuickViewItemSelect
::
checkBoxClicked
(
bool
checked
)
{
QCheckBox
*
check
=
qobject_cast
<
QCheckBox
*>
(
sender
());
...
...
src/ui/uas/UASQuickViewItemSelect.h
View file @
07c10d10
...
...
@@ -2,6 +2,7 @@
#define UASQUICKVIEWITEMSELECT_H
#include <QWidget>
#include <QCheckBox>
#include "ui_UASQuickViewItemSelect.h"
class
UASQuickViewItemSelect
:
public
QWidget
...
...
@@ -14,7 +15,11 @@ public:
void
addItem
(
QString
item
,
bool
enabled
=
false
);
int
currrow
;
int
currcol
;
protected:
void
resizeEvent
(
QResizeEvent
*
event
);
private:
QMap
<
QString
,
int
>
m_categoryToIndexMap
;
QList
<
QCheckBox
*>
m_checkBoxList
;
Ui
::
UASQuickViewItemSelect
ui
;
private
slots
:
void
checkBoxClicked
(
bool
checked
);
...
...
src/ui/uas/UASQuickViewItemSelect.ui
View file @
07c10d10
...
...
@@ -6,8 +6,8 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
57
1
</width>
<height>
474
</height>
<width>
85
1
</width>
<height>
192
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
...
...
@@ -24,14 +24,27 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
55
1
</width>
<height>
454
</height>
<width>
83
1
</width>
<height>
172
</height>
</rect>
</property>
<layout
class=
"Q
HBoxLayout"
name=
"horizontalLayout
"
>
<layout
class=
"Q
VBoxLayout"
name=
"verticalLayout_2
"
>
<item>
<layout
class=
"QGridLayout"
name=
"gridLayout"
/>
</item>
<item>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
40
</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
...
...
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