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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:02:19+00:00 2026-06-14T03:02:19+00:00

I am creating sort of a router for REST API in Qt and I

  • 0

I am creating sort of a router for REST API in Qt and I am facing problem with inserting the function pointer into the QMap.

I have class IModule from which the other modules are derivated.
Important lines of IModule.h are

typedef QByteArray* (*IBusAction)(IBus * , ProxyRequest *);

class IModule : public QObject
{
   Q_OBJECT

  protected:
    QMap<QString , IBusAction > *m_actions;

Then I have UserModule which is derived from IModule and in .cpp file I have these lines:

QByteArray* UserModule::create(IBus *bus, ProxyRequest *req)
{
}

QByteArray* UserModule::show( IBus *bus, ProxyRequest *req)
{
}


UserModule::UserModule(QObject *parent) :
IModule(parent)
{

    // register functions
    m_actions->insert("show", &UserModule::show);
    m_actions->insert("create", UserModule::create);

}

So I tried two options how to put the function in QMap with referencing sign also without it, but both are not working. I am getting error: no matching function for call to 'QMap<QString, QByteArray* (*)(IBus*, ProxyRequest*)>::insert(const char [5], QByteArray* (UserModule::*)(IBus*, ProxyRequest*))'

I have spent several hours with this problem, tried many different things how to solve it but there was no success.

So I will be very glad for any piece of advice.

  • 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-14T03:02:21+00:00Added an answer on June 14, 2026 at 3:02 am

    Your IBusAction is a pointer-to-function type. This is not compatible with pointer-to-member function.

    When you call a member function (like your UserModule::create function), it needs an extra (“invisible”) parameter: the instance the function gets called on (the this pointer).

    You have essentially three options:

    • Change IBusAction to be a pointer-to-member-function-of-UserModule. You’re restricted to that class’s functions with this though.

      typedef QByteArray* (UserModule::*IBusAction)(IBus * , ProxyRequest *);
      
    • Make the functions static (this changes the semantics of your code)

    • Use free-standing functions (top-level, not members of a class) instead of member functions.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to define some sort of capitalize() or toLowerCase() function when creating
i am thinking about creating a sort of text based mmorpg game, i have
I have an issue in my app. I'm creating a sort of improvised menu
I am creating a sort of family tree in entity framework 4.0. I have
gcc compiles the following code without error. I'm creating a bubble sort function that
I'm interested in creating a sort of hand-off authentication method, where there's a client
I am creating an image (some sort of copy of another gallery image) using
I am in the process of creating an outlook addin. The addin works sort
Using Jquery TableSorter, I am creating a custom parser to sort elapsed time <td>
Creating a class at runtime is done as follows: klass = Class.new superclass, &block

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.