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

门户网站申请seo线上培训机构

门户网站申请,seo线上培训机构,app怎么制作视频,花生壳怎么建设网站目录 一.QPushButton 1.多选 2.互斥 3.设置菜单 4.图标按钮 4.1给按钮添加图标 4.2异形按钮 二.设置Qt样式表 一.QPushButton QPushButton是与QAbstractButton最接近的完全体按钮#xff0c;它具备QAbstractButton的所有特性#xff0c;并且支持设置菜单。 1.多选 …目录 一.QPushButton 1.多选 2.互斥 3.设置菜单 4.图标按钮 4.1给按钮添加图标 4.2异形按钮 二.设置Qt样式表 一.QPushButton QPushButton是与QAbstractButton最接近的完全体按钮它具备QAbstractButton的所有特性并且支持设置菜单。 1.多选 #include QApplication #include QMainWindow #include QPushButton #include QHBoxLayout #include QDebugint main(int argc, char *argv[]) {QApplication a(argc, argv);QMainWindow w;w.setWindowTitle(https://blog.csdn.net/caoshangpa);QWidget *centralWidget new QWidget();QHBoxLayout *hLayout new QHBoxLayout();QPushButton *button1 new QPushButton();button1-setText(button1);button1-setCheckable(true);button1-setStyleSheet(QPushButton{background: rgb(128, 128, 128);border: 1px solid rgb(50, 50, 50);color: white;width: 60px;height: 30px;}QPushButton:hover{background: rgb(150, 150, 150);}QPushButton:pressed{background: rgb(100, 100, 100);}QPushButton:checked{background: blue;});QPushButton *button2 new QPushButton();button2-setText(button2);button2-setCheckable(true);button2-setStyleSheet(QPushButton{background: rgb(128, 128, 128);border: 1px solid rgb(50, 50, 50);color: white;width: 60px;height: 30px;}QPushButton:hover{background: rgb(150, 150, 150);}QPushButton:pressed{background: rgb(100, 100, 100);}QPushButton:checked{background: blue;});QPushButton *button3 new QPushButton();button3-setText(button3);button3-setCheckable(true);button3-setStyleSheet(QPushButton{background: rgb(128, 128, 128);border: 1px solid rgb(50, 50, 50);color: white;height: 30px;}QPushButton:hover{background: rgb(150, 150, 150);}QPushButton:pressed{background: rgb(100, 100, 100);}QPushButton:checked{background: blue;});hLayout-addWidget(button1);hLayout-addWidget(button2);hLayout-addWidget(button3);centralWidget-setLayout(hLayout);w.setCentralWidget(centralWidget);w.resize(400, 200);w.show();return a.exec(); }QSS QPushButton{background: rgb(128, 128, 128);border: 1px solid rgb(50, 50, 50);color: white;width: 60px;height: 30px; } QPushButton:hover{background: rgb(150, 150, 150); } QPushButton:pressed{background: rgb(100, 100, 100); } QPushButton:checked{background: blue; } 2.互斥 只需在“多选”的基础上对每个按钮设置 button-setAutoExclusive(true); 3.设置菜单 #include QApplication #include QMainWindow #include QPushButton #include QPainter #include QHBoxLayout #include QMenu #include QDebugint main(int argc, char *argv[]) {QApplication a(argc, argv);QMainWindow w;w.setWindowTitle(https://blog.csdn.net/caoshangpa);QWidget *centralWidget new QWidget();QHBoxLayout *hLayout new QHBoxLayout();QPushButton *button1 new QPushButton();button1-setText(button1);button1-setStyleSheet(QPushButton{background: rgb(128, 128, 128);border: 1px solid rgb(50, 50, 50);color: white;width: 100px;height: 30px;text-align: left center;padding-left: 10px;}QPushButton:hover{background: rgb(150, 150, 150);}QPushButton:pressed{background: rgb(100, 100, 100);}QPushButton:checked{background: blue;}QPushButton::menu-indicator{subcontrol-position: right center;subcontrol-origin: padding;right: 10px;});QMenu *menu new QMenu();menu-addAction(QString::fromLocal8Bit(Open));menu-addAction(QString::fromLocal8Bit(Create));menu-addSeparator();menu-addAction(QString::fromLocal8Bit(Quit));button1-setMenu(menu);hLayout-addStretch();hLayout-addWidget(button1);hLayout-addStretch();centralWidget-setLayout(hLayout);w.setCentralWidget(centralWidget);w.resize(400, 200);w.show();return a.exec(); }QSS QPushButton{background: rgb(128, 128, 128);border: 1px solid rgb(50, 50, 50);color: white;width: 100px;height: 30px;text-align: left center;padding-left: 10px; } QPushButton:hover{background: rgb(150, 150, 150); } QPushButton:pressed{background: rgb(100, 100, 100); } QPushButton:checked{background: blue; } QPushButton::menu-indicator{subcontrol-position: right center;subcontrol-origin: padding;right: 10px; } 如果要使用自定义图标取代默认三角形QSS如下 QPushButton::menu-indicator{image: url(:/icons/arrow.png);subcontrol-position: right center;subcontrol-origin: padding;right: 10px; } 如果要去掉三角形QSS如下 QPushButton::menu-indicator{image: none;subcontrol-position: right center;subcontrol-origin: padding;right: 10px; } 4.图标按钮 4.1给按钮添加图标 #include QApplication #include QMainWindow #include QPushButton #include QPainter #include QHBoxLayout #include QIcon #include QDebugint main(int argc, char *argv[]) {QApplication a(argc, argv);QMainWindow w;w.setWindowTitle(https://blog.csdn.net/caoshangpa);QWidget *centralWidget new QWidget();QHBoxLayout *hLayout new QHBoxLayout();QPushButton *button1 new QPushButton();button1-setText(button1);button1-setIcon(QIcon(:/icons/AppIcon.png));button1-setIconSize(QSize(24, 24));button1-setStyleSheet(QPushButton{background: rgb(128, 128, 128);border: 1px solid rgb(50, 50, 50);color: white;width: 100px;height: 30px;}QPushButton:hover{background: rgb(150, 150, 150);}QPushButton:pressed{background: rgb(100, 100, 100);}QPushButton:checked{background: blue;});hLayout-addStretch();hLayout-addWidget(button1);hLayout-addStretch();centralWidget-setLayout(hLayout);w.setCentralWidget(centralWidget);w.resize(400, 200);w.show();return a.exec(); } QSS QPushButton{background: rgb(128, 128, 128);border: 1px solid rgb(50, 50, 50);color: white;width: 100px;height: 30px; } QPushButton:hover{background: rgb(150, 150, 150); } QPushButton:pressed{background: rgb(100, 100, 100); } QPushButton:checked{background: blue; } 4.2异形按钮 #include QApplication #include QMainWindow #include QPushButton #include QPainter #include QHBoxLayout #include QIcon #include QDebugint main(int argc, char *argv[]) {QApplication a(argc, argv);QMainWindow w;w.setWindowTitle(https://blog.csdn.net/caoshangpa);QWidget *centralWidget new QWidget();QHBoxLayout *hLayout new QHBoxLayout();QPushButton *button1 new QPushButton();button1-setStyleSheet(QPushButton{border: none;width: 100px;height: 100px;image: url(:/icons/dragon.png);}QPushButton:pressed{padding-top: 3px;padding-left: 3px;padding-bottom: -3px;padding-right: -3px});hLayout-addStretch();hLayout-addWidget(button1);hLayout-addStretch();centralWidget-setLayout(hLayout);w.setCentralWidget(centralWidget);w.resize(400, 200);w.show();return a.exec(); } QSS QPushButton{border: none;width: 100px;height: 100px;image: url(:/icons/dragon.png); } QPushButton:pressed{padding-top: 3px;padding-left: 3px;padding-bottom: -3px;padding-right: -3px } 龙头是背景透明的png图片在QSS中通过设置padding参数实现点击效果。需要注意的是这种异形按钮并不是真*异形只有龙头区域能点击的因为点击龙头边上的按钮区域也能产生点击效果。 二.设置Qt样式表 在上面的例子中我们用了Qt样式表即QSSQt StyleSheet除了调用控件的setStyleSheet函数来设置Qt样式表还能在Qt Designer中编辑控件的styleSheet属性如下图所示 但是这两种做法都是不推荐的只能在自己写Demo或做测试的时候使用。正确的做法是把QSS写在后缀为qss的文本文件中。下面是两种加载qss文件的方法 方法1 QFile file(:/qss/dark.qss); if (file.open(QFile::ReadOnly)) {QString qss QLatin1String(file.readAll());qApp-setStyleSheet(qss);file.close(); } 方法2 qApp-setStyleSheet(file:///:/qss/dark.qss); 方法2中这种直接读取qss文件的方式只支持qApp的setStyleSheet函数。 qApp是一个指向QApplication对象的全局指针因此别忘了#include QApplication 原文链接Qt6入门教程 13QPushButton-CSDN博客
http://www.pierceye.com/news/927928/

