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

刘强东称软弱的人无法成就伟大公司seo外链在线提交工具

刘强东称软弱的人无法成就伟大公司,seo外链在线提交工具,建设银行个人,用帝国做的网站只收录首页一、概述 QGraphicsGridLayout是Qt框架中用于在QGraphicsScene中布置图形项的一个布局管理器。它类似于QWidget中的QGridLayout,但主要处理的是QGraphicsItem和QGraphicsWidget等图形项。通过合理设置网格位置、伸缩因子和尺寸,可以实现复杂而灵活的布局…

一、概述

QGraphicsGridLayout是Qt框架中用于在QGraphicsScene中布置图形项的一个布局管理器。它类似于QWidget中的QGridLayout,但主要处理的是QGraphicsItem和QGraphicsWidget等图形项。通过合理设置网格位置、伸缩因子和尺寸,可以实现复杂而灵活的布局管理。它允许开发者在指定的行和列中放置图形项,并通过激活布局来自动计算每个图形项的位置和大小。

二、QGraphicsGridLayout类介绍

1、构造函数

  • QGraphicsGridLayout(): 默认构造函数,创建一个空的网格布局。

2、主要方法

  • void addItem(QGraphicsLayoutItem *item, int row, int column, int rowSpan, int columnSpan, Qt::Alignment alignment = Qt::Alignment()):将指定的图形项添加到指定的行和列,并可以选择跨越多行或多列以及指定对齐方式。
  • void addItem(QGraphicsLayoutItem *item, int row, int column, Qt::Alignment alignment = Qt::Alignment()):将指定的图形项添加到指定的行和列,并可以指定对齐方式。
  • QGraphicsLayoutItem *itemAt(int row, int column) const:返回指定位置的图形项。
  • void removeItem(QGraphicsLayoutItem *item):移除指定的 图形项。
  • void setColumnMinimumWidth(int column, qreal width):指定列的最小宽度。
  • void setRowMinimumHeight(int row, qreal height):指定行的最小高度。
  • void setColumnStretchFactor(int column, int stretch):指定列的拉伸因子。
  • void setRowStretchFactor(int row, int stretch):指定行的拉伸因子。
  • void setVerticalSpacing(qreal spacing):设置行与行之间的垂直间距。
  • void setHorizontalSpacing(qreal spacing):设置行与行之间的水平间距。
  • int rowCount() const:返回行的数量。
  • int columnCount() const:返回列的数量。

QGraphicsView *view = new QGraphicsView;
QGraphicsScene *scene = new QGraphicsScene;
QGraphicsWidget *container = new QGraphicsWidget;
QGraphicsGridLayout *gridLayout = new QGraphicsGridLayout;scene->setSceneRect(0, 0, 500, 500);
view->setScene(scene);// 创建一些按钮并添加到网格布局中
QPushButton *button1 = new QPushButton("Button 1");
QPushButton *button2 = new QPushButton("Button 2");
QPushButton *button3 = new QPushButton("Button 3");
QPushButton *button4 = new QPushButton("Button 4");// 使用 QGraphicsProxyWidget 将按钮添加到场景中
QGraphicsProxyWidget *proxy1 = scene->addWidget(button1);
QGraphicsProxyWidget *proxy2 = scene->addWidget(button2);
QGraphicsProxyWidget *proxy3 = scene->addWidget(button3);
QGraphicsProxyWidget *proxy4 = scene->addWidget(button4);// 将按钮添加到网格布局中
gridLayout->addItem(proxy1, 0, 0);
gridLayout->addItem(proxy2, 0, 1);
gridLayout->addItem(proxy3, 1, 0);
gridLayout->addItem(proxy4, 1, 1);// 设置网格布局的行和列伸缩因子
gridLayout->setRowStretchFactor(0, 1);
gridLayout->setRowStretchFactor(1, 1);
gridLayout->setColumnStretchFactor(0, 1);
gridLayout->setColumnStretchFactor(1, 1);// 将网格布局设置为容器的布局
container->setLayout(gridLayout);// 将容器添加到场景
scene->addItem(container);
view->show();

觉得有帮助的话,打赏一下呗。。

           

http://www.yayakq.cn/news/901496/

相关文章:

  • 影响网站速度的因素门户网站怎么创建
  • 修改wordpress 2mseo在线教程
  • 北京高端定制网站建设工信部网站备案查询步骤详解
  • 烟台企业宣传片制作公司优化大师的使用方法
  • 自己的网站怎么做关键词优化展示型网站可以做推广的吗
  • 公司网站域名如何建立wordpress创建页面模板
  • 凡科网做网站设计网站faq需注意
  • 公司网站建设维护管理办法获取网站访问量
  • 做a的视频在线观看网站建设网站图片素材
  • 网站运营与维护是什么小店怎么做网站
  • 做美剧盗版网站网站开发硬件需求
  • 安徽建设厅官方网站中国化工网官网 网站建设
  • phpcms仿站教程昆明网页制作开发
  • 自个网站大型电商网站开发实践
  • 英文网站建设60杭州有哪些网站建设
  • iis 默认网站删除陇南做网站
  • 什么网站可以做推广网站建设的要求和策划
  • 学生做网站的软件建设网站明细报价表
  • 政务公开网站项目建设书ai设计网站
  • 公司网站建设济南站长工具seo推广 站长工具查询
  • 济宁网站建设软件开发布吉做网站公司
  • 柳市网站建设南方网通g3云推广
  • 网站建设 印花税阿里巴巴采购网
  • 玉溪市建设厅官方网站天津建设工程信息网招标代理资格
  • 正规网站开发公司.wordpress淘宝客模版
  • 电商网站建设讯息一个网站多个数据库
  • 江门企业免费建站专业简历制作
  • 什么是网站功能做个网站得花多少钱
  • 有哪些网站有收录做红酒的商行广州pc网站建设
  • 工程承包网站有哪些怎么看一个网站做的好不好