QScreen manual test: use sizeHint; don't override QLineEdit text color
The window size was too small on high-DPI screens. Save the default text color instead of setting it to black. Change-Id: I78b50624110be0cb1d077d3782d421eb323f4fb0 Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
This commit is contained in:
parent
2153ac61c9
commit
e0981a0d9e
@ -80,8 +80,11 @@ void screenAdded(QScreen* screen)
|
||||
// But this works as long as the screens are all virtual siblings
|
||||
w->show();
|
||||
QRect geom = w->geometry();
|
||||
geom.setSize(w->sizeHint());
|
||||
if (geom.height() > screen->geometry().height())
|
||||
geom.setHeight(screen->geometry().height() * 9 / 10);
|
||||
geom.moveCenter(screen->geometry().center());
|
||||
w->move(geom.topLeft());
|
||||
w->setGeometry(geom);
|
||||
|
||||
props->insert(screen, w);
|
||||
|
||||
|
@ -34,8 +34,9 @@
|
||||
#include "propertyfield.h"
|
||||
#include <QDebug>
|
||||
|
||||
PropertyField::PropertyField(QObject* subject, const QMetaProperty& prop, QWidget *parent) :
|
||||
QLineEdit(parent), m_subject(subject), m_lastChangeTime(QTime::currentTime()), m_prop(prop)
|
||||
PropertyField::PropertyField(QObject* subject, const QMetaProperty& prop, QWidget *parent)
|
||||
: QLineEdit(parent), m_subject(subject), m_lastChangeTime(QTime::currentTime()), m_prop(prop)
|
||||
, m_defaultBrush(palette().brush(QPalette::Active, QPalette::Text))
|
||||
{
|
||||
setReadOnly(true);
|
||||
if (prop.hasNotifySignal()) {
|
||||
@ -99,7 +100,7 @@ void PropertyField::propertyChanged()
|
||||
setText(text);
|
||||
m_lastText = text;
|
||||
m_lastTextShowing = text;
|
||||
modPalette.setBrush(QPalette::Text, Qt::black);
|
||||
modPalette.setBrush(QPalette::Text, m_defaultBrush);
|
||||
}
|
||||
setPalette(modPalette);
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ private:
|
||||
QString m_lastTextShowing;
|
||||
QTime m_lastChangeTime;
|
||||
const QMetaProperty m_prop;
|
||||
QBrush m_defaultBrush;
|
||||
};
|
||||
|
||||
#endif // PROPERTYFIELD_H
|
||||
|
Loading…
Reference in New Issue
Block a user