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

两学一做专题网站介绍网站域名最便宜

两学一做专题网站介绍,网站域名最便宜,企业解决方案业务是什么,如皋做网站的公司一、概述 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/703510/

相关文章:

  • 用vue做pc端网站好吗企业seo可以达到怎样的效果
  • 网站建设电话销售说不需要专业外贸网站制作
  • 企业网站建设的背景国内免费开源crm
  • 重庆网站建设外包公司哪家好怎么让网站排名下降
  • 曲靖网站制作wordpress4.6字体
  • 做搜狗网站优化首crm系统价格
  • 怎么拥有网站的所有权甘肃商城网站建设
  • 黑河城乡建设局网站产品关键词大全
  • 城阳区城市规划建设局网站h5制作模板免费永久
  • 网站建设业务员怎么着客户高端网站建设步骤
  • 网站开发建设总结小米手机做网站服务器吗
  • 58同城盐城网站建设怎样创建网站教程
  • 移动端网站没有icp百度认证怎么认证
  • 景观设计师如何做网站seo诊断工具
  • 淮南网站优化淘宝客网站能用淘宝图标做标志吗
  • 网站开发发帖语言上海松江做网站
  • 网站制作资料收集东软集团建设网站
  • 网站图片切换效果wordpress 登录模板
  • 高端网站建设软件开发东软网站建设方案
  • 谁会网站开发浙江平台网站建设制作
  • 做影视网站怎么学做网站培训机构
  • 济南市网站推广公司jq 网站头部广告代码
  • 定制柜seo主要优化
  • 如何做好网站推广营销深圳品牌网站设计公司价格
  • 企业网站主题宣讲家网站李慎明两学一做
  • 网站建网站建设企业房产机构网站建设目标定位
  • 网站毕业设计开题报告免费做婚礼邀请函的网站
  • 世界各国o2o响应式网站网站模板定做
  • 龙岗爱联有学网站建设南京做网站企业
  • 动态效果的网站建设推广一个产品有哪些方式