PyQt QCombobox Setting Line Height Method

Time:2019-9-7

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:

self.ui_combobox.setView(QListView())

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

Write a package for parsing abnormal JSON strings – fbbk-json

F [beep] [beep] K JSON Parse a package of abnormal JSON strings. install $ npm install fbbk-json Use This package has only one function: var fJSON = require(“fbbk-json”); fJSON.parse(A_JSON_STRING); however This package supports the following JSON strings (that is, what we usually declare in javascript, without quotation marks). Raise a chestnut. ‘{foo”:”bar”,”baz”: true} < – […]