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

  • Home
  • SEARCH
  • 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 6319575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T15:49:45+00:00 2026-05-24T15:49:45+00:00

I have declared QOBJECT macro but still its calling the function without passing the

  • 0

I have declared QOBJECT macro but still its calling the function without passing the QObject object

Here is my code
keyusermanagertest.cpp

#define private public
#define protected public
#include "keyusermanagertest.h"
#include "storageusermanager.h"
#include "keyusermanager.h"
#include "alkuser.h"
#undef protected
#undef private

#include <QDebug>
#include <QtTest/QtTest>

QTEST_MAIN(KeyUserManagerTest)

void KeyUserManagerTest::init()
{

}

void KeyUserManagerTest::cleanup()
{
}

void KeyUserManagerTest::test_initialization()
{
// Already tested under BackendTest::test_initialization()

}

void KeyUserManagerTest::settersAndGetters()
{
    AlkUser userInfo;
    QString user="Puneet Goyal";
    StorageUserManager* storageuser=new StorageUserManager();
    KeyUserManager* keyuser=new KeyUserManager(storageuser);
    keyuser->updateUserData(user,userInfo);
    qDebug()<<"UPDATION DONE!!!!";
// Now setting the rest of the details for user Puneet Goyal using AlkUser Object

    userInfo.setName("Puneet");
    userInfo.setContact("21897121");
    userInfo.setType("savings");
    userInfo.setAccount("123456789");   
    userInfo.setAmount("100000");

// Now retrieving all the user details using KeyUserManager Object
    QVariant vari=keyuser->getUserInfo("Puneet Goyal");

}

keyusermanagertest.h

#ifndef KEYUSERMANAGERTEST_H
#define KEYUSERMANAGERTEST_H

#include <QtCore/QObject>

class KeyUserManager;

class KeyUserManagerTest : public QObject
{
  Q_OBJECT

private slots:

  void init();
  void cleanup();
  void test_initialization();
  void settersAndGetters();
};

#endif

Its compile output is as follows”
/home/puneet/puneet/office/alkimia/payment/backend/keyusermanagertest.cpp: In member function ‘void KeyUserManagerTest::settersAndGetters()’:
/home/puneet/puneet/office/alkimia/payment/backend/keyusermanagertest.cpp:52: error: no matching function for call to ‘StorageUserManager::StorageUserManager()’
/home/puneet/puneet/office/alkimia/payment/backend/storageusermanager.h:41: note: candidates are: StorageUserManager::StorageUserManager(QObject*)
/home/puneet/puneet/office/alkimia/payment/backend/storageusermanager.h:37: note: StorageUserManager::StorageUserManager(const StorageUserManager&)
/home/puneet/puneet/office/alkimia/payment/backend/keyusermanagertest.cpp:53: error: no matching function for call to ‘KeyUserManager::KeyUserManager(StorageUserManager*&)’
/home/puneet/puneet/office/alkimia/payment/backend/keyusermanager.h:44: note: candidates are: KeyUserManager::KeyUserManager(StorageUserManager*, QObject*)
/home/puneet/puneet/office/alkimia/payment/backend/keyusermanager.h:41: note: KeyUserManager::KeyUserManager(const KeyUserManager&)

Thanks

  • 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-24T15:49:45+00:00Added an answer on May 24, 2026 at 3:49 pm

    Add constructor to your KeyUserManagerTest –
    in header add

    KeyUserManagerTest (QObject* parent=0);
    

    and in cpp

    KeyUserManagerTest::KeyUserManagerTest(QObject* parent):QObject(parent){};
    

    QOBJECT macro does not create constructor for you!

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

Sidebar

Related Questions

I have declared a class variable in here void downloader_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) {
I have declared an enum in my server code, and would like my client
I have declared one variable in xslt, assigned some value to it but while
I have declared an external function with a GCC weak attribute in a .c
In my C# source code I may have declared integers as: int i =
I have a COM object written using the MS ATL library. I have declared
I have declared $func = array( 'a' => array( 'b' => function() { echo
I have declared a delegate for my cocoa application here : MyAppDelegate.h @interface MyAppDelegate
I have declared a static method in class category public static function getPrefixFromSubCategoyId($subCategoryId) {
Although I have declared the FooFactory class as Singleton, its class variable @@foo gets

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.