on xenial help sign in
Refactored ApplicationArguments constructor(s)
commit465d64ee76510f645646d497c0c7ac3f968f0269 authorJosh Arenson <joshua.arenson@canonical.com> dateMon 5 May 2014, 15:45 (12 years ago) parent0cb1206
2 files changed+7−13
src/ApplicationArguments.h+2−5 src/main.cpp+5−8
src/ApplicationArguments.h+2−5
@@ -28,11 +28,8 @@ class ApplicationArguments : public QObject
2828{
2929 Q_OBJECT
3030public:
31− ApplicationArguments()
32− {
33− }
34−
35− ApplicationArguments(int width, int height) {
31+ // Not exposed to the app as setSize isn't invokable
32+ void setSize(int width, int height) {
3633 m_size.rwidth() = width;
3734 m_size.rheight() = height;
3835 }
src/main.cpp+5−8
@@ -98,16 +98,13 @@ Load the testability driver");
9898
9999 resolveIconTheme();
100100
101− std::auto_ptr<ApplicationArguments> appArgs;
101+ ApplicationArguments qmlArgs;
102102 if (parser.isSet(windowGeometryOption) &&
103− parser.value(windowGeometryOption).split('x').size() == 2) {
104− QStringList geom =
105− parser.value(windowGeometryOption).split('x');
106− appArgs.reset(new ApplicationArguments(geom.at(0).toInt(), geom.at(1).toInt()));
107− } else {
108− appArgs.reset(new ApplicationArguments());
103+ parser.value(windowGeometryOption).split('x').size() == 2)
104+ {
105+ QStringList geom = parser.value(windowGeometryOption).split('x');
106+ qmlArgs.setSize(geom.at(0).toInt(), geom.at(1).toInt());
109107 }
110− ApplicationArguments& qmlArgs = *appArgs;
111108
112109 // The testability driver is only loaded by QApplication but not by QGuiApplication.
113110 // However, QApplication depends on QWidget which would add some unneeded overhead => Let's load the testability driver on our own.