summaryrefslogtreecommitdiffstats
path: root/tests/manual
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual')
-rw-r--r--tests/manual/qscreen/main.cpp4
-rw-r--r--tests/manual/qscreen/propertyfield.cpp24
-rw-r--r--tests/manual/qscreen/propertywatcher.cpp1
-rw-r--r--tests/manual/qscreen/propertywatcher.h6
4 files changed, 24 insertions, 11 deletions
diff --git a/tests/manual/qscreen/main.cpp b/tests/manual/qscreen/main.cpp
index 4f7ff8c96f..460fdc3edb 100644
--- a/tests/manual/qscreen/main.cpp
+++ b/tests/manual/qscreen/main.cpp
@@ -62,8 +62,8 @@ void updateSiblings(PropertyWatcher* w)
void screenAdded(QScreen* screen)
{
screen->setOrientationUpdateMask((Qt::ScreenOrientations)0x0F);
- qDebug("\nscreenAdded %s siblings %d first %s", qPrintable(screen->name()),
- screen->virtualSiblings().count(), qPrintable(screen->virtualSiblings().first()->name()));
+ qDebug("\nscreenAdded %s siblings %d first %s", qPrintable(screen->name()), screen->virtualSiblings().count(),
+ (screen->virtualSiblings().isEmpty() ? "none" : qPrintable(screen->virtualSiblings().first()->name())));
PropertyWatcher *w = new PropertyWatcher(screen, QString::number(i++));
QLineEdit *siblingsField = new QLineEdit();
siblingsField->setObjectName("siblings");
diff --git a/tests/manual/qscreen/propertyfield.cpp b/tests/manual/qscreen/propertyfield.cpp
index 6ac63b3c65..c5e9442a26 100644
--- a/tests/manual/qscreen/propertyfield.cpp
+++ b/tests/manual/qscreen/propertyfield.cpp
@@ -56,14 +56,26 @@ PropertyField::PropertyField(QObject* subject, const QMetaProperty& prop, QWidge
QString PropertyField::valueToString(QVariant val)
{
- QString text = val.toString();
- if (val.type() == QVariant::Size)
+ QString text;
+ switch (val.type()) {
+ case QVariant::Double:
+ text = QString("%1").arg(val.toReal(), 0, 'f', 4);
+ break;
+ case QVariant::Size:
text = QString("%1 x %2").arg(val.toSize().width()).arg(val.toSize().height());
- else if (val.type() == QVariant::SizeF)
+ break;
+ case QVariant::SizeF:
text = QString("%1 x %2").arg(val.toSizeF().width()).arg(val.toSizeF().height());
- else if (val.type() == QVariant::Rect)
- text = QString("%1 x %2 +%3 +%4").arg(val.toRect().width())
- .arg(val.toRect().height()).arg(val.toRect().x()).arg(val.toRect().y());
+ break;
+ case QVariant::Rect: {
+ QRect rect = val.toRect();
+ text = QString("%1 x %2 %3%4 %5%6").arg(rect.width())
+ .arg(rect.height()).arg(rect.x() < 0 ? "" : "+").arg(rect.x())
+ .arg(rect.y() < 0 ? "" : "+").arg(rect.y());
+ } break;
+ default:
+ text = val.toString();
+ }
return text;
}
diff --git a/tests/manual/qscreen/propertywatcher.cpp b/tests/manual/qscreen/propertywatcher.cpp
index d342a94029..ee037a0a7c 100644
--- a/tests/manual/qscreen/propertywatcher.cpp
+++ b/tests/manual/qscreen/propertywatcher.cpp
@@ -63,6 +63,7 @@ PropertyWatcher::PropertyWatcher(QObject *subject, QString annotation, QWidget *
QPushButton *updateButton = new QPushButton("update");
connect(updateButton, &QPushButton::clicked, this, &PropertyWatcher::updateAllFields);
m_layout->addRow("", updateButton);
+ m_layout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
setLayout(m_layout);
connect(subject, &QObject::destroyed, this, &PropertyWatcher::subjectDestroyed);
}
diff --git a/tests/manual/qscreen/propertywatcher.h b/tests/manual/qscreen/propertywatcher.h
index c55776e97a..63c828f651 100644
--- a/tests/manual/qscreen/propertywatcher.h
+++ b/tests/manual/qscreen/propertywatcher.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef WIDGET_H
-#define WIDGET_H
+#ifndef PROPERTY_WATCHER_H
+#define PROPERTY_WATCHER_H
#include <QWidget>
@@ -69,4 +69,4 @@ protected:
QFormLayout * m_layout;
};
-#endif // WIDGET_H
+#endif // PROPERTY_WATCHER_H