Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Passing Paramater from .cpp file to .qml file

Passing Paramater from .cpp file to .qml file

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.2k 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.
  • C Offline
    C Offline
    chronoske
    wrote on 9 Aug 2011, 07:59 last edited by
    #1

    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
    0
    • S Offline
      S Offline
      sabrog
      wrote on 9 Aug 2011, 08:31 last edited by
      #2

      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
      0

      1/2

      9 Aug 2011, 07:59

      • Login

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