Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7548241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:38:55+00:00 2026-05-30T09:38:55+00:00

So here is my complicated question and I hope you know the answer :)

  • 0

So here is my complicated question and I hope you know the answer 🙂

I am developing app for android using Qt Necessitas.
I have made .ui file for GUI and I didn’t find it what I really want so a lot of people suggested QML as it is very dynamic and a lot of options available.

But problem to me is as I have never been working with QML before.

I need a bit of help just with few functions so I can know how to do it later.

For example. this is my function which I call it to read data from database using a post method and calling php script.

void MainWindow::Citanje_korisnika()  //read users
{
    init();
    QUrl params;
    params.addQueryItem("action","Citanje_korisnika");
    QByteArray data;
    data.append(params.toString());
    data.remove(0,1);
    QNetworkRequest request;
    request.setUrl(url);
    request.setHeader(QNetworkRequest::ContentTypeHeader,
    QVariant("application/x-www-form-urlencoded"));
    reply = manager->post(request, data);
    connect(reply, SIGNAL(downloadProgress(qint64, qint64)),this, SLOT(updateDataTransferProgress(qint64,qint64)));
}
  1. So my question is how to call this function from qml code? For example when user presses button?

  2. After that I have this function which puts me everything into my form.

    void MainWindow::Pokazi(QList< QMap<QString,QString> >& osobe)  //show
    {
        i_max=osobe.count();
        osobe_next=osobe;
        osoba = osobe.at(0);
        //trenutni_id=osoba["id"];
        ui->label_ID->setText(osoba["id"]);
        ui->line_ime->insert(osoba["ime"]);
        ui->line_prezime->insert(osoba["prezime"]);
        ui->line_telefon->insert(osoba["broj"]);
        ui->line_adresa->insert(osoba["adresa"]);
    }
    

So this is where I want to display all persons on my list.

  1. Is it possible to load this above QList into QML ListView which looks like this?
    Can I populate it dynamically?

    ListModel {
        ListElement {
            name: "Bill Smith"
            number: "555 3264"
        }
        ListElement {
            name: "John Brown"
            number: "555 8426"
        }
    }
    

This is only example with already inserted values. My question is how to make it populate from qml code dynamically?

And I want to get my list looks like second picture in this link: http://doc.qt.nokia.com/4.7-snapshot/qml-listview.html

I managed to make it looks like this but problem is I want to load my data dynamically inside I don’t want it predefined.

If you need more code let me know.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T09:38:56+00:00Added an answer on May 30, 2026 at 9:38 am

    1) calling c++ function from QML is easy.
    You need to expose your object via setContextProperty
    QDeclarativeContext *ctxt = view.rootContext();
    ctxt->setContextProperty(“timer”, &timerObj);

    Then you can call any slots of exposed object or function which is declated as Q_INVOKABLE.

    This link may help you more.

    2) You need to create model, you can use QStringListModel, or you can create custom model derived from QAbstractListModel.

    Hope this will help you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Bit of a complicated SQL question here. I currently have a SELECT statement which
I have a complicated MYSQL query question here. I try my best to explain
This is my first question here. I have a complicated SQL database and I
I have a problem with (for me to complicated) MySql query. Okay, here is
I'm back with another (possibly) silly question. sorry. I have a pretty complicated query
I know this probably is a fairly complicated question but... heres my case: I
Here is an excellent question and the wonderful tchrist 's answer with 7+24+52 advices&comments
This question is kind of complicated and I do not even know how to
Not sure if the question is titled clearly, but here goes. I have some
WARNING: Long and complicated question... So here's the story so far: I'm trying to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.