[Qt-interest] question about new boilerplate in creator
Girish Ramakrishnan
girish at forwardbias.in
Tue Oct 11 07:05:11 CEST 2011
Hi,
On Tue, Oct 11, 2011 at 12:36 AM, Sivan Greenberg <sivan at omniqueue.com> wrote:
> Hi All,
>
> So after updating my sdk, I see that the main.cpp files have changed to:
>
> Q_DECL_EXPORT int main(int argc, char *argv[])
> {
> QScopedPointer<QApplication> app(createApplication(argc, argv));
> QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
>
> viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
> viewer->setMainQmlFile(QLatin1String("qml/panimaldesktop/main.qml"));
> viewer->showExpanded();
>
> return app->exec();
> }
>
>
> I was wondering why Q_DECL_EXPORT was introduced, and why
> createApplication is not longer on its own, as well as using Qt's
> abstraction to allocate and clear the sotrage classes, while before
> they were allocated on the stack such that when going out of the
> program execution contest, the compiler would take care of
> deallocation ?
>
>
> Curious for the answers.
>
The usage of Q_DECL_EXPORT appears to be incorrect. AFAIK, it's meant
to be for exporting symbols in shared libs. I also think the usage of
QScopedPointer makes the code harder to read :)
BTW, there is a separate qt-creator mailing list. Might be a good idea
to send your question there.
Girish
More information about the Qt-interest-old
mailing list