一、Qt Widgets 问题交流
1.升级Qt6后,QTableView::indicator样式表没生效
之前的样式:
ui->tableWidget->setStyleSheet(
"QTableView::indicator{width:24px; height:24px;} "
"QTableView::indicator:checked{image:url(:/SwitchOn.png);} "
"QTableView::indicator:unchecked{image:url(:/SwitchOff.png);} ");
在Qt6中这个图标不会显示出来:
在Qt6中修改之后才正常显示:
(给item设置border或者background,indicator的样式就生效了)
ui->tableWidget->setStyleSheet(
"QTableView::item{border:0;} "
"QTableView::indicator{width:24px; height:24px;} "
"QTableView::indicator:checked{image:url(:/SwitchOn.png);} "
"QTableView::indicator:unchecked{image:url(:/SwitchOff.png);} ");
这让我想起之前的border也有类的问题,如果单独设置一个边可能不会生效,对border整体设置后再设置某个边就生效了。
二、Qt Quick 问题交流 1.注意QML调用C++注册类的接口时,参数的类型转换像bool和int转换这种就不说了,C++里本身就有。但是QML比较坑爹是会把一些C++里本来不自动转换的类型也给转了,特别是和QString的转换。
测试代码:
#pragma once
#include
#include
class CppObject : public QObject
{
Q_OBJECT
public:
explicit CppObject(QObject *parent = nullptr);
Q_INVOKABLE void funcA(const QString &a, const QString &b){
qDebug()
关注
打赏