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
CGoGN
CGoGN
Commits
f6dc3b6f
Commit
f6dc3b6f
authored
Mar 27, 2015
by
Sylvain Thery
Browse files
smaller growing dialogList
parent
33ff71f2
Changes
3
Hide whitespace changes
Inline
Side-by-side
SCHNApps/include/dialogList.h
View file @
f6dc3b6f
...
...
@@ -26,6 +26,8 @@ public:
virtual
~
ListPopUp
();
virtual
void
show
();
QListWidget
*
list
();
QListWidgetItem
*
addItem
(
const
QString
&
str
,
Qt
::
CheckState
checked
=
Qt
::
Unchecked
);
...
...
SCHNApps/src/controlDock_cameraTab.cpp
View file @
f6dc3b6f
...
...
@@ -67,7 +67,7 @@ void ControlDock_CameraTab::selectedCameraChanged()
void
ControlDock_CameraTab
::
cameraProjectionChanged
(
QAbstractButton
*
b
)
{
if
(
!
b_updatingUI
)
if
(
!
b_updatingUI
&&
m_selectedCamera
)
{
if
(
radio_orthographicProjection
->
isChecked
())
m_selectedCamera
->
setProjectionType
(
qglviewer
::
Camera
::
ORTHOGRAPHIC
);
...
...
SCHNApps/src/dialogList.cpp
View file @
f6dc3b6f
...
...
@@ -8,20 +8,15 @@ namespace CGoGN
namespace
SCHNApps
{
ListPopUp
::
ListPopUp
(
const
QString
&
name
,
QWidget
*
parent
)
:
ListPopUp
::
ListPopUp
(
const
QString
&
name
,
QWidget
*
parent
)
:
QDialog
(
parent
)
{
setWindowTitle
(
name
);
setWindowFlags
(
windowFlags
()
|
Qt
::
FramelessWindowHint
|
Qt
::
WindowStaysOnTopHint
);
setWindowFlags
(
windowFlags
()
|
Qt
::
FramelessWindowHint
|
Qt
::
WindowStaysOnTopHint
|
Qt
::
CustomizeWindowHint
);
m_layout
=
new
QVBoxLayout
(
this
);
setLayout
(
m_layout
);
m_layout
->
setContentsMargins
(
1
,
1
,
1
,
1
);
m_list_items
=
new
QListWidget
();
QSizePolicy
test
;
test
.
setHorizontalPolicy
(
QSizePolicy
::
Preferred
);
m_list_items
->
setSizePolicy
(
test
);
m_list_items
->
setSelectionMode
(
QAbstractItemView
::
NoSelection
);
m_layout
->
addWidget
(
m_list_items
);
}
...
...
@@ -32,7 +27,7 @@ ListPopUp::~ListPopUp()
QSize
ListPopUp
::
sizeHint
()
const
{
return
QSize
(
1
5
0
,
1
5
0
);
return
QSize
(
1
7
0
,
1
0
0
);
}
QListWidget
*
ListPopUp
::
list
()
...
...
@@ -40,11 +35,33 @@ QListWidget* ListPopUp::list()
return
m_list_items
;
}
void
ListPopUp
::
show
()
{
int
rows
=
m_list_items
->
model
()
->
rowCount
();
int
rowSize
=
m_list_items
->
sizeHintForRow
(
0
);
int
height
=
rows
*
rowSize
+
6
;
if
(
height
<
96
)
height
=
96
;
m_list_items
->
setFixedHeight
(
height
);
QDialog
::
show
();
}
QListWidgetItem
*
ListPopUp
::
addItem
(
const
QString
&
str
,
Qt
::
CheckState
checked
)
{
QListWidgetItem
*
item
=
new
QListWidgetItem
(
str
,
m_list_items
);
item
->
setCheckState
(
checked
);
int
rows
=
m_list_items
->
model
()
->
rowCount
();
int
rowSize
=
m_list_items
->
sizeHintForRow
(
0
);
int
height
=
rows
*
rowSize
;
if
(
height
>=
m_list_items
->
size
().
height
())
m_list_items
->
setFixedHeight
(
height
+
6
);
//QFontMetrics fm(m_list_items->font());
//int maxTextWidth = fm.width(item->text());
//if (maxTextWidth < 140)
// maxTextWidth = 140;
//m_list_items->setFixedWidth(maxTextWidth + 40);
return
item
;
}
...
...
@@ -72,6 +89,7 @@ bool ListPopUp::removeItem(const QString& str)
if
(
items
.
empty
())
return
false
;
m_list_items
->
takeItem
(
m_list_items
->
row
(
items
[
0
]));
return
true
;
}
...
...
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