当前位置:网站首页>Example of QT qtableview
Example of QT qtableview
2022-06-22 08:04:00 【Licht powder】
1—— Create table contents
QStandardItemModel* m_standardItemModel = new QStandardItemModel(this);
QStandardItem *item = new QStandardItem(“ Li Si ”);
m_standardItemModel->setItem(i,j,item);// That's ok 、 Column 、 Elements
tableView->setModel(m_standardItemModel);The default row and column headers exist , If you want to hide it, you can execute the following code :
tableView->horizontalHeader()->hide();
tableView->verticalHeader()->hide();
// Mode two
tableView->verticalHeader()->setVisible(false);tableview The view is as follows :

2——tableview Trigger signal of the click element of
connect(tableview, SIGNAL(clicked(const QModelIndex &)), this, SLOT(onTableClicked(const QModelIndex &)));
void LTableView::onTableClicked(const QModelIndex &index)
{
qDebug() << "123";
if (index.isValid())
{
QString cellText = index.data().toString();
qDebug() << cellText;
}
}

3——tableview Method of clearing all data in the table
// The way 1
m_standardItemModel->clear();
// The way 2
m_standardItemModel->removeRows(0,m_standardItemModel->rowCount()); // Delete all rows 4—— Set all column widths and row heights
tableView->verticalHeader()->setDefaultSectionSize(32);
tableView->horizontalHeader()->setDefaultSectionSize(48);5—— Hide scroll bar
// Hide scroll bar
m_ltableView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);边栏推荐
- MySQL view
- 充电宝的玄机
- Mt4/mql4 getting started to be proficient in EA tutorial lesson 6 - common functions of MQL language (VI) - common order function
- The difference between get and post requests
- Semaphore
- 【Oracle 数据库】奶妈式教程day15 DDL、DML、索引、视图、序列、死锁这一篇就够了
- Modular import and export collation in JS
- MySQL index
- Cenos7 firewall command
- Mt4/mql4 getting started to proficient in foreign exchange EA automatic trading tutorial - special identification of the K line on the chart
猜你喜欢

Detailed explanation of subnet mask

LR 2022 ultra detailed installation tutorial "latest"

Failed to access the ES installed on Tencent ECs, but the solution to accessing the ES successfully on the server

【宋红康 MySQL数据库 】【高级篇】【06】MySQL的逻辑架构

Mt4/mql4 getting started to mastering EA tutorial lesson 8 - common functions of MQL language (VIII) - common time function

Mt4/mql4 getting started to mastering EA tutorial lesson 5 - common functions of MQL language (V) - common functions of account information

【 Oracle database】 Nursery Mother Tutorial day13 date Function

Xmind 2022思维导图激活版资源?

How Navicat queries the password information of the connected database

【Oracle 数据库】奶妈式教程 day12 字符函数
随机推荐
先锋期货安全么?期货开户都是哪些流程?期货手续费怎么降低?
Charles uses
(9) Sequential queue and stack queue
0基础自学stm32(野火)——什么是寄存器?
Invalid applet margin right, text overflow?
Maptalks: basic operation and wms/wmts map service loading
QT combox的使用示例
PostgreSQL common commands and SQL -- continuous update
[普通物理]波的能量与干涉
Orientdb batch execute SQL
【宋红康 MySQL数据库 】【高级篇】【07】MySQL的存储引擎
Mt4/mql4 getting started to be proficient in EA tutorial lesson 6 - common functions of MQL language (VI) - common order function
IP address planning
关于菲涅尔现象
Mt4-mql4 language EA automatic transaction programming introduction to proficiency
MySQL queries data within one hour
LNMP environment setup
Note pad replaces all contents after a character in all lines
Mt4/mql4 getting started to proficient in foreign exchange EA automatic trading tutorial - common functions of MQL language
多点闹钟实例