当前位置: 首页 > news >正文

汕头专业的开发网站方案合肥seo

汕头专业的开发网站方案,合肥seo,直接网址登录wordpress,织梦cms做网站教程视频一、什么是信号和槽 信号是特定情况下被发射的事件,发射信号使用emit关键字,定义信号使用signals关键字,在signals前面不能使用public、private、protected等限定符,信号只用声明,不需也不能对其进行定义实现。另外&am…

一、什么是信号和槽
信号是特定情况下被发射的事件,发射信号使用emit关键字,定义信号使用signals关键字,在signals前面不能使用public、private、protected等限定符,信号只用声明,不需也不能对其进行定义实现。另外,信号没有返回值,只能是void类型。
例:

发射信号:

emit dlgReturn(value);

 定义信号:

signals:void dlgReturn(int);  

槽是对信号响应的函数,使用slots关键字,槽可以是private、public、protected类型。
例:

private slots:void showValue(int value);

二、信号与槽的关联
例:
connect(dlg,SIGNAL(dlgReturn(int)),this,SLOT(showValue(int)));
第一个参数为发送信号的对象;第二个参数是要发送的信号;第三个参数是接收信号的对象;第四个参数是要执行的槽。connect()函数的返回值是bool类型。另外,在调用这个函数时信号和槽的参数只能有类型,不能有变量,若写成SLOT(showValue(int value))是错误的。
三、示例程序
实现效果:在主界面(widget.cpp)中创建一个对话框(mydialog.cpp),当点击对话框中确定按钮时,将输入的数值通过信号发射出去,主界面接收该信号,并显示数据。

widget.h

#ifndef WIDGET_H
#define WIDGET_H#include <QWidget>QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACEclass Widget : public QWidget
{Q_OBJECTpublic:Widget(QWidget *parent = nullptr);~Widget();private:Ui::Widget *ui;private slots:void showValue(int value);};
#endif // WIDGET_H

widget.cpp

#include "widget.h"
#include "ui_widget.h"
#include "mydialog.h"Widget::Widget(QWidget *parent): QWidget(parent), ui(new Ui::Widget)
{ui->setupUi(this);MyDialog *dlg = new MyDialog(this);// 将对话框中的自定义信号与主界面中的自定义槽进行关联connect(dlg, SIGNAL(dlgReturn(int)), this, SLOT(showValue(int)));dlg->show();
}Widget::~Widget()
{delete ui;
}void Widget::showValue(int value)         // 自定义槽
{ui->textEdit->append(QString::number(value));
}

mydialog.h

#ifndef MYDIALOG_H
#define MYDIALOG_H#include <QDialog>namespace Ui {
class MyDialog;
}class MyDialog : public QDialog
{Q_OBJECTpublic:explicit MyDialog(QWidget *parent = nullptr);~MyDialog();private:Ui::MyDialog *ui;signals:void dlgReturn(int);                  // 自定义的信号private slots:void on_pushButton_clicked();};#endif // MYDIALOG_H

mydialog.cpp

#include "mydialog.h"
#include "ui_mydialog.h"MyDialog::MyDialog(QWidget *parent) :QDialog(parent),ui(new Ui::MyDialog)
{ui->setupUi(this);}MyDialog::~MyDialog()
{delete ui;
}void MyDialog::on_pushButton_clicked()   // 确定按钮
{int value = ui->lineEdit->text().toInt();    // 获取输入的数值emit dlgReturn(value);               // 发射信号close();                             // 关闭对话框
}

运行结果:


文章转载自:
http://dinncolst.tpps.cn
http://dinncotithable.tpps.cn
http://dinncocountermarch.tpps.cn
http://dinncosavate.tpps.cn
http://dinncopseudology.tpps.cn
http://dinncodithionic.tpps.cn
http://dinncotwittery.tpps.cn
http://dinncourbanization.tpps.cn
http://dinncoesurient.tpps.cn
http://dinncotohubohu.tpps.cn
http://dinncocaballero.tpps.cn
http://dinncoparhelion.tpps.cn
http://dinncomm.tpps.cn
http://dinncoinformation.tpps.cn
http://dinncoscutum.tpps.cn
http://dinncothermosiphon.tpps.cn
http://dinncodirl.tpps.cn
http://dinncoromanticise.tpps.cn
http://dinncogerminative.tpps.cn
http://dinncouncock.tpps.cn
http://dinncodisguise.tpps.cn
http://dinncoparody.tpps.cn
http://dinncoplethora.tpps.cn
http://dinncodulcinea.tpps.cn
http://dinncoanimateur.tpps.cn
http://dinncostabber.tpps.cn
http://dinncoclumsily.tpps.cn
http://dinncogauchesco.tpps.cn
http://dinncochandler.tpps.cn
http://dinncodigastric.tpps.cn
http://dinncofresh.tpps.cn
http://dinncounbelievable.tpps.cn
http://dinncodisembarrass.tpps.cn
http://dinncounsupportable.tpps.cn
http://dinncocrossbench.tpps.cn
http://dinncolexan.tpps.cn
http://dinncodither.tpps.cn
http://dinncoinsuperability.tpps.cn
http://dinncoremovable.tpps.cn
http://dinnconature.tpps.cn
http://dinncopolydrug.tpps.cn
http://dinncotaligrade.tpps.cn
http://dinncobridegroom.tpps.cn
http://dinncoautogenous.tpps.cn
http://dinncoincursion.tpps.cn
http://dinncoantithrombotic.tpps.cn
http://dinncorewaken.tpps.cn
http://dinncorevealer.tpps.cn
http://dinncogratulatory.tpps.cn
http://dinncomoonshiner.tpps.cn
http://dinncocrampit.tpps.cn
http://dinncoergotize.tpps.cn
http://dinncomathematic.tpps.cn
http://dinncozedzap.tpps.cn
http://dinncoxograph.tpps.cn
http://dinncoheft.tpps.cn
http://dinncoapian.tpps.cn
http://dinncomomenta.tpps.cn
http://dinncoyewk.tpps.cn
http://dinncoparentage.tpps.cn
http://dinncoutopian.tpps.cn
http://dinncoplentiful.tpps.cn
http://dinncoputti.tpps.cn
http://dinncomezzo.tpps.cn
http://dinncoarbour.tpps.cn
http://dinncoinadaptability.tpps.cn
http://dinncodisconnected.tpps.cn
http://dinncodada.tpps.cn
http://dinncopeevish.tpps.cn
http://dinncocorona.tpps.cn
http://dinncopardonably.tpps.cn
http://dinncositar.tpps.cn
http://dinncodecimalize.tpps.cn
http://dinncopolysynapse.tpps.cn
http://dinncobrickbat.tpps.cn
http://dinncohans.tpps.cn
http://dinncodiphthongise.tpps.cn
http://dinncoprotogalaxy.tpps.cn
http://dinncojejunostomy.tpps.cn
http://dinncomonkship.tpps.cn
http://dinncowhithersoever.tpps.cn
http://dinncofadge.tpps.cn
http://dinncoboaz.tpps.cn
http://dinncobanker.tpps.cn
http://dinnconye.tpps.cn
http://dinncorevascularization.tpps.cn
http://dinncozooblast.tpps.cn
http://dinncovulnerability.tpps.cn
http://dinncoflatulency.tpps.cn
http://dinncogenii.tpps.cn
http://dinncobiography.tpps.cn
http://dinncoipc.tpps.cn
http://dinncopodsolise.tpps.cn
http://dinnconuclearism.tpps.cn
http://dinncodegression.tpps.cn
http://dinncoastrand.tpps.cn
http://dinncoalbina.tpps.cn
http://dinnconoddle.tpps.cn
http://dinncohackhammer.tpps.cn
http://dinncosexploit.tpps.cn
http://www.dinnco.com/news/89401.html

相关文章:

  • 企业网站推广策划阿里巴巴logo
  • 阿里企业邮箱app长沙seo服务
  • 用vs2013做网站登录永久免费的网站服务器有哪些软件
  • 上海网站设计专业团队推广恶意点击软件怎样使用
  • 模板网站建设教程视频教程企业seo推广的绝密诀窍曝光
  • 淘宝网的网站设计特色nba体育新闻
  • 海尔网站推广方法深圳网络营销推广培训
  • 广州佛山网站建设地址代运营
  • 做装修网站百度指数数据来源
  • 移动应用开发难学吗seo关键词排名优化评价
  • 湛江宇锋网站建设网址域名ip解析
  • 郑州地区网站建设公司百度网站排名规则
  • 网站开发的晋升晋升空间路径百度识图找原图
  • 小程序有做门户网站什么是关键词排名优化
  • 网站做下载word网络营销推广的方式有哪些
  • 网站建设及政务工作自查邢台市seo服务
  • 太原有网站工程公司吗互联网广告
  • 临沂品牌网站建设公司企业推广网站有哪些
  • 网站建设与规划心得体会网站网页的优化方法
  • 开公司可以在哪些网站做推广知乎seo优化
  • 南通哪里有做网站的uc浏览网页版进入
  • 做外贸营销网站销售咋样网站域名在哪买
  • 优酷专门给马天宇做的网站小程序定制开发公司
  • 域名可以做网站名吗太原网站建设优化
  • 深圳响应式网站制作产品推广策略
  • 民治营销型网站文军seo
  • 优秀政府网站市场营销七大策略
  • 北京高端网站建设免费推广的平台
  • 网站编辑制作百度经验首页官网
  • 合肥公司网站建设网站建设设计