Skip to content

Commit

Permalink
fix: TextEdit color group not update
Browse files Browse the repository at this point in the history
control's palette not changed whene window activate changed

Bug: https://pms.uniontech.com/bug-view-196603.html
  • Loading branch information
kegechen committed Jun 16, 2023
1 parent 2382eba commit 428675e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/widgets/dtextedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

#include <DStyle>
#include <DObjectPrivate>
#include <DGuiApplicationHelper>
DGUI_USE_NAMESPACE

DWIDGET_BEGIN_NAMESPACE

Expand Down Expand Up @@ -123,6 +125,12 @@ bool DTextEdit::event(QEvent *e)
return true;
}
}
} else if ((e->type() == QEvent::WindowActivate || e->type() == QEvent::WindowDeactivate) &&
!DGuiApplicationHelper::testAttribute(DGuiApplicationHelper::UseInactiveColorGroup)) {
// only work for DTextEdit without setAttribute UseInactiveColorGroup false
// TODO: remove me if QTextEdit fix it
QTextEditPrivate *d = reinterpret_cast<QTextEditPrivate *>(qGetPtrHelper(d_ptr));
d->control->setPalette(palette());
}

return QTextEdit::event(e);
Expand Down

0 comments on commit 428675e

Please sign in to comment.