当前位置:网站首页>The qtablewidget header cell does not display the separation line
The qtablewidget header cell does not display the separation line
2022-07-17 22:43:00 【litanyuan】
background
Qt Drawing the control style will use the current system style UI Display style .
Problem description
①. summary
QTableWidget Table control in Win10 There is no bottom line between the horizontal and vertical headers under the system , As shown in the figure below :

②. reason
The reason for this phenomenon is Qt Drawing the control style will use the current system style UI Display style ,Win10 The system table style is as follows :

Draw separation lines
①. summary
By setting the StyleSheet Draw four boundary lines as needed .
②. Horizontal meter
ui.tableWidget->horizontalHeader()->setStyleSheet(
"QHeaderView::section{"
"border-top:0px solid #E5E5E5;"
"border-left:0px solid #E5E5E5;"
"border-right:0.5px solid #E5E5E5;"
"border-bottom: 0.5px solid #E5E5E5;"
"background-color:white;"
"padding:4px;"
"}"
);

③. Vertical header
ui.tableWidget->verticalHeader()->setStyleSheet(
"QHeaderView::section{"
"border-top:0.5px solid #E5E5E5;"
"border-left:0px solid #E5E5E5;"
"border-right:0.5px solid #E5E5E5;"
"border-bottom: 0px solid #E5E5E5;"
"background-color:white;"
"padding:4px;"
"}"
);

Set interface style
①.QStyleFactory
QStyleFactory Class is used to create QStyle, Its static method keys You can get all the currently supported interface styles .
for (auto & key : QStyleFactory::keys())
{
qDebug() << key;
}

②. Set interface style
adopt QApplication Of setStyle Method can set the interface display style .
QApplication::setStyle(QStyleFactory::create("Fusion"));


边栏推荐
- 测试下震惊
- Oracle的表空间与数据库有什么关系?
- JS Click to locate the page to the specified location
- Add new nodes to HAC cluster
- CloudCompare——隐点移除
- Solidity -- achieve voting governance management Dao
- 如何关闭MySQL?
- Can an instance of polardb for PostgreSQL correspond to multiple databases?
- How does Oracle view the database alarm log?
- A 27 year old software tester, who has been working for nearly five years with a monthly salary of less than 2W, is worried about being replaced by fresh graduates
猜你喜欢
随机推荐
Oracle如何查看数据库告警日志?
数组的理解与操作
MySQL——mysql下载地址
MySQL如何查看数据库告警日志?
动态规划之最长回文子串
Oracle数据存储方式是什么?
How does polardb for PostgreSQL view the database alarm log?
Win11系统如何进行一键重装?
The difference between step into and force step into in idea debugging
List collection
Solution of word moving right automatically as soon as you switch pages
pip list outdated pacakge and update
Longest palindrome substring of dynamic programming
Data migration scheme for cross version upgrade of distributed database
Cloudcompare - hidden point removal
Set集合
Is it better to buy long-term financial products or short-term financial products in the second half of 2022?
Understanding and operation of array
Realsense dynamic calibration
Huawei cloud from entry to actual combat | cloud container service









