zoukankan      html  css  js  c++  java
  • pyside qcombobox hide item

    pyside qcombobox hide item

    from PySide2 import QtWidgets, QtCore
    comboBox.setItemData(1,QtCore.QSize(0,0),QtCore.Qt.SizeHintRole)

    我们也可以使用其它role去改变item的一些属性:参考链接:https://pyside.github.io/docs/pyside/PySide/QtCore/Qt.html

    PySide.QtCore.Qt.ItemDataRole

    Each item in the model has a set of data elements associated with it, each with its own role. The roles are used by the view to indicate to the model which type of data it needs. Custom models should return data in these types.

    The general purpose roles (and the associated types) are:

    ConstantDescription
    Qt.DisplayRole The key data to be rendered in the form of text. ( PySide.QtCore.QString )
    Qt.DecorationRole The data to be rendered as a decoration in the form of an icon. ( PySide.QtGui.QColor , PySide.QtGui.QIcon or PySide.QtGui.QPixmap )
    Qt.EditRole The data in a form suitable for editing in an editor. ( PySide.QtCore.QString )
    Qt.ToolTipRole The data displayed in the item’s tooltip. ( PySide.QtCore.QString )
    Qt.StatusTipRole The data displayed in the status bar. ( PySide.QtCore.QString )
    Qt.WhatsThisRole The data displayed for the item in “What’s This?” mode. ( PySide.QtCore.QString )
    Qt.SizeHintRole The size hint for the item that will be supplied to views. ( PySide.QtCore.QSize )

    Roles describing appearance and meta data (with associated types):

    ConstantDescription
    Qt.FontRole The font used for items rendered with the default delegate. ( PySide.QtGui.QFont )
    Qt.TextAlignmentRole The alignment of the text for items rendered with the default delegate. ( Qt.AlignmentFlag )
    Qt.BackgroundRole The background brush used for items rendered with the default delegate. ( PySide.QtGui.QBrush )
    Qt.BackgroundColorRole This role is obsolete. Use BackgroundRole instead.
    Qt.ForegroundRole The foreground brush (text color, typically) used for items rendered with the default delegate. ( PySide.QtGui.QBrush )
    Qt.TextColorRole This role is obsolete. Use ForegroundRole instead.
    Qt.CheckStateRole This role is used to obtain the checked state of an item. ( Qt.CheckState )
    Qt.InitialSortOrderRole This role is used to obtain the initial sort order of a header view section. ( Qt.SortOrder ). This role was introduced in Qt 4.8.

    Accessibility roles (with associated types):

    ConstantDescription
    Qt.AccessibleTextRole The text to be used by accessibility extensions and plugins, such as screen readers. ( PySide.QtCore.QString )
    Qt.AccessibleDescriptionRole A description of the item for accessibility purposes. ( PySide.QtCore.QString )

    User roles:

    ConstantDescription
    Qt.UserRole The first role that can be used for application-specific purposes.

    For user roles, it is up to the developer to decide which types to use and ensure that components use the correct types when accessing and setting data.

    未经博主允许,禁止直接转载本博客任何内容(可以在文章中添加链接,禁止原文照搬),如需直接原文转载对应文章,请在该文章中留言联系博主,谢谢!!
  • 相关阅读:
    https-->http and http-->https bitransfer
    socat
    docker daemon configuration
    centos 7 update to python V3.43 to assure git clone as usual
    df and du
    SS iproute2,nslookup,dig
    jmxtrans
    web.xml之env-entry
    Java发送Http请求
    elasticsearch在CentOS环境下开机启动
  • 原文地址:https://www.cnblogs.com/ibingshan/p/15632609.html
Copyright © 2011-2022 走看看