gpt4 book ai didi

qt - QComboBox 下拉项边距

转载 作者:行者123 更新时间:2023-12-01 14:06:32 31 4
gpt4 key购买 nike

我想设计我的 QComboBox与下拉项目的 margin 。这是现在的样子:

enter image description here

我想要这样的东西:

enter image description here

我试过

QComboBox QAbstractItemView::item {
margin: 3px;
}

但它不起作用。

你能帮我解决这个问题吗?

最佳答案

你想在项目之间设置一些空间。我尝试了不同的样式表,但我无法得到结果。但我找到了这个解决方案。也许它有帮助。

    ui->comboBox->setView(new QListView());
ui->comboBox->setStyleSheet("QComboBox QAbstractItemView::item { min-height: 35px; min-width: 50px; }QListView::item:selected { color: black; background-color: lightgray}");

结果非常相似
enter image description here

关于qt - QComboBox 下拉项边距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25340821/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com