Make the textedit example use dark text on light background on macOS
Many text documents will be designed for a white-paper look, and in these cases it is desirable that the editor colors matches. Change-Id: I66d721f8c2e27b78a2b885c6cfd74f897fe42389 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>bb10
parent
d0528d558e
commit
213cfc3fae
|
|
@ -150,6 +150,14 @@ TextEdit::TextEdit(QWidget *parent)
|
|||
|
||||
textEdit->setFocus();
|
||||
setCurrentFileName(QString());
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
// Use dark text on light background on macOS, also in dark mode.
|
||||
QPalette pal = textEdit->palette();
|
||||
pal.setColor(QPalette::Base, QColor(Qt::white));
|
||||
pal.setColor(QPalette::Text, QColor(Qt::black));
|
||||
textEdit->setPalette(pal);
|
||||
#endif
|
||||
}
|
||||
|
||||
void TextEdit::closeEvent(QCloseEvent *e)
|
||||
|
|
|
|||
Loading…
Reference in New Issue