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
PIM
KPimTextEdit
Commits
07ed743c
Commit
07ed743c
authored
Apr 06, 2022
by
Laurent Montel
😁
Browse files
Make sure to update link color when theme changed
parent
b53b906f
Pipeline
#160297
passed with stages
in 8 minutes and 2 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/composer-ng/richtextcomposercontroler.cpp
View file @
07ed743c
...
...
@@ -48,12 +48,18 @@ public:
delete
nestedListHelper
;
}
void
regenerateColorScheme
()
{
mLinkColor
=
KColorScheme
(
QPalette
::
Active
,
KColorScheme
::
View
).
foreground
(
KColorScheme
::
LinkText
).
color
();
// TODO update existing link
}
QColor
linkColor
()
{
if
(
mLinkColor
.
isValid
())
{
return
mLinkColor
;
}
mLinkColor
=
KColorScheme
(
QPalette
::
Active
,
KColorScheme
::
View
).
foreground
(
KColorScheme
::
LinkText
).
color
();
regenerateColorScheme
();
return
mLinkColor
;
}
...
...
@@ -136,10 +142,18 @@ RichTextComposerControler::RichTextComposerControler(RichTextComposer *richtextC
:
QObject
(
parent
)
,
d
(
new
RichTextComposerControlerPrivate
(
richtextComposer
,
this
))
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
connect
(
qApp
,
&
QApplication
::
paletteChanged
,
this
,
&
RichTextComposerControler
::
regenerateColorScheme
);
#endif
}
RichTextComposerControler
::~
RichTextComposerControler
()
=
default
;
void
RichTextComposerControler
::
regenerateColorScheme
()
{
d
->
regenerateColorScheme
();
}
bool
RichTextComposerControler
::
painterActive
()
const
{
return
d
->
painterActive
;
...
...
@@ -937,3 +951,14 @@ QString RichTextComposerControler::toWrappedPlainText(QTextDocument *doc) const
d
->
fixupTextEditString
(
temp
);
return
temp
;
}
bool
RichTextComposerControler
::
event
(
QEvent
*
ev
)
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
if
(
ev
->
type
()
==
QEvent
::
ApplicationPaletteChange
)
{
regenerateColorScheme
();
}
#endif
return
QObject
::
event
(
ev
);
}
src/composer-ng/richtextcomposercontroler.h
View file @
07ed743c
...
...
@@ -93,7 +93,11 @@ public Q_SLOTS:
void
slotFormatPainter
(
bool
active
);
void
ensureCursorVisibleDelayed
();
protected:
bool
event
(
QEvent
*
ev
)
override
;
private:
void
regenerateColorScheme
();
class
RichTextComposerControlerPrivate
;
std
::
unique_ptr
<
RichTextComposerControlerPrivate
>
const
d
;
};
...
...
src/texteditor/richtexteditor/richtexteditor.cpp
View file @
07ed743c
...
...
@@ -738,6 +738,11 @@ bool RichTextEditor::event(QEvent *ev)
return
true
;
}
}
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
else
if
(
ev
->
type
()
==
QEvent
::
ApplicationPaletteChange
)
{
regenerateColorScheme
();
}
#endif
return
QTextEdit
::
event
(
ev
);
}
...
...
@@ -753,11 +758,6 @@ void RichTextEditor::wheelEvent(QWheelEvent *event)
event
->
accept
();
return
;
}
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
else
if
(
event
->
type
()
==
QEvent
::
ApplicationPaletteChange
)
{
regenerateColorScheme
();
}
#endif
QTextEdit
::
wheelEvent
(
event
);
}
...
...
Write
Preview
Markdown
is supported
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