Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
adb186a4
Commit
adb186a4
authored
1 year ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
ListItemDelegate: + assert; simplify
parent
563c52dc
No related branches found
No related tags found
1 merge request
!2362
rename fcts, ..., to prepare for simplification of InstrumentsSet
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
GUI/View/Widget/ListItemDelegate.cpp
+7
-10
7 additions, 10 deletions
GUI/View/Widget/ListItemDelegate.cpp
with
7 additions
and
10 deletions
GUI/View/Widget/ListItemDelegate.cpp
+
7
−
10
View file @
adb186a4
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
// ************************************************************************************************
// ************************************************************************************************
#include
"GUI/View/Widget/ListItemDelegate.h"
#include
"GUI/View/Widget/ListItemDelegate.h"
#include
"Base/Util/Assert.h"
#include
<QPainter>
#include
<QPainter>
#include
<QTextDocument>
#include
<QTextDocument>
...
@@ -52,19 +53,15 @@ void ListItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& opti
...
@@ -52,19 +53,15 @@ void ListItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& opti
QSize
ListItemDelegate
::
sizeHint
(
const
QStyleOptionViewItem
&
option
,
const
QModelIndex
&
index
)
const
QSize
ListItemDelegate
::
sizeHint
(
const
QStyleOptionViewItem
&
option
,
const
QModelIndex
&
index
)
const
{
{
QSize
s
=
QStyledItemDelegate
::
sizeHint
(
option
,
index
);
ASSERT
(
index
.
isValid
());
int
h
=
QStyledItemDelegate
::
sizeHint
(
option
,
index
).
height
();
// get size of parent; this is the minimum size
const
int
h
=
QStyledItemDelegate
::
sizeHint
(
option
,
index
).
height
();
s
.
setHeight
(
std
::
max
(
s
.
height
(),
h
));
QStyleOptionViewItem
options
=
option
;
QStyleOptionViewItem
options
=
option
;
initStyleOption
(
&
options
,
index
);
initStyleOption
(
&
options
,
index
);
auto
s2
=
mySizeHint
(
options
.
text
);
auto
s2
=
mySizeHint
(
options
.
text
);
s
.
setHeight
(
std
::
max
(
s
.
height
(),
s2
.
height
()
+
10
));
s
.
setHeight
(
std
::
max
(
s
.
height
(),
32
));
s
.
setWidth
(
s2
.
width
()
+
h
);
// +h: icon
return
s
;
h
=
std
::
max
(
h
,
32
);
h
=
std
::
max
(
h
,
s2
.
height
()
+
10
);
return
{
s2
.
width
()
+
h
,
h
};
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment