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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:43:49+00:00 2026-06-09T01:43:49+00:00

I’m using Qt (which I’m new to) 4.8.2, with Visual Studio, and I have

  • 0

I’m using Qt (which I’m new to) 4.8.2, with Visual Studio, and I have created a base class named “Contact”. I don’t want this class to be Qt-exclusive, so my intention was to make another class “QContact” that will inherit “Contact”, and QObject and deal with all the Qt-related business, such as the Q_OBJECT macro etc.

Unfortunately when I inherited, the build failed, saying:

moc_QContact.cpp(53): error C2039: 'staticMetaObject' : is not a member of 'Contact'
moc_QContact.cpp(75): error C2039: 'qt_metacast' : is not a member of 'Contact'
moc_QContact.cpp(80): error C2039: 'qt_metacall' : is not a member of 'Contact'

I did a little research on the web and found out that you can’t derive a Qt class from non-Qt class. so to fix it, “Contact” could inherit “QObject” (I tried, it worked). but doing so will make it exclusive to Qt which is my problem.

So what I ask is this: How can you make a non-Qt base class for a Qt class?

Thank you.

  • 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-09T01:43:51+00:00Added an answer on June 9, 2026 at 1:43 am

    You can derive your class from QObject and from other classes that don’t derive from it, but QObject needs to be the first base class in the base classes list.

    So this is wrong:

    class QContact: public Contact, public QObject {};
    

    You need to write it as

    class QContact: public QObject, public Contact {};
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a text area in my form which accepts all possible characters from
I have thousands of HTML files to process using Groovy/Java and I need 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.