I'm confused about the auto_ptr use
Wouldn't
std::auto_ptr<ApplicationArguments> appArgs; if (parser.isSet(windowGeometryOption) && parser.value(windowGeometryOption).split('x').size() == 2) { QStringList geom = parser.value(windowGeometryOption).split('x'); appArgs.reset(new ApplicationArguments(geom.at(0).toInt(), geom.at(1).toInt())); } else { appArgs.reset(new ApplicationArguments()); } ApplicationArguments& qmlArgs = *appArgs;
make more sense as
ApplicationArguments qmlArgs; if (parser.isSet(windowGeometryOption) && parser.value(windowGeometryOption).split('x').size() == 2) { QStringList geom = parser.value(windowGeometryOption).split('x'); qmlArgs.setSize(new ApplicationArguments(geom.at(0).toInt(), geom.at(1).toInt())); }
or if you don't want to expose setSize (which is indeed fine since if you don't make it a q_invokable it won't be available from the qml side)
QSize size; if (parser.isSet(windowGeometryOption) && parser.value(windowGeometryOption).split('x').size() == 2) { QStringList geom = parser.value(windowGeometryOption).split('x'); size = QSize(new ApplicationArguments(geom.at(0).toInt(), geom.at(1).toInt())); } ApplicationArguments qmlArgs(size);
?
Any of those two versions seem easier to read to me
// Note code not warranteed to compile :D
« Back to merge proposal
I'm confused about the auto_ptr use
Wouldn't
std::auto_ ptr<Application Arguments> appArgs; isSet(windowGeo metryOption) && value(windowGeo metryOption) .split( 'x').size( ) == 2) { value(windowGeo metryOption) .split( 'x'); ments(geom. at(0).toInt( ), geom.at( 1).toInt( ))); ments() ); ments& qmlArgs = *appArgs;
if (parser.
parser.
QStringList geom = parser.
appArgs.reset(new ApplicationArgu
} else {
appArgs.reset(new ApplicationArgu
}
ApplicationArgu
make more sense as
ApplicationArgu ments qmlArgs; isSet(windowGeo metryOption) && value(windowGeo metryOption) .split( 'x').size( ) == 2) { value(windowGeo metryOption) .split( 'x'); setSize( new ApplicationArgu ments(geom. at(0).toInt( ), geom.at( 1).toInt( )));
if (parser.
parser.
QStringList geom = parser.
qmlArgs.
}
or if you don't want to expose setSize (which is indeed fine since if you don't make it a q_invokable it won't be available from the qml side)
QSize size; isSet(windowGeo metryOption) && value(windowGeo metryOption) .split( 'x').size( ) == 2) { value(windowGeo metryOption) .split( 'x'); ments(geom. at(0).toInt( ), geom.at( 1).toInt( ))); ments qmlArgs(size);
if (parser.
parser.
QStringList geom = parser.
size = QSize(new ApplicationArgu
}
ApplicationArgu
?
Any of those two versions seem easier to read to me
// Note code not warranteed to compile :D