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

行业网站特点淄博网站优化服务

行业网站特点,淄博网站优化服务,清远市最新消息,付费主题wordpress1 内置对话框 标准对话框样式 内置对话框基类 QColorDialog, QErrorMessage QFileDialog QFontDialog QInputDialog QMessageBox QProgressDialogQDialog Class帮助文档 示例#xff1a;各按钮激发对话框实现基类提供的各效果 第一步#xff1a;实现组件布局各按钮激发对话框实现基类提供的各效果 第一步实现组件布局 第二步实现信号与槽函数 文件静态成员方法  打印实现使用qdebug 代码 #ifndef WIDGET_H #define WIDGET_H#include QWidget #include QPushButton #include QTextEdit#includeQColorDialog #includeQErrorMessage #includeQFileDialog #includeQFontDialog #includeQInputDialog #includeQMessageBox #includeQProgressDialog#include QDebugclass Widget : public QWidget {Q_OBJECTpublic:Widget(QWidget *parent 0);~Widget(); public slots:void setcolorf(){QColor c QColorDialog::getColor();te-setTextColor(c);}void showerr(){QErrorMessage *msg QErrorMessage::qtHandler();msg-showMessage(EEEEEEEE);}void getfile(){QString filename QFileDialog::getOpenFileName();qDebug()filename; //qt中打印方法te-setText(filename);}void setfont(){bool ok;QFont myfont QFontDialog::getFont(ok);if(ok)te-setFont(myfont);}void getstr(){QString str QInputDialog::getText(this, xxxx,yyyyy);te-setText(str);}void showmsg(){QMessageBox::information(this, vvvv, hello, AAA);}void showprogress(){QProgressDialog p;p.setValue(50);p.exec();}private:QPushButton *btcolor;QPushButton *bterrm;QPushButton *btfile;QPushButton *btfont;QPushButton *btinput;QPushButton *btmsg;QPushButton *btprg;QTextEdit *te;};#endif // WIDGET_H#include widget.h #include QVBoxLayout #include QHBoxLayoutWidget::Widget(QWidget *parent): QWidget(parent) {btcolor new QPushButton(setcolor);bterrm new QPushButton(errmsg);btfile new QPushButton(getfile);btfont new QPushButton(setfont);btinput new QPushButton(getstr);btmsg new QPushButton(msg);btprg new QPushButton(progress);te new QTextEdit;QVBoxLayout *vbox new QVBoxLayout;vbox-addWidget(btcolor);vbox-addWidget(bterrm);vbox-addWidget(btfile);vbox-addWidget(btfont);vbox-addWidget(btinput);vbox-addWidget(btmsg);vbox-addWidget(btprg);QHBoxLayout *mainbox new QHBoxLayout;mainbox-addLayout(vbox);mainbox-addWidget(te);this-setLayout(mainbox);connect(btcolor, SIGNAL(clicked(bool)), this, SLOT(setcolorf()));connect(bterrm, SIGNAL(clicked(bool)), this, SLOT(showerr()));connect(btfile, SIGNAL(clicked(bool)), this, SLOT(getfile()));connect(btfont, SIGNAL(clicked(bool)), this, SLOT(setfont()));connect(btinput, SIGNAL(clicked(bool)), this, SLOT(getstr()));connect(btmsg, SIGNAL(clicked(bool)), this, SLOT(showmsg()));connect(btprg, SIGNAL(clicked(bool)), this, SLOT(showprogress()));}Widget::~Widget() {}2 自定义对话框  现象模态显示前面不关后面不关小框可以卡其后面的态 有时候对于弹出对话框可以点确定关闭可以点X全部关闭那么这时候需要实现自定义对话框  添加新文件添加C 文件添加 姓名基类 生成myQdialog的cpp和.h文件需要用到信号与槽Q_OBJEC myqdialog.h #ifndef MYQDIALOG_H #define MYQDIALOG_H#include QDialog #include QLineEdit #include QPushButtonclass myQDialog : public QDialog {Q_OBJECT public:myQDialog();public slots:void ok_pushed(){stat true;close();}public:static int getstat(){myQDialog a;a.exec();return a.stat;}private:QLineEdit *le;QPushButton *pb;int stat; };#endif // MYQDIALOG_Hmyqdialog.cpp #include myqdialog.h #include QVBoxLayoutmyQDialog::myQDialog() {le new QLineEdit(aaaaaa);pb new QPushButton(OK);QVBoxLayout *vbox new QVBoxLayout;vbox-addWidget(le);vbox-addWidget(pb);setLayout(vbox);stat false;connect(pb, SIGNAL(clicked(bool)), this, SLOT(ok_pushed())); }widget.h #ifndef WIDGET_H #define WIDGET_H#include QWidgetclass Widget : public QWidget {Q_OBJECTpublic:Widget(QWidget *parent 0);~Widget(); };#endif // WIDGET_Hwidget.cpp #include widget.h #include QWidget #include QDialog #include myqdialog.hWidget::Widget(QWidget *parent): QWidget(parent) { #if 0myQDialog a;a.setFixedSize(100, 100);a.exec();if(!a.stat)exit(0);#endifint s myQDialog::getstat();if(!s)exit(0); }Widget::~Widget() {}
http://www.zqtcl.cn/news/881873/

相关文章:

  • 网站备案幕布拍照是什么莱芜网络推广公司服务
  • 招个网站建设维护国家高新技术企业官网
  • 建设医疗网站做企业官网哪家公司好
  • 网站建设常见问题及解决办法站长网站大全
  • 二手网站建设模块500做网站
  • 建设展示型网站公司哪家好广告制作费和广告服务费区别
  • 网站排版设计欣赏网站建设制作设计seo优化南宁
  • 长春网站建设公司十佳wordpress在哪注册
  • 手机号码定位网站开发世界知名外贸网站
  • 广西南宁网站建设排行榜建设一个视频网站己18
  • 以小说名字做网站的小说网最热门的网页游戏排行
  • 微网站菜单商品详情页面模板html
  • 免费word模板网站WordPress用户聊天功能
  • 网站显示图片标记wordpress文章分类div布局
  • 专业网站建设公司哪家专业阿里云二级域名建设网站
  • 返利网站怎么做手机网页前端开发
  • 做家教去什么网站人际网络网络营销是什么
  • 潮州外贸网站建设网站qq在线状态
  • 旅游网站开发背景及意义湖南城市建设网站
  • 西安网站开发托管代运营wordpress给外部链接加上跳转
  • 网站设计深圳企业为什么做网站素材
  • 网站顶部地图代码怎么做的家居装修
  • 网站后台不能修改网站哪家公司做的
  • 360网站建设官网致远oa办公系统官网
  • 南宁 做网站网站建立计划书
  • 兰亭集势网站模板宿迁房产
  • 网站建设开源苏州做网站优化哪家好
  • 自己的电脑做网站空间视屏互联网站备案管理工作方案 工信部
  • 移动网站设计尺寸在什么网站做外贸
  • 中外网站建设区别绵阳市城市建设档案馆网站