on xenial help sign in
Refactored ApplicationArguments constructor(s)
465d64eJosh Arenson
src/ApplicationArguments.h+2−5
@@ -28,11 +28,8 @@ class ApplicationArguments : public QObject
28{
28{
29 Q_OBJECT
29 Q_OBJECT
30public:
30public:
31− ApplicationArguments()
31+ // Not exposed to the app as setSize isn't invokable
32− {
33− }
34−
35− ApplicationArguments(int width, int height) {
32+ void setSize(int width, int height) {
36 m_size.rwidth() = width;
33 m_size.rwidth() = width;
37 m_size.rheight() = height;
34 m_size.rheight() = height;
38 }
35 }
src/main.cpp+5−8
@@ -98,16 +98,13 @@ Load the testability driver");
98
98
99 resolveIconTheme();
99 resolveIconTheme();
100
100
101− std::auto_ptr<ApplicationArguments> appArgs;
101+ ApplicationArguments qmlArgs;
102 if (parser.isSet(windowGeometryOption) &&
102 if (parser.isSet(windowGeometryOption) &&
103− parser.value(windowGeometryOption).split('x').size() == 2) {
103+ parser.value(windowGeometryOption).split('x').size() == 2)
104− QStringList geom =
104+ {
105− parser.value(windowGeometryOption).split('x');
105+ QStringList geom = parser.value(windowGeometryOption).split('x');
106− appArgs.reset(new ApplicationArguments(geom.at(0).toInt(), geom.at(1).toInt()));
106+ qmlArgs.setSize(geom.at(0).toInt(), geom.at(1).toInt());
107− } else {
108− appArgs.reset(new ApplicationArguments());
109 }
107 }
110− ApplicationArguments& qmlArgs = *appArgs;
111
108
112 // The testability driver is only loaded by QApplication but not by QGuiApplication.
109 // The testability driver is only loaded by QApplication but not by QGuiApplication.
113 // However, QApplication depends on QWidget which would add some unneeded overhead => Let's load the testability driver on our own.
110 // However, QApplication depends on QWidget which would add some unneeded overhead => Let's load the testability driver on our own.