Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Kate
Commits
2156666e
Commit
2156666e
authored
Feb 09, 2021
by
Waqar Ahmed
Browse files
Fix command-bar unable to show shortcuts with '+'
parent
c60c3ede
Changes
1
Hide whitespace changes
Inline
Side-by-side
kate/katecommandbar.cpp
View file @
2156666e
...
...
@@ -172,12 +172,21 @@ public:
if
(
!
shortcutString
.
isEmpty
())
{
// collect rects for each word
QVector
<
QPair
<
QRect
,
QString
>>
btns
;
const
auto
list
=
shortcutString
.
split
(
QLatin1Char
(
'+'
));
const
auto
list
=
[
&
shortcutString
]
{
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
auto
list
=
shortcutString
.
split
(
QLatin1Char
(
'+'
),
QString
::
SkipEmptyParts
);
#else
auto
list
=
shortcutString
.
split
(
QLatin1Char
(
'+'
),
Qt
::
SkipEmptyParts
);
#endif
if
(
shortcutString
.
endsWith
(
QLatin1String
(
"+"
)))
{
list
.
append
(
QStringLiteral
(
"+"
));
}
return
list
;
}();
btns
.
reserve
(
list
.
size
());
for
(
const
QString
&
text
:
list
)
{
QRect
r
=
option
.
fontMetrics
.
boundingRect
(
text
);
r
.
setWidth
(
r
.
width
()
+
8
);
r
.
setHeight
(
r
.
height
()
+
4
);
btns
.
append
({
r
,
text
});
}
...
...
@@ -188,6 +197,10 @@ public:
const
int
y
=
option
.
rect
.
y
();
const
int
plusY
=
option
.
rect
.
y
()
+
plusRect
.
height
()
/
2
;
const
int
total
=
btns
.
size
();
// make sure our rects are nicely V-center aligned in the row
painter
->
translate
(
QPoint
(
0
,
(
option
.
rect
.
height
()
-
btns
.
at
(
0
).
first
.
height
())
/
2
));
int
i
=
0
;
painter
->
setRenderHint
(
QPainter
::
Antialiasing
);
for
(
const
auto
&
btn
:
btns
)
{
...
...
@@ -211,9 +224,9 @@ public:
// draw '+'
if
(
i
+
1
<
total
)
{
x
+=
rect
.
width
()
+
8
;
x
+=
rect
.
width
()
+
5
;
painter
->
drawText
(
QPoint
(
x
,
plusY
+
(
rect
.
height
()
/
2
)),
QStringLiteral
(
"+"
));
x
+=
plusRect
.
width
()
+
8
;
x
+=
plusRect
.
width
()
+
5
;
}
i
++
;
}
...
...
Halla Rempt
@rempt
mentioned in commit
graphics/krita@b7ee108d
·
Feb 09, 2021
mentioned in commit
graphics/krita@b7ee108d
mentioned in commit graphics/krita@b7ee108d12c331b458b92b317d0f4d090249e338
Toggle commit list
Write
Preview
Supports
Markdown
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