tst_QFormLayout: use QProxyStyle instead of QWindowsStyle
QWindowsStyle is soon to become an internal class. Change-Id: Ie28d4ea074938b17827aa803a2298f881946f7e5 Reviewed-by: Caroline Chao <caroline.chao@digia.com>
This commit is contained in:
parent
f1a743c165
commit
7caaab5262
@ -44,13 +44,12 @@
|
|||||||
#include <qlayout.h>
|
#include <qlayout.h>
|
||||||
#include <qapplication.h>
|
#include <qapplication.h>
|
||||||
#include <qwidget.h>
|
#include <qwidget.h>
|
||||||
#include <qwindowsstyle.h>
|
#include <qproxystyle.h>
|
||||||
#include <qsizepolicy.h>
|
#include <qsizepolicy.h>
|
||||||
|
|
||||||
#include <QtWidgets/QLabel>
|
#include <QtWidgets/QLabel>
|
||||||
#include <QtWidgets/QLineEdit>
|
#include <QtWidgets/QLineEdit>
|
||||||
#include <QtWidgets/QPushButton>
|
#include <QtWidgets/QPushButton>
|
||||||
#include <QtWidgets/QWindowsStyle>
|
|
||||||
#include <QStyleFactory>
|
#include <QStyleFactory>
|
||||||
|
|
||||||
#include <qformlayout.h>
|
#include <qformlayout.h>
|
||||||
@ -268,11 +267,11 @@ void tst_QFormLayout::wrapping()
|
|||||||
delete w;
|
delete w;
|
||||||
}
|
}
|
||||||
|
|
||||||
class CustomLayoutStyle : public QWindowsStyle
|
class CustomLayoutStyle : public QProxyStyle
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CustomLayoutStyle()
|
CustomLayoutStyle() : QProxyStyle(QStyleFactory::create("windows"))
|
||||||
{
|
{
|
||||||
hspacing = 5;
|
hspacing = 5;
|
||||||
vspacing = 10;
|
vspacing = 10;
|
||||||
@ -297,7 +296,7 @@ int CustomLayoutStyle::pixelMetric(PixelMetric metric, const QStyleOption * opti
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return QWindowsStyle::pixelMetric(metric, option, widget);
|
return QProxyStyle::pixelMetric(metric, option, widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QFormLayout::spacing()
|
void tst_QFormLayout::spacing()
|
||||||
@ -411,7 +410,7 @@ void tst_QFormLayout::setFormStyle()
|
|||||||
QVERIFY(layout.rowWrapPolicy() == QFormLayout::DontWrapRows);
|
QVERIFY(layout.rowWrapPolicy() == QFormLayout::DontWrapRows);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
widget.setStyle(new QWindowsStyle());
|
widget.setStyle(QStyleFactory::create("windows"));
|
||||||
|
|
||||||
QVERIFY(layout.labelAlignment() == Qt::AlignLeft);
|
QVERIFY(layout.labelAlignment() == Qt::AlignLeft);
|
||||||
QVERIFY(layout.formAlignment() == (Qt::AlignLeft | Qt::AlignTop));
|
QVERIFY(layout.formAlignment() == (Qt::AlignLeft | Qt::AlignTop));
|
||||||
|
Loading…
Reference in New Issue
Block a user