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
Multimedia
Kdenlive
Commits
7f8a64a5
Commit
7f8a64a5
authored
Feb 07, 2020
by
Jean-Baptiste Mardelle
Browse files
Improve rating painting and selection
parent
abf6f895
Pipeline
#14631
passed with stage
in 15 minutes and 41 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/bin/bin.cpp
View file @
7f8a64a5
...
...
@@ -114,17 +114,14 @@ public:
dragType
=
PlaylistState
::
Disabled
;
if
(
index
.
column
()
==
7
)
{
// Rating
uint
rate
=
(
uint
)
(
10
*
(
me
->
pos
().
x
()
-
option
.
rect
.
x
())
/
option
.
rect
.
width
());
switch
(
rate
)
{
case
0
:
case
1
:
rate
*=
2
;
break
;
default:
rate
=
2
+
2
*
(
rate
/
2
);
break
;
int
rate
=
KRatingPainter
::
getRatingFromPosition
(
option
.
rect
,
Qt
::
AlignCenter
,
qApp
->
layoutDirection
(),
me
->
pos
());
if
(
rate
>
-
1
)
{
// Full star rating only
if
(
rate
%
2
==
1
)
{
rate
++
;
}
static_cast
<
ProjectSortProxyModel
*>
(
model
)
->
updateRating
(
index
,
(
uint
)
rate
);
}
static_cast
<
ProjectSortProxyModel
*>
(
model
)
->
updateRating
(
index
,
rate
);
}
}
}
...
...
@@ -333,11 +330,11 @@ public:
QStyleOptionViewItem
opt
(
option
);
initStyleOption
(
&
opt
,
index
);
QRect
r1
=
opt
.
rect
;
// Tweak bg opacity since breeze dark star has same color as highlighted background
painter
->
setOpacity
(
0.5
);
QStyle
*
style
=
opt
.
widget
?
opt
.
widget
->
style
()
:
QApplication
::
style
();
style
->
drawPrimitive
(
QStyle
::
PE_PanelItemViewItem
,
&
opt
,
painter
,
opt
.
widget
);
if
((
option
.
state
&
static_cast
<
int
>
(
QStyle
::
State_Selected
))
!=
0
)
{
painter
->
setPen
(
option
.
palette
.
highlightedText
().
color
());
}
painter
->
setOpacity
(
1
);
if
(
index
.
data
(
AbstractProjectItem
::
ItemTypeRole
).
toInt
()
!=
AbstractProjectItem
::
FolderItem
)
{
KRatingPainter
::
paintRating
(
painter
,
r1
,
Qt
::
AlignCenter
,
index
.
data
().
toInt
());
}
...
...
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