• 6335阅读
  • 4回复

[提问]error: ‘QDialog::QDialog(const QDialog&)’ is private [复制链接]

上一主题 下一主题
离线lccycc
 
只看楼主 倒序阅读 楼主  发表于: 2011-04-27
error: within this context
class Dialog_Pane : public QDialog

help!!


离线quser
只看该作者 1楼 发表于: 2011-04-27
贴个构造函数的代码来
离线dbzhang800

只看该作者 2楼 发表于: 2011-04-27
引用楼主lccycc于2011-04-27 13:06发表的 error: ‘QDialog::QDialog(const QDialog&)’ is private :
error: within this context
class Dialog_Pane : public QDialog
help!!
.......

注意看Manual:

[align=auto]QObject has neither a copy constructor nor an assignment operator. This is by design. Actually, they are declared, but in a private section with the macroQ_DISABLE_COPY(). In fact, all Qt classes derived from QObject (direct or indirect) use this macro to declare their copy constructor and assignment operator to be private. The reasoning is found in the discussion on Identity vs Value on the Qt Object Model page.

离线lccycc
只看该作者 3楼 发表于: 2011-04-27
回 1楼(quser) 的帖子
Dialog_Pane(QDialog *belong):QDialog()
    {
        this->belong=belong;
        pidLabel=new QLabel(tr("the speaker id"));
        text=new QTextEdit();
        lineEdit=new QLineEdit();
        deleteit=new QPushButton(tr("delete it"));
        QVBoxLayout *l=new QVBoxLayout;
        l->addWidget(pidLabel);
        l->addWidget(lineEdit);
        l->addWidget(text);
        l->addWidget(deleteit);
        setLayout(l);
//        connect(deleteit,SIGNAL(clicked()),this,SIGNAL(dele()));
    }
Thank you very much Orz Orz
离线lccycc
只看该作者 4楼 发表于: 2011-04-27
回 2楼(dbzhang800) 的帖子
It seems that I should use Dialog* rather than Dialog.
It's solved. Thank you again!
快速回复
限100 字节
 
上一个 下一个