急急急!高手请进

「已注销」 「已注销」 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
#ifndef DIALOG_H
#define DIALOG_H

#include <QtGui/QDialog>
#include<QKeyEvent>
#include<pageone.h>
class Dialog : public QDialog
{
Q_OBJECT

public:
Dialog(QWidget *parent = 0);
~Dialog();
private:
void keyPressEvent(QKeyEvent *event);
PageOne *page;
signals:
void del();


};

#endif // DIALOG_H



#include <QDialog>
#include<QLabel>
class PageOne : public QDialog
{
Q_OBJECT
public:
explicit PageOne(QWidget *parent = 0);

signals:

public slots:

private:
QLabel *label;
protected slots:
void ShowLabel();


};


#include "dialog.h"
#include<pageone.h>
Dialog::Dialog(QWidget *parent)
: QDialog(parent)
{ page=new PageOne(this);
connect(this,SIGNAL(del()),page,SLOT(ShowLabel()));
}

Dialog::~Dialog()
{

}

void Dialog::keyPressEvent(QKeyEvent *event)
{if(event->key()==Qt::Key_1)
emit del();

}


#include "pageone.h"
#include<QDebug>
PageOne::PageOne(QWidget *parent) :
QDialog(parent)
{label=new QLabel("the first page",this);
}

void PageOne::ShowLabel()
{ label->show();
qDebug()<<"afg";
}


我通过按1然后在Dialog里面显示PageOne的label,但是显示不出来,不知道是什么问题,请高手指点。
...全文

相关推荐

评论 14
收藏 已收藏
分享
返回顶部
「已注销」
Qt 21,503 成员 26,693 内容