样式表 QComboBox QListView 在将 UI 转换为 PY 后不起作用。

huangapple go评论52阅读模式
英文:

styleSheet QComboBox QListView not working after convert UI to PY

问题

以下是您要翻译的内容:

"I created my first UI using Qt Designer and convert UI to PY. The styleSheets QComboBox QListView and QComboBox QAbstractItemView are not working after converting. But in Qt Designer all styleSheet QComboBox is working. I using Python 3.9.13 and PyCharm Community Edition."

在Qt Designer中创建了我的第一个用户界面并将其转换为PY。在转换后,QComboBox QListViewQComboBox QAbstractItemView的样式表不起作用。但在Qt Designer中,所有QComboBox的样式表都有效。我使用Python 3.9.13和PyCharm Community Edition。

QComboBox {
	border: 2px solid #0d7377;
	border-radius: 20;
	padding: 10px;
	color: #eeeeee;
}
QComboBox::drop-down {
	border: 0px;
}
QComboBox::down-arrow {
	image: url(:/iconic/arrow.png);
	width: 14px;
	height: 14px;
	margin-right: 15px;
}
QComboBox QAbstractItemView {
    selection-background-color: #1a1a1a;
	selection-color: #eeeeee;
}
QComboBox QListView {
	border: 2px solid #0d7377;
	border-radius: 15;
	padding: 10px;
	color: #0d7377;
	outline: 0px;
}

在Qt Designer中

转换为PY后

在PyCharm中的样式表

我尝试逐行删除QComboBox QListViewQComboBox QAbstractItemView样式表中的内容,以了解哪一行导致错误,但没有得到结果。

英文:

I created my first UI using Qt Designer and convert UI to PY.
The styleSheets QComboBox QListView and QComboBox QAbstractItemView are not working after converting.
But in Qt Designer all styleSheet QComboBox is working.
I using Python 3.9.13 and PyCharm Community Edition.

QComboBox {
	border: 2px solid #0d7377;
	border-radius: 20;
	padding: 10px;
	color: #eeeeee;
}
QComboBox::drop-down {
	border: 0px;
}
QComboBox::down-arrow {
	image: url(:/iconic/arrow.png);
	width: 14px;
	height: 14px;
	margin-right: 15px;
}
QComboBox QAbstractItemView {
    selection-background-color: #1a1a1a;
	selection-color: #eeeeee;
}
QComboBox QListView {
	border: 2px solid #0d7377;
	border-radius: 15;
	padding: 10px;
	color: #0d7377;
	outline: 0px;
}

in Qt Designer

after convert ui to py

styleSheet in PyCharm

I only tried delete one at a time line in styleSheets QComboBox QListView and QComboBox QAbstractItemView in PyCharm to understand which line gives the error, but it did not give results.

答案1

得分: 0

使用属性编辑器更改组合框中的任何字体会破坏其正常操作。在样式表中更改字体:

QComboBox {
    font: bold 12pt "Microsoft YaHei";
    border: 2px solid #0d7377;
    border-radius: 20;
    padding: 10px;
    color: #eeeeee;
}
英文:

Any font change in Combobox using the properties editor breaking normal its operation. Change the font in the style sheet

QComboBox {
	font: bold 12pt "Microsoft YaHei";
	border: 2px solid #0d7377;
	border-radius: 20;
	padding: 10px;
	color: #eeeeee;
}

huangapple
  • 本文由 发表于 2023年2月18日 20:37:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/75493394.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定