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
Utilities
Kate
Commits
f7b82b3e
Commit
f7b82b3e
authored
Oct 10, 2022
by
Waqar Ahmed
Browse files
Diff: Use a QPlainTextEdit to show commit info
QLabel was a mistake
parent
5f703c19
Pipeline
#245093
passed with stage
in 31 minutes and 2 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
apps/lib/diff/diffwidget.cpp
View file @
f7b82b3e
...
...
@@ -9,7 +9,6 @@
#include
<QApplication>
#include
<QHBoxLayout>
#include
<QLabel>
#include
<QMimeDatabase>
#include
<QPainter>
#include
<QPainterPath>
...
...
@@ -30,7 +29,7 @@ DiffWidget::DiffWidget(DiffParams p, QWidget *parent)
:
QWidget
(
parent
)
,
m_left
(
new
DiffEditor
(
p
.
flags
,
this
))
,
m_right
(
new
DiffEditor
(
p
.
flags
,
this
))
,
m_commitInfo
(
new
Q
Label
(
this
))
,
m_commitInfo
(
new
Q
PlainTextEdit
(
this
))
,
m_params
(
p
)
{
auto
layout
=
new
QVBoxLayout
(
this
);
...
...
@@ -60,10 +59,12 @@ DiffWidget::DiffWidget(DiffParams p, QWidget *parent)
}
m_commitInfo
->
hide
();
m_commitInfo
->
setWordWrap
(
true
);
m_commitInfo
->
setWordWrap
Mode
(
QTextOption
::
WordWrap
);
m_commitInfo
->
setFont
(
Utils
::
editorFont
());
m_commitInfo
->
setReadOnly
(
true
);
m_commitInfo
->
setTextInteractionFlags
(
Qt
::
TextSelectableByMouse
);
m_commitInfo
->
setFrameStyle
(
QFrame
::
StyledPanel
|
QFrame
::
Sunken
);
m_commitInfo
->
setMaximumHeight
(
250
);
KSharedConfig
::
Ptr
config
=
KSharedConfig
::
openConfig
();
KConfigGroup
cgGeneral
=
KConfigGroup
(
config
,
"General"
);
...
...
@@ -799,7 +800,7 @@ static QString commitInfoFromDiff(const QByteArray &raw)
void
DiffWidget
::
openDiff
(
const
QByteArray
&
raw
)
{
if
((
m_params
.
flags
&
DiffParams
::
ShowCommitInfo
)
&&
m_style
!=
DiffStyle
::
Raw
)
{
m_commitInfo
->
setText
(
commitInfoFromDiff
(
raw
));
m_commitInfo
->
set
Plain
Text
(
commitInfoFromDiff
(
raw
));
m_commitInfo
->
show
();
}
else
{
m_commitInfo
->
hide
();
...
...
apps/lib/diff/diffwidget.h
View file @
f7b82b3e
...
...
@@ -63,7 +63,7 @@ private:
class
DiffEditor
*
m_left
;
class
DiffEditor
*
m_right
;
class
Q
Label
*
const
m_commitInfo
;
class
Q
PlainTextEdit
*
const
m_commitInfo
;
KSyntaxHighlighting
::
AbstractHighlighter
*
leftHl
;
KSyntaxHighlighting
::
AbstractHighlighter
*
rightHl
;
DiffStyle
m_style
=
SideBySide
;
...
...
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