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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:12:11+00:00 2026-06-18T09:12:11+00:00

I want to invoke a slot asynchronously from a different thread using QMetaObject::invokeMethod() The

  • 0

I want to invoke a slot asynchronously from a different thread using QMetaObject::invokeMethod()

The class containing the slot is declared as:

class Paintable : public QObject {
  Q_OBJECT
  [...]
  public slots:
    void drawString(uint16_t x, uint16_t y, uint16_t size, const char* str, color c);
}

and the method that calls invokeMethod is defined as:

void drawStringAsynchronously(uint16_t x, uint16_t y, uint16_t size, const char* str, color c) {
  QMetaObject::invokeMethod(paintable,
               "drawString",
               Qt::QueuedConnection,
               Q_ARG(uint16_t, x), Q_ARG(uint16_t, y), Q_ARG(uint16_t, size),
               Q_ARG(const char*, str), Q_ARG(color, c));
}

(where paintable is of type Paintable*)

But Qt seems to be unable to use uint16_t or char* in invokeMethod because at runtime I get the following message:

QMetaMethod::invoke: Unable to handle unregistered datatype 'const char*'

and

QMetaMethod::invoke: Unable to handle unregistered datatype 'uint16_t'

respectively.

I was able to successfully register my custom struct color using qRegisterMetaType() but since uint16_t and char* are no structs or classes this won’t work.

I’d be very glad if somebody could show me how to do it or show a good alternative.

  • 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-18T09:12:13+00:00Added an answer on June 18, 2026 at 9:12 am

    The problem with registering uint16_t is this: It’s a typedef, and Qt has already registered this type, but it’s under a different name. Since the QMetaType system is based on determining types by their name this causes problems.

    You can get around this with:

    Q_DECLARE_METATYPE(uint16_t)
    

    then:

    qRegisterMetaType<uint16_t>("uint16_t");
    

    This creates an alias so that metatypes can be created with that name.

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

Sidebar

Related Questions

I am using the slider control from WebFX . I want to invoke a
I want to invoke a method of an object from user defined class for
I want to invoke some method on child class using its interface, but I
I want to invoke my rake task from console. Is it doable? if yes,
I have a WCF application that is using NetTcpBinding . I want to invoke
I want to specifically invoke the base class method; what's the most concise way
I want to invoke a process from within a haskell program and capture stdout
I want to invoke method a from method of module B . How can
I want to invoke mysqldump from a Spring based webapp and write the output
I want to invoke a creation of div with certain class just below the

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.