PyQt QCombobox Setting Line Height Method


Previously, I searched a lot of relevant information on the Internet, some said that setting icon height to support item, some said that adding their own views to fill in the specified height, but for a Qcombobox with only text, these are undoubtedly too cumbersome. It took a long time to find a very simple method.

First, add the following contents to the QSS stylesheet: (height is customized, width can also be set)

QComboBox QAbstractItemView::item { min-height: 30px; }

Then add the following code to the code:


Well, open it and see, wow, the height can really be set!!!

The above PyQt QCombobox setting line height method is the editor to share with you all the content, I hope to give you a reference, but also hope that you support more developpaer.

Recommended Today

Java atomicinteger class using

A counter For ordinary variables, when multithreading operations are involved, classic thread safety problems will be encountered. Consider the following code: private static final int TEST_THREAD_COUNT = 100; private static int counter = 0; public static void main(String[] args) { final CountDownLatch latch = new CountDownLatch(TEST_THREAD_COUNT); Thread[] threads = new Thread[TEST_THREAD_COUNT]; for (int i = […]