mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Fix ChatWidget current text edit color when changing appearance style.
Don't change already typed text, who wants to change style while typping?
This commit is contained in:
parent
593e57b14c
commit
51cc94bfa7
@ -474,6 +474,7 @@ uint32_t ChatWidget::maxMessageSize()
|
|||||||
|
|
||||||
bool ChatWidget::eventFilter(QObject *obj, QEvent *event)
|
bool ChatWidget::eventFilter(QObject *obj, QEvent *event)
|
||||||
{
|
{
|
||||||
|
//QEvent::Type type = event->type();
|
||||||
if (obj == ui->textBrowser || obj == ui->textBrowser->viewport()
|
if (obj == ui->textBrowser || obj == ui->textBrowser->viewport()
|
||||||
|| obj == ui->leSearch || obj == ui->chatTextEdit) {
|
|| obj == ui->leSearch || obj == ui->chatTextEdit) {
|
||||||
if (event->type() == QEvent::KeyPress) {
|
if (event->type() == QEvent::KeyPress) {
|
||||||
@ -673,6 +674,17 @@ bool ChatWidget::eventFilter(QObject *obj, QEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (event->type() == QEvent::StyleChange)
|
||||||
|
{
|
||||||
|
QString colorName = currentColor.name();
|
||||||
|
qreal desiredContrast = Settings->valueFromGroup("Chat", "MinimumContrast", 4.5).toDouble();
|
||||||
|
QColor backgroundColor = ui->chatTextEdit->palette().base().color();
|
||||||
|
RsHtml::findBestColor(colorName, backgroundColor, desiredContrast);
|
||||||
|
|
||||||
|
currentColor = QColor(colorName);
|
||||||
|
ui->chatTextEdit->setTextColor(currentColor);
|
||||||
|
colorChanged();
|
||||||
|
}
|
||||||
} else if (obj == ui->leSearch) {
|
} else if (obj == ui->leSearch) {
|
||||||
if (event->type() == QEvent::KeyPress) {
|
if (event->type() == QEvent::KeyPress) {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user