Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [Solved] QML in MFC app

[Solved] QML in MFC app

Scheduled Pinned Locked Moved QML and Qt Quick
6 Posts 3 Posters 5.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    qmlMfc
    wrote on last edited by
    #1

    Hello All
    I am new to QT/QML would like to know, is it possible to use QML with in existing MFC app?

    Please let me know

    Thanks & Regards

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      qmlMfc
      wrote on last edited by
      #2

      Here is how i am able to do that

      @int CQtQuickMFCTestView::OnCreate(LPCREATESTRUCT lpCreateStruct)
      {
      if (CView::OnCreate( lpCreateStruct ) == -1 )
      return -1;

      widget = new QWinWidget( this );
      QHBoxLayout *hbox = new QHBoxLayout( widget );
      
      QDeclarativeView *qmlView1 = new QDeclarativeView;
      qmlView1->setSource(QUrl::fromLocalFile("dialcontrol.qml"));
      hbox->addWidget( qmlView1 );
      
      QLabel *label = new QLabel( "Enter text:", widget );
      QLineEdit *edit = new QLineEdit( widget );
      hbox->addWidget( label );
      hbox->addWidget( edit );
      
      QDeclarativeView *qmlView = new QDeclarativeView;
      qmlView->setSource(QUrl::fromLocalFile("qgraphicsgridlayout.qml"));
      hbox->addWidget( qmlView );
      
      
      widget->move( 30, 30 );
      widget->show();
      return 0;
      

      }@
      CQtQuickMFCTestView is the main view class
      widget is defined in QtQuickMFCTestView.h
      also i am using qtwinmigrate project
      following are my includes

      @#include <QtWinMigrate/qmfcapp.h>
      #include <QtWinMigrate/qwinwidget.h>
      #include <qdeclarative.h>
      #include <QDeclarativeView>
      #include <QDeclarativeEngine>
      #include <QDeclarativeComponent>
      #include <QtWinMigrate/qwinwidget.h>
      #include <QtGui/QLabel>
      #include <QtGui/QLineEdit>
      #include <QtGui/QLayout>
      @

      I will add more detail (or a wiki article) as soon as i got some time

      1 Reply Last reply
      0
      • ? This user is from outside of this forum
        ? This user is from outside of this forum
        Guest
        wrote on last edited by
        #3

        hi qmlMfc, you should create a wiki article for this :)
        also, can you markup the code using the @tag, will be easier to read

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SeedOfLife
          wrote on last edited by
          #4

          [quote author="qmlMfc" date="1289515139"]Here is how i am able to do that

          ....

          I will add more detail (or a wiki article) as soon as i got some time[/quote]

          I hope u can do this soon. I am looking to integrate part of my mfc solutions with Qt, but failing without a proper tutorial. The available QtWinMigrate project doesnt help much in my case.

          1 Reply Last reply
          0
          • K Offline
            K Offline
            karrtikiyer
            wrote on last edited by
            #5

            Does this work? Has anyone tried this using QT 5.4 and MFC? Please let me know.

            Thanks and regards,
            Karrtik

            1 Reply Last reply
            0
            • K Offline
              K Offline
              karrtikiyer
              wrote on last edited by
              #6

              Does this work? Has anyone tried this using QT 5.4 and MFC? Please let me know.

              Thanks and regards,
              Karrtik

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved