Qt QCombobox更改Scroll Arrows

时间:2016-06-06 19:25:07

标签: c++ css qt

您好QT中的ComboBox有问题。 我已经搜索了一段时间,但我找不到任何信息。

我必须构建一个Combobox来选择一些数据 http://fs5.directupload.net/images/160606/2ekorosf.png

enter image description here

列表末尾的向上和向下箭头太窄了 我希望他们更大。
有没有办法改变这个?

使用普通的滚动条everthing可以正常使用我的css文件 例如:

var iframe = document.querySelector('#viewer iframe')

但我无法弄清楚如何更改图片中的小箭头。

2 个答案:

答案 0 :(得分:1)

这不起作用。 我注意到我的问题不在于CamboBox。本程序使用

QComboBox QAbstractItemView

似乎我需要以某种方式更改autoScrollMargin(或setAutoScrollMargin) http://doc.qt.io/qt-4.8/qabstractitemview.html#autoScrollMargin-prop 但我无法弄清楚在CSS文件中做到这一点, sry我在Qt中很新。^^

-

如果我使用

,我想出了什么
QComboBox QAbstractItemView {
margin-top: 50px;
padding-bottom: 50px;
}
我得到了这样的东西 QComboBox QAbstractItemView margin

这几乎是我所希望的。 我会让你保持最新状态。^^

答案 1 :(得分:0)

您可以自定义QComboBox'箭头使用:

QComboBox::up-arrow {
    width: Npx;
    height: Npx;
}

QComboBox::down-arrow { 
    width: Npx;
    height: Npx;
}

// Where "N" is the width and height you want to set. 

如果您想了解如何自定义QComboBox,请查看此链接:http://doc.qt.io/qt-5/stylesheet-examples.html