Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-2404

Remove Symbian/Maemo specific #ifdef's from main.cpp (QmlApp wizard)

    XMLWordPrintable

Details

    • 6bc11283ea23f8e4b06fa8e0e49b8e9e0b9e35bb

    Description

      Our current generated main.cpp looks like:

      #include <QtGui/QApplication>
      #include "qmlapplicationviewer.h"
      
      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
      
          QmlApplicationViewer viewer;
          viewer.setOrientation(QmlApplicationViewer::Auto);
          viewer.setMainQmlFile(QLatin1String("qml/helloworld3/helloworld3.qml"));
      
      #ifdef Q_OS_SYMBIAN
          viewer.showFullScreen();
      #elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6)
          viewer.showMaximized();
      #else
          viewer.show();
      #endif
          return app.exec();
      }
      

      Can we get rid of the #ifdefs by overloading QmlApplicationViewer::show()? Ideally the 'default' behavior of show should be IMO system specific. If there's actual need ::show() could also take an optional enum, e.g.:

      enum WindowSize

      { WindowDefaultSize, WindowMaximizeSize, WindowFullScreenSize, WindowSystemDefaultSize}

      ;

      void QmlApplicationViewer::show(WindowSize windowSize = WindowSystemDefaultSize) {
      //....
      }

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            hjk hjk
            kkohne Kai Köhne
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes