Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Passing Paramater from .cpp file to .qml file

    General and Desktop
    2
    2
    1074
    Loading More Posts
    • 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.
    • C
      chronoske last edited by

      Hello everyone...
      I wanna asking you about passing parameter in .qml file from .cpp file.
      I've a function for getting filename in widgetmap . . .
      and then I would like to show map using .qml file.

      @...
      WidgetMap::WidgetMap(QString idofinformation, QWidget *parent) :
      QWidget(parent),
      ui(new Ui::WidgetMap)
      {
      ui->setupUi(this);

      ....
          //I get the filename from database
          //set the filename
          this->filename = this->hasil.result->__ptr[0]->FileName;
          //set the serverfilename
          ftpdownloader->serverfilename = this->filename;
          ...
      

      }

      WidgetMap::~WidgetMap()
      {
      delete ui;
      }

      //back toolbutton
      void WidgetMap::slotToolButtonBack()
      {
      ...
      }

      void WidgetMap::slotShowMap(bool failed)
      {
      // I use qml file by setting the source (detailMap.qml)

      ...
       this->view->setSource(QUrl(QString::fromUtf8(this->applicationdirpath.absolutePath().toUtf8() + "/DetailMap.qml")));
         ...
      

      }@

      and then this is in .qml file :
      @
      ....

      Rectangle
      {
      width: 640
      height: 480

      // Create a flickable to view a large image.
      Flickable
      {
         ...
      
         //I use
          Image
          {
              id: picture
              source: "denah.png"
              asynchronous: true
          }
      
          ...
      

      }
      @

      I use filename to get it from database, then I want to set the filename in .qml file to show it using qml. How can I passing the filename in .qml file?
      thx b4.

      1 Reply Last reply Reply Quote 0
      • S
        sabrog last edited by

        May be "this":http://xizhizhu.blogspot.com/2010/10/hybrid-application-using-qml-and-qt-c.html help.

        QT - Apple QuickTime
        Qt - Nokia's Qt Development Frameworks
        Apple is a competitor of Nokia, so QT != Qt

        1 Reply Last reply Reply Quote 0
        • First post
          Last post