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:
Shawn Rutledge 2015-01-09 15:12:19 +01:00
parent 2153ac61c9
commit e0981a0d9e
3 changed files with 9 additions and 4 deletions

View File

@ -80,8 +80,11 @@ void screenAdded(QScreen* screen)
// But this works as long as the screens are all virtual siblings // But this works as long as the screens are all virtual siblings
w->show(); w->show();
QRect geom = w->geometry(); 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()); geom.moveCenter(screen->geometry().center());
w->move(geom.topLeft()); w->setGeometry(geom);
props->insert(screen, w); props->insert(screen, w);

View File

@ -34,8 +34,9 @@
#include "propertyfield.h" #include "propertyfield.h"
#include <QDebug> #include <QDebug>
PropertyField::PropertyField(QObject* subject, const QMetaProperty& prop, QWidget *parent) : PropertyField::PropertyField(QObject* subject, const QMetaProperty& prop, QWidget *parent)
QLineEdit(parent), m_subject(subject), m_lastChangeTime(QTime::currentTime()), m_prop(prop) : QLineEdit(parent), m_subject(subject), m_lastChangeTime(QTime::currentTime()), m_prop(prop)
, m_defaultBrush(palette().brush(QPalette::Active, QPalette::Text))
{ {
setReadOnly(true); setReadOnly(true);
if (prop.hasNotifySignal()) { if (prop.hasNotifySignal()) {
@ -99,7 +100,7 @@ void PropertyField::propertyChanged()
setText(text); setText(text);
m_lastText = text; m_lastText = text;
m_lastTextShowing = text; m_lastTextShowing = text;
modPalette.setBrush(QPalette::Text, Qt::black); modPalette.setBrush(QPalette::Text, m_defaultBrush);
} }
setPalette(modPalette); setPalette(modPalette);
} }

View File

@ -63,6 +63,7 @@ private:
QString m_lastTextShowing; QString m_lastTextShowing;
QTime m_lastChangeTime; QTime m_lastChangeTime;
const QMetaProperty m_prop; const QMetaProperty m_prop;
QBrush m_defaultBrush;
}; };
#endif // PROPERTYFIELD_H #endif // PROPERTYFIELD_H