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.

    未经博主允许,禁止直接转载本博客任何内容(可以在文章中添加链接,禁止原文照搬),如需直接原文转载对应文章,请在该文章中留言联系博主,谢谢!!
  • 相关阅读:
    前端构建工具——Gulp
    jQuery事件命名空间
    浏览器类型鉴别那些事
    花式秀Mac——Mac快捷操作整理ing……
    解构jQuery之jQuery整体架构
    立即调用表达式
    iScroll小计
    JSONP原理及jQuery中的使用
    同源策略和跨域方法
    WebStrom、Sublime Text快捷键及使用技巧(补充ing...)
  • 原文地址:https://www.cnblogs.com/ibingshan/p/15632609.html
Copyright © 2011-2022 走看看