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 8775659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:51:38+00:00 2026-06-13T18:51:38+00:00

In C++ code below I load a qml file. But c++ slot not working.

  • 0

In C++ code below I load a qml file. But c++ slot not working. No error or warnings occurs but debug message is always “a” character. No “b” character appears. Can you tell me why? Thanks.

c++ side code

    ::::::::::::::
    view=new QDeclarativeView;
    view->setSource(QUrl("qml/groundMenu/Ground.qml"));
    rootObject = dynamic_cast<QObject*>(view->rootObject());
    QObject::connect(rootObject, SIGNAL(qmlSignal()),this, SLOT(qmlLoadedProcess()));
:::::::::::::::::
void MainWindow::qmlLoadedProcess()
{
    qDebug()<<"b";
}

//qml side code 
    Rectangle
    {
      signal qmlSignal()
      Component.onCompleted:
      {
         qmlSignal()
         console.log("a")
      }
    }
  • 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-06-13T18:51:40+00:00Added an answer on June 13, 2026 at 6:51 pm

    The problem is that the Component.onCompleted happens before you have called the QObject::connect(…). I.e. the Rectangle in qml is created when you call view->setSource(…) and the Component.onCompleted is called before you connect the signal to the slot. So the qmlLoadedProcess() never gets called.

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

Sidebar

Related Questions

I am trying to load a JS file using yepnope using the below code:
In codeIgnator frame work the below is my code working properly.But i cannot control
When I load the PHP page containing the code below I get the error
The code below is from my extension. It works in FF 3.6, but not
I'm using the code below to load a text file content into a WebView
I am currently using the code below to load images but I want to
I want to load wordpress in a smarty template. I used the code below
Afternoon all, Using the code below I'm trying to load what is render by
I am using the below code in my test class , to load all
Code below is working well as long as I have class ClassSameAssembly in same

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.