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

淄博网站优化公司开发定制制作app

淄博网站优化公司,开发定制制作app,有关于网站建设的参考文献,wordpress主题发布站源码Qt 是目前最先进、最完整的跨平台C开发工具。它不仅完全实现了一次编写#xff0c;所有平台无差别运行#xff0c;更提供了几乎所有开发过程中需要用到的工具。如今#xff0c;Qt已被运用于超过70个行业、数千家企业#xff0c;支持数百万设备及应用。 本文将展示如何为不…Qt 是目前最先进、最完整的跨平台C开发工具。它不仅完全实现了一次编写所有平台无差别运行更提供了几乎所有开发过程中需要用到的工具。如今Qt已被运用于超过70个行业、数千家企业支持数百万设备及应用。 本文将展示如何为不同的窗口大小排列小部件。 流程布局实现了处理不同窗口大小的布局小部件的位置取决于应用程序窗口的宽度。 Flowlayout类主要使用QLayout和QWidgetItem而Window类使用QWidget和QLabel。 在上文中点击这里回顾我们主要介绍了FlowLayout类定义、示例运行等本文将继续介绍FlowLayout类实现请继续关注哦~ 点击获取Qt Widget组件下载 FlowLayout类实现 我们从构造函数开始 FlowLayout::FlowLayout(QWidget *parent, int margin, int hSpacing, int vSpacing) : QLayout(parent), m_hSpace(hSpacing), m_vSpace(vSpacing) { setContentsMargins(margin, margin, margin, margin); }FlowLayout::FlowLayout(int margin, int hSpacing, int vSpacing) : m_hSpace(hSpacing), m_vSpace(vSpacing) { setContentsMargins(margin, margin, margin, margin); } 在构造函数中我们调用setContentsMargins()来设置左、上、右和下边距。默认情况下QLayout使用当前样式提供的值参见QStyle::PixelMetric。 FlowLayout::~FlowLayout() { QLayoutItem *item; while ((item takeAt(0))) delete item; } 在这个例子中我们重新实现了addItem()它是一个纯虚函数。当使用addItem() 时布局项的所有权被转移到布局因此它是布局的责任来删除它们。 void FlowLayout::addItem(QLayoutItem *item) { itemList.append(item); } addItem()用于向布局中添加项。 int FlowLayout::horizontalSpacing() const { if (m_hSpace 0) { return m_hSpace; } else { return smartSpacing(QStyle::PM_LayoutHorizontalSpacing); } }int FlowLayout::verticalSpacing() const { if (m_vSpace 0) { return m_vSpace; } else { return smartSpacing(QStyle::PM_LayoutVerticalSpacing); } } 我们实现了horizontalSpacing()和verticalSpacing() 来获取布局中小部件之间的间距如果该值小于或等于0则使用此值。如果没有将调用smartSpacing()来计算间距。 int FlowLayout::count() const { return itemList.size(); }QLayoutItem *FlowLayout::itemAt(int index) const { return itemList.value(index); }QLayoutItem *FlowLayout::takeAt(int index) { if (index 0 index itemList.size()) return itemList.takeAt(index); return nullptr; } 然后实现count()来返回布局中的项数为了在项目列表中导航我们使用 itemAt() 和 takeAt() 从列表中删除和返回项目。如果一个项目被删除剩下的项目将重新编号这三个函数都是来自QLayout的纯虚函数。 Qt::Orientations FlowLayout::expandingDirections() const { return { }; } expandingDirections()返回Qt::Orientations其中布局可以使用比sizeHint()更多的空间。 bool FlowLayout::hasHeightForWidth() const { return true; }int FlowLayout::heightForWidth(int width) const { int height doLayout(QRect(0, 0, width, 0), true); return height; } 为了调整到高度依赖于宽度的小部件我们实现了heightForWidth()。函数hasHeightForWidth()被用来测试这个依赖关系并且heightForWidth()将宽度传递给doLayout()后者反过来使用宽度作为布局矩形的参数即项目布局的边界该矩形不包括布局margin()。 void FlowLayout::setGeometry(const QRect rect) { QLayout::setGeometry(rect); doLayout(rect, false); }QSize FlowLayout::sizeHint() const { return minimumSize(); }QSize FlowLayout::minimumSize() const { QSize size; for (const QLayoutItem *item : std::as_const(itemList)) size size.expandedTo(item-minimumSize());const QMargins margins contentsMargins(); size QSize(margins.left() margins.right(), margins.top() margins.bottom()); return size; } setGeometry()通常用于执行实际的布局即计算布局项的几何形状。在这个例子中它调用了doLayout()并传递了布局矩形。 sizeHint()返回布局的首选大小minimumSize()返回布局的最小大小 int FlowLayout::doLayout(const QRect rect, bool testOnly) const { int left, top, right, bottom; getContentsMargins(left, top, right, bottom); QRect effectiveRect rect.adjusted(left, top, -right, -bottom); int x effectiveRect.x(); int y effectiveRect.y(); int lineHeight 0; 如果horizontalSpacing() 或 verticalSpacing()不返回默认值则doLayout()处理布局它使用getContentsMargins()来计算布局项的可用面积。 for (QLayoutItem *item : std::as_const(itemList)) { const QWidget *wid item-widget(); int spaceX horizontalSpacing(); if (spaceX -1) spaceX wid-style()-layoutSpacing( QSizePolicy::PushButton, QSizePolicy::PushButton, Qt::Horizontal); int spaceY verticalSpacing(); if (spaceY -1) spaceY wid-style()-layoutSpacing( QSizePolicy::PushButton, QSizePolicy::PushButton, Qt::Vertical); 然后它根据当前样式为布局中的每个小部件设置适当的间距。 int nextX x item-sizeHint().width() spaceX; if (nextX - spaceX effectiveRect.right() lineHeight 0) { x effectiveRect.x(); y y lineHeight spaceY; nextX x item-sizeHint().width() spaceX; lineHeight 0; }if (!testOnly) item-setGeometry(QRect(QPoint(x, y), item-sizeHint()));x nextX; lineHeight qMax(lineHeight, item-sizeHint().height()); } return y lineHeight - rect.y() bottom; } 然后通过将项目宽度和行高添加到初始x和y坐标来计算布局中每个项目的位置这反过来又让我们知道下一项是否适合当前行或者是否必须向下移动到下一行我们还根据小部件的高度找到当前行的高度。 int FlowLayout::smartSpacing(QStyle::PixelMetric pm) const { QObject *parent this-parent(); if (!parent) { return -1; } else if (parent-isWidgetType()) { QWidget *pw static_castQWidget *(parent); return pw-style()-pixelMetric(pm, nullptr, pw); } else { return static_castQLayout *(parent)-spacing(); } } smartSpacing()被设计为获取顶级布局或子布局的默认间距当父组件是QWidget时顶级布局的默认间距将通过查询样式来确定。当父布局为QLayout时子布局的默认间距将通过查询父布局的间距来确定。 Qt Widget组件推荐 QtitanRibbon - Ribbon UI组件是一款遵循Microsoft Ribbon UI Paradigm for Qt技术的Ribbon UI组件QtitanRibbon致力于为Windows、Linux和Mac OS X提供功能完整的Ribbon组件。QtitanChart - Qt类图表组件是一个C 库代表一组控件这些控件使您可以快速地为应用程序提供漂亮而丰富的图表。QtitanDataGrid - Qt网格组件提供了一套完整的标准 QTableView 函数和传统组件无法实现的独特功能。使您能够将不同来源的各类数据加载到一个快速、灵活且功能强大的可编辑网格中支持排序、分组、报告、创建带状列、拖放按钮和许多其他方便的功能。QtitanDocking允许您像 Visual Studio 一样为您的伟大应用程序配备可停靠面板和可停靠工具栏。黑色、白色、蓝色调色板完全支持 Visual Studio 2019 主题
http://www.hkea.cn/news/14444156/

相关文章:

  • 织梦网站每天被挂马贵州省住房和建设厅网网站首页
  • 高端定制网站设计公司网站如何定位
  • 长沙网站公司自媒体运营从入门到精通
  • 如何做网站结构优化艺术设计与制作
  • 宁波制作网站软件蛋糕网站源码
  • 自建网站外贸怎么做深圳专业的网站建设
  • 医院网站建设策划书仿站小工具下载
  • 怎么做 废旧回收网站做的网站怎么放到域名
  • 电子商务网站建设与管理教材企业在建设银行网站怎么发工资
  • 精品课程网站建设现状wordpress 维护页面
  • 兰州网站建设招聘最新网站建设营销模板
  • 标志设计欣赏网站wordpress文章打开慢
  • 网站建设定金做什么会计分录网站推广的优势
  • 哪些网站是响应式有哪些网站做自建房设计
  • 信誉好的东莞网站建设会员管理系统功能介绍
  • 宝应123网站建设网wordpress图片分离
  • 博客网站需要的功能广州招投标交易中心
  • 上海开发公司企业seo关键字优化
  • 免费做爰小说网站wordpress本地后台打开卡住
  • 济南专业做网站的公司哪家好网站虚拟空间作用
  • 靖江做网站的关键词查找的方法有以下几种
  • 网站开发程序开发sae wordpress 4.4
  • 建设银行手机银行网站用户名是什么原因侧边导航条wordpress
  • 安徽茶叶商城网站建设外贸公司怎么运作
  • 如何做网站实名认证特价流量网站
  • 什么叫网站优化北京正规网站建设比较
  • 提高审美的网站推荐中信建设有限责任公司电话
  • 东圃手机网站建设电话微信广点通广告平台
  • 阿里云建站费用wordpress国际化
  • 网站域名 空间申请智能家居网站建设方案