PDA

View Full Version : QGroupBox: cannot access private member...



PCSH
11th May 2015, 22:25
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

#ifndef AUFGABE_H
#define AUFGABE_H

#include <QGroupBox>
#include <QVBoxLayout>
#include <QTextBrowser>
#include <QPushButton>
#include <QCheckBox>
#include <QDate>
#include <QCalendarWidget>

class Aufgabe : public QGroupBox
{
Q_OBJECT
public:
/*enum aufgabenBereich{
Fertigung,
Eventvorbereitung,
Dokumentation,
Sonstiges
};*/

explicit Aufgabe(QWidget *parent = 0);
~Aufgabe();
/*void changeStatus(int status);
...
void calenderResize(); //ändert die mindestgröße, solange der Kalender angezeigt wird.*/
};

#endif // AUFGABE_H

aufgabe.cpp

#include "aufgabe.h"

Aufgabe::Aufgabe(QWidget* parent) : QGroupBox(parent)
{
/*this->setMinimumSize(150,80);
deadline = new QDate();
...
setBackColor(); //einfärben*/
}

Aufgabe::~Aufgabe()
{
/*delete layout;
delete discription;
delete showCalender;
delete deadlineEdit;
delete deadline;
delete editable;
delete ready;*/
}

/*void Aufgabe::setText(const QString &text){
.....
}*/

Hope anybody can help me

anda_skoa
12th May 2015, 07:48
Can you show how you are using that class?
Maybe you are trying to copy an instance of Aufgabe somewhere.

Cheers,
_

PCSH
12th May 2015, 10:28
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.