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

c++ QicsTable使用实例

效果图:

#include <QicsTable.h>
#include <QicsDataModelDefault.h>

#include <QVBoxLayout>

Demo1::Demo1(QWidget *parent)
    : QWidget(parent)
{
    ui.setupUi(this);


    const int numRows = 10;
    const int numCols = 5;

    // create the data model
    QicsDataModel* dm = new QicsDataModelDefault(numRows, numCols);

    // populate the data model with some data
    for (int i = 0; i < numRows; ++i)
        for (int j = 0; j < numCols; ++j)
            dm->setItem(i, j, QicsDataInt(i * j));

    // create the table, using the data model we created above
    QicsTable* table = new QicsTable(dm, 0);
    // table->setWindowTitle(QObject::tr("Hello World Table Example"));

    // make sure the table is only as large as necessary
    table->setVisibleRows(numRows);
    table->setVisibleColumns(numCols);


    //table->setTopHeaderVisible(false);
    table->setLeftHeaderVisible(false);
    //table->setDefaultRowHeightInPixels(24);
    //table->setDefaultColumnWidthInPixels(24);
    table->setSelectionPolicy(Qics::SelectNone);
    table->mainGridRef().setReadOnly(true);
    table->mainGridRef().setAlignment(Qt::AlignCenter);
    table->mainGridRef().setFont(QFont("Helvetica", 12, QFont::Bold));
    //table->setHScrollBarMode(Qics::AlwaysOff);
    //table->setVScrollBarMode(Qics::AlwaysOff);


    // Add a title widget to the top of the table
    /*QLabel* label = new QLabel(QObject::tr("Hello World, Table"), table);
    label->setAlignment(Qt::AlignCenter);
    table->setTopTitleWidget(label);*/

    ui.verticalLayout->addWidget(table);
}

Demo1::~Demo1()
{}
 

备注:

table->setTopHeaderVisible(false); // 隐藏上测列头
    table->setLeftHeaderVisible(false);// 隐藏左侧列头

http://www.xdnf.cn/news/10453.html

相关文章:

  • linux信号详解
  • 人工智能100问☞第38问:什么是多模态模型?
  • 【课堂笔记】生成对抗网络 Generative Adversarial Network(GAN)
  • 任务23:创建天气信息大屏Django项目
  • 【BootLoader】之stm32F407实现bootloader相关问题
  • Python+MongoDb使用手册(精简)
  • python打卡day42
  • 学习日记-day20-6.1
  • 【AI论文】推理语言模型的强化学习熵机制
  • Cocos 打包 APK 兼容环境表(Android API Level 10~15)
  • 从线性代数到线性回归——机器学习视角
  • 获取 HTTP 请求从发送到接收响应所花费的总时间
  • 什么是缺页中断(缺页中断详解)
  • 基于微信小程序的垃圾分类系统
  • 西瓜书第十章——聚类
  • 思科设备网络实验
  • 鸿蒙OSUniApp集成WebAssembly实现高性能计算:从入门到实践#三方框架 #Uniapp
  • 开发指南120-表格(el-table)斑马纹
  • 无法运用pytorch环境、改环境路径、隔离环境
  • Python编程基础(二)| 列表简介
  • 【Redis】笔记|第4节|Redis数据安全性分析
  • 数据类型与推断:TypeScript 的基础
  • wordpress免费主题网站
  • ASP.NET Core SignalR 身份认证集成指南(Identity + JWT)
  • Spring Boot,注解,@ConfigurationProperties
  • 手拆STL
  • 【Redis技术进阶之路】「原理分析系列开篇」分析客户端和服务端网络诵信交互实现(服务端执行命令请求的过程 - 时间事件处理部分)
  • Selenium的底层原理
  • 鸿蒙OSUniApp声纹识别与语音验证:打造安全可靠的跨平台语音应用#三方框架 #Uniapp
  • 第14讲、Odoo 18 实现一个Markdown Widget模块