Results 1 to 6 of 6

Thread: Multiple inheritance problem

  1. #1
    Join Date
    Apr 2021
    Posts
    27
    Thanks
    5

    Default Multiple inheritance problem

    I have created a ChartView class that inherits "QChartView" and "QObject".

    I need to generate a SIGNAL from the ChartView class and connect to the MainWindow SLOT.

    However, currently, I am getting the following error.

    "direct base 'QObject' is inaccessible due to ambiguity"

    Qt Code:
    1. class ChartView : public QChartView , public QObject
    2. {
    3. Q_OBJECT
    4. private:
    5.  
    6. }
    To copy to clipboard, switch view to plain text mode 

    If I don't add QObject, then SIGNAL and SLOT don't work.

    Any suggestion?
    Attached Images Attached Images

  2. #2
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    552
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Multiple inheritance problem

    Quote Originally Posted by Mohsin View Post
    If I don't add QObject, then SIGNAL and SLOT don't work.
    What does this mean? You don't need to derive from QObject since QChartView also has QObject as base class.

  3. #3
    Join Date
    Apr 2021
    Posts
    27
    Thanks
    5

    Default Re: Multiple inheritance problem

    Quote Originally Posted by ChristianEhrlicher View Post
    What does this mean? You don't need to derive from QObject since QChartView also has QObject as base class.
    I am getting errors (shown in the image) even when I use the following code

    Qt Code:
    1. class ChartView : public QChartView
    2. {
    3. Q_OBJECT
    4.  
    5. signals:
    6. void updateGraphOrder();
    7.  
    8.  
    9. }
    To copy to clipboard, switch view to plain text mode 
    Attached Images Attached Images
    Last edited by Mohsin; 8th June 2021 at 02:34.

  4. #4
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    552
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Multiple inheritance problem

    What build system do you use? You most likely forgot to include moc_charview.h

  5. #5
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    381
    Thanks
    97
    Thanked 14 Times in 14 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Multiple inheritance problem

    Did you try running qmake again and then a clean rebuild?

  6. #6
    Join Date
    Apr 2021
    Posts
    27
    Thanks
    5

    Default Re: Multiple inheritance problem

    I tried but it didn't work.

    The attached image contains the information about my system and Qt Version.
    Attached Images Attached Images

Similar Threads

  1. Multiple inheritance
    By Nunkij in forum Qt Programming
    Replies: 3
    Last Post: 12th May 2021, 16:05
  2. Multiple inheritance problem
    By DURGAPRASAD NEELAM in forum Qt Programming
    Replies: 1
    Last Post: 6th November 2014, 14:49
  3. Multiple Inheritance & Qt
    By kefeng.chen in forum Qt Programming
    Replies: 8
    Last Post: 21st March 2006, 18:37
  4. Multiple inheritance & Qt
    By dublet in forum Qt Programming
    Replies: 11
    Last Post: 8th March 2006, 08:12
  5. Multiple Inheritance
    By sunil.thaha in forum General Programming
    Replies: 4
    Last Post: 21st February 2006, 04:00

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.