Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
4.3.0
-
None
-
24cdab32de2abd8669f281dd54c8da1124514915
Description
There is a difference between the way QTextEdit and QLineEdit displays selected text. QTextEdit will use the Active color group only if the window is active and the edit has focus. Otherwise it will use Inactive/Disabled depending on the enabled property.
QLineEdit will use the Active color group if the window is active.
#include <QApplication>
#include <QPalette>
#include <QWidget>
#include <QVBoxLayout>
#include <QTextEdit>
#include <QTextCursor>
#include <QLineEdit>
int main(int argc, char **argv)
{
QApplication a(argc, argv);
QPalette p = a.palette();
p.setBrush(QPalette::Active, QPalette::Highlight, Qt::green);
p.setBrush(QPalette::Inactive, QPalette::Highlight, Qt::red);
p.setBrush(QPalette::Disabled, QPalette::Highlight, Qt::blue);
a.setPalette(p);
QWidget w;
QVBoxLayout *l = new QVBoxLayout(&w);
for (int i=0; i<4; ++i)
w.show();
return a.exec();
}