Results 1 to 3 of 3

Thread: QGroupBox: cannot access private member...

  1. #1
    Join Date
    May 2015
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows Android

    Default QGroupBox: cannot access private member...

    hey
    I have created a class which inherits from QGroupBox. At first it worked well, but after editing some Code I get the following Compiler Error (sry, that it's german):

    D:\Eigene Dateien\qt\Ablaufplan\aufgabe.h:56: Fehler: C2248: "QGroupBox::QGroupBox": Kein Zugriff auf private Member, dessen Deklaration in der QGroupBox-Klasse erfolgte.
    d:\qt\5.3\msvc2012_opengl\include\qtwidgets\qgroup box.h(103): Siehe Deklaration von 'QGroupBox::QGroupBox'
    d:\qt\5.3\msvc2012_opengl\include\qtwidgets\qgroup box.h(54): Siehe Deklaration von 'QGroupBox'
    Diese Diagnose trat in der vom Compiler generierten Funktion "Aufgabe::Aufgabe(const Aufgabe &)" auf.

    in qgroupbox.h(54) starts the definition of the Class and Line 103 contains the Marco Q_DISABLE_COPY(QGroupBox).

    For me it looks like the Compiler generates a function, in which the Object will be copied, but thats not allow due to the macro

    I have tried to run qmake and commented out all my Code, but it didn't help. I have no Idea how to solve the Problem and I don't know why the compiler wants to generate a new Constructor

    I Use Qt5.3 on Windows, the MSVC2012 Compiler and Qt Creator

    my actual Code:
    aufgabe.h
    Qt Code:
    1. #ifndef AUFGABE_H
    2. #define AUFGABE_H
    3.  
    4. #include <QGroupBox>
    5. #include <QVBoxLayout>
    6. #include <QTextBrowser>
    7. #include <QPushButton>
    8. #include <QCheckBox>
    9. #include <QDate>
    10. #include <QCalendarWidget>
    11.  
    12. class Aufgabe : public QGroupBox
    13. {
    14. Q_OBJECT
    15. public:
    16. /*enum aufgabenBereich{
    17.   Fertigung,
    18.   Eventvorbereitung,
    19.   Dokumentation,
    20.   Sonstiges
    21.   };*/
    22.  
    23. explicit Aufgabe(QWidget *parent = 0);
    24. ~Aufgabe();
    25. /*void changeStatus(int status);
    26. ...
    27.   void calenderResize(); //ändert die mindestgröße, solange der Kalender angezeigt wird.*/
    28. };
    29.  
    30. #endif // AUFGABE_H
    To copy to clipboard, switch view to plain text mode 

    aufgabe.cpp
    Qt Code:
    1. #include "aufgabe.h"
    2.  
    3. Aufgabe::Aufgabe(QWidget* parent) : QGroupBox(parent)
    4. {
    5. /*this->setMinimumSize(150,80);
    6.   deadline = new QDate();
    7. ...
    8.   setBackColor(); //einfärben*/
    9. }
    10.  
    11. Aufgabe::~Aufgabe()
    12. {
    13. /*delete layout;
    14.   delete discription;
    15.   delete showCalender;
    16.   delete deadlineEdit;
    17.   delete deadline;
    18.   delete editable;
    19.   delete ready;*/
    20. }
    21.  
    22. /*void Aufgabe::setText(const QString &text){
    23.  .....
    24. }*/
    To copy to clipboard, switch view to plain text mode 

    Hope anybody can help me

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QGroupBox: cannot access private member...

    Can you show how you are using that class?
    Maybe you are trying to copy an instance of Aufgabe somewhere.

    Cheers,
    _

  3. #3
    Join Date
    May 2015
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: QGroupBox: cannot access private member...

    okay. There was the error. I had a Line called:
    void addAufgabe(Aufgabe aufg);

    The error disappear when i changed the line to:
    void addAufgabe(Aufgabe* aufg);


    Thanks for the hint.

Similar Threads

  1. Replies: 9
    Last Post: 13th May 2014, 14:02
  2. Replies: 4
    Last Post: 10th February 2010, 06:56
  3. Replies: 2
    Last Post: 26th May 2009, 15:04
  4. Std iterator as private member variable
    By Michiel in forum General Programming
    Replies: 5
    Last Post: 21st April 2006, 15:27
  5. QTime private member mds means what?
    By jamadagni in forum Qt Programming
    Replies: 2
    Last Post: 24th March 2006, 18:08

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.