0

As the title stands I get this error within content of this snippet:

class NewTaskDialog : public QDialog

It was working just fine earlier, but error started showing up when I added method:

void MainWindow::saveButtonClicked(NewTaskDialog dialogWindow)
jahsiotr
  • 141
  • 1
  • 11

2 Answers2

0

Use a pointer to the QDialog instead. The QDialog class has the copy constructor defined as private to try prevent you from passing a QDialog by value since you should never do that.

What's the use of the private copy constructor in c++

Community
  • 1
  • 1
drescherjm
  • 10,365
  • 5
  • 44
  • 64
0

Your syntax for saveButtonClicked creates a copy of the NewTaskDialog that's passed to it. You can't copy QWidgets unless you create a cloning function that explicitly provides the exact functionality you seek. QWidget's constructor is private.

You must pass a pointer

void MainWindow::saveButtonClicked(NewTaskDialog* dialogWindow)

or a reference. Using the pointer is the standard Qt way.

Community
  • 1
  • 1
Phlucious
  • 3,704
  • 28
  • 61