当前位置: 首页>>代码示例>>Python>>正文


Python QListWidgetItem.flags方法代码示例

本文整理汇总了Python中PyQt4.Qt.QListWidgetItem.flags方法的典型用法代码示例。如果您正苦于以下问题:Python QListWidgetItem.flags方法的具体用法?Python QListWidgetItem.flags怎么用?Python QListWidgetItem.flags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.Qt.QListWidgetItem的用法示例。


在下文中一共展示了QListWidgetItem.flags方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: insertItems

# 需要导入模块: from PyQt4.Qt import QListWidgetItem [as 别名]
# 或者: from PyQt4.Qt.QListWidgetItem import flags [as 别名]
    def insertItems(self, row, items, setAsDefault = True):
        """
        Insert the <items> specified items in this list widget.
        The list widget shows item name string , as a QListwidgetItem.

        This QListWidgetItem object defines a 'key' of a dictionary
        (self._itemDictionary) and the 'value' of this key is the object
        specified by the 'item' itself.
        Example: self._itemDictionary['C6'] = instance of class Atom.

        @param row: The row number for the item.
        @type row: int

        @param items: A list of objects. These objects are treated as values in
                      the self._itemDictionary
        @type items: list

        @param setAsDefault: Not used here. See PM_ListWidget.insertItems where
                             it is used.

        @see: self.renameItemValue() for a comment about
              self._suppress_itemChanged_signal

        """

        #delete unused argument. Should this be provided as an argument in this
        #class method ?
        del setAsDefault

        #self.__init__ for a comment about this flag
        self._suppress_itemChanged_signal = True

        #Clear the previous contents of the self._itemDictionary
        self._itemDictionary.clear()

        #Clear the contents of this list widget, using QListWidget.clear()
        #See U{<http://doc.trolltech.com/4.2/qlistwidget.html>} for details
        self.clear()

        for item in items:
            if hasattr(item.__class__, 'name'):
                itemName = item.name
            else:
                itemName = str(item)
            listWidgetItem = QListWidgetItem(itemName, self)

            #When we support editing list widget items , uncomment out the
            #following line . See also self.editItems -- Ninad 2008-01-16
            listWidgetItem.setFlags( listWidgetItem.flags()| Qt.ItemIsEditable)

            if hasattr(item.__class__, 'iconPath'):
                try:
                    listWidgetItem.setIcon(geticon(item.iconPath))
                except:
                    print_compact_traceback()

            self._itemDictionary[listWidgetItem] = item

        #Reset the flag that temporarily suppresses itemChange signal.
        self._suppress_itemChanged_signal = False
开发者ID:alaindomissy,项目名称:nanoengineer,代码行数:62,代码来源:PM_SelectionListWidget.py

示例2: setter

# 需要导入模块: from PyQt4.Qt import QListWidgetItem [as 别名]
# 或者: from PyQt4.Qt.QListWidgetItem import flags [as 别名]
 def setter(w, val):
     order_map = {x:i for i, x in enumerate(val)}
     items = list(w.defaults)
     limit = len(items)
     items.sort(key=lambda x:order_map.get(x, limit))
     w.clear()
     for x in items:
         i = QListWidgetItem(w)
         i.setText(x)
         i.setFlags(i.flags() | Qt.ItemIsDragEnabled)
开发者ID:HaraldGustafsson,项目名称:calibre,代码行数:12,代码来源:preferences.py

示例3: set_bookmarks

# 需要导入模块: from PyQt4.Qt import QListWidgetItem [as 别名]
# 或者: from PyQt4.Qt.QListWidgetItem import flags [as 别名]
 def set_bookmarks(self, bookmarks=None):
     if bookmarks is None:
         bookmarks = self.original_bookmarks
     self.bookmarks_list.clear()
     for bm in bookmarks:
         i = QListWidgetItem(bm['title'])
         i.setData(Qt.UserRole, self.bm_to_item(bm))
         i.setFlags(i.flags() | Qt.ItemIsEditable)
         self.bookmarks_list.addItem(i)
     if len(bookmarks) > 0:
         self.bookmarks_list.setCurrentItem(self.bookmarks_list.item(0), QItemSelectionModel.ClearAndSelect)
开发者ID:089git,项目名称:calibre,代码行数:13,代码来源:bookmarkmanager.py


注:本文中的PyQt4.Qt.QListWidgetItem.flags方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。