相关文章:

  • 苏州企业名录黄页新乡网站自然优化
  • 有哪些建设网站公司网站建设需求单
  • 招聘网站做销售用手机网站做app
  • 做一个网站 多少钱撤销网站备案
  • 建设网站的流程图企业工资管理系统软件
  • 个人网站空间大小可以做网站的语言
  • 网站设计需要哪些技术wap购物网站源码
  • 一个空间两个php网站新能源车排名前十名
  • 如何建设公司门户网站建站仅向商家提供技术服务
  • 全国城建中心官方网站广州市品牌网站建设怎么样
  • 做百度移动端网站排名软件有哪些漫画做的好的网站好
  • 网站建设的基本条件crm和erp的区别
  • 网站关键词优化费用wordpress开发架构
  • 都安网站建设南宁网站建设哪家公司实
  • 廊坊企业网站团队莱芜做网站
  • 如何让百度收录网站用什么软件开发手机app
  • 郑州哪里有做网站wordpress编辑页面模板
  • 网站定制要花多少钱电商设计类插画
  • 手把手做网站wordpress secondary title
  • 服装网站建设课程品牌网站怎么建立
  • 广州市网站建设怎么样企业网站上的二维码怎么获得
  • 网站建设与优化标准图片外链上传网站
  • 网站开发实战第二章网站搜索引擎怎么做
  • 网站建设的定位企业官网
  • 石大网页设计与网站建设客观题网站建设与制作布局
  • 成都智能建站模板品牌网站设计制作公司推荐
  • 出口贸易公司网站怎么做织梦php网站
  • 锦州建设工程信息网站wordpress 签到 插件下载
  • 枣庄定制网站建设公司移动端包括哪些
  • 品牌网站建设定位网页制作模板源代码免费