Fehler:'class QWidget QWidget::QWidget' is inaccessible ??



  • Hallo,
    ich hab ein seltsames Problem bei meinem Qt-Programm:

    BeeinflussbaresPObjekt.h

    #ifndef BEEINFLUSSBARESPOBJEKT_H
    #define BEEINFLUSSBARESPOBJEKT_H
    
    #include "physischesgobjekt.h"
    
    class BeeinflussbaresPObjekt : public PhysischesGObjekt
    {
    
    public:
        BeeinflussbaresPObjekt(QWidget *parent, std::string bildName, int x, int y, int b, int h);
    
    };
    
    #endif // BEEINFLUSSBARESPOBJEKT_H
    

    Bei dem Konstruktor krieg ich diese Fehlermeldung:

    /usr/include/qt4/QtGui/qwidget.h:148: Fehler:'class QWidget QWidget::QWidget' is inaccessible
    
    /home/.../JumpnRun/beeinflussbarespobjekt.h:10: Fehler:within this context
    

    Wenn ich die Vererbung von PhysischesGObjekt wegmache oder kein QWidget verwende, gibt es keinen Fehler.

    Hier der Rest:

    PhysischesGObjekt.h

    #ifndef PHYSISCHESGOBJEKT_H
    #define PHYSISCHESGOBJEKT_H
    
    #include "grafikobjekt.h"
    
    class PhysischesGObjekt : GrafikObjekt
    {
    
    public:
        PhysischesGObjekt(QWidget *parent, std::string bildName, int x, int y, int b, int h);
    
    };
    
    #endif // PHYSISCHESGOBJEKT_H
    

    GrafikObjekt.h

    #ifndef GRAFIKOBJEKT_H
    #define GRAFIKOBJEKT_H
    
    #include <QLabel>
    
    class GrafikObjekt : public QLabel
    {
    
        Q_OBJECT
    
    public:
        explicit GrafikObjekt(QWidget *parent, std::string bildName, int x, int y, int b, int h);
    
    };
    
    #endif // GRAFIKOBJEKT_H
    


  • Jetzt , wo ich den Code hier seh:
    Ich hab "PhysischesGObjekt : GrafikObjekt" statt "PhysischesGObjekt : public GrafikObjekt" geschrieben. Alles ok jetzt.


Anmelden zum Antworten