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


Python QIcon.addPixmap方法代码示例

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


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

示例1: slotEditUser

# 需要导入模块: from PyQt5.Qt import QIcon [as 别名]
# 或者: from PyQt5.Qt.QIcon import addPixmap [as 别名]
    def slotEditUser(self, item=None):
        if not item:
            item = self.ui.userList.currentItem()
        self.ui.userList.setCurrentItem(item)
        user = item.getUser()
        if user.uid > -1:
            self.ui.userIDCheck.setChecked(True)
            self.ui.userID.setValue(user.uid)
        self.ui.username.setText(user.username)
        self.ui.realname.setText(user.realname)
        self.ui.pass1.setText(user.passwd)
        self.ui.pass2.setText(user.passwd)

        if "wheel" in user.groups:
            self.ui.admin.setChecked(True)
        else:
            self.ui.admin.setChecked(False)

        self.ui.noPass.setChecked(user.no_password)

        self.edititemindex = self.ui.userList.currentRow()
        self.ui.createButton.setText(_("Update"))
        icon = QIcon()
        icon.addPixmap(QPixmap(":/gui/pics/tick.png"), QIcon.Normal, QIcon.Off)
        self.ui.createButton.setIcon(icon)
        self.ui.cancelButton.setVisible(self.ui.createButton.isVisible())
开发者ID:MusaSakizci,项目名称:yali-family,代码行数:28,代码来源:ScrUsers.py

示例2: __init__

# 需要导入模块: from PyQt5.Qt import QIcon [as 别名]
# 或者: from PyQt5.Qt.QIcon import addPixmap [as 别名]
class CompletionCandidate:

    def __init__(self, place_id, url, title, substrings):
        self.value = url
        self.place_id = place_id

        def get_positions(text):
            ans = set()
            text = text.lower()
            for ss in substrings:
                idx = text.find(ss.lower())
                if idx > -1:
                    ans |= set(range(idx, idx + len(ss)))
            return sorted(ans)

        self.left = make_highlighted_text(url, get_positions(url))
        self.right = make_highlighted_text(title, get_positions(title))
        self._icon = None

    def adjust_size_hint(self, option, ans):
        ans.setHeight(max(option.decorationSize.height() + 6, ans.height()))

    @property
    def icon(self):
        if self._icon is None:
            self._icon = QIcon()
            url = places.favicon_url(self.place_id)
            if url is not None:
                f = QApplication.instance().disk_cache.data(QUrl(url))
                if f is not None:
                    with closing(f):
                        raw = f.readAll()
                    p = QPixmap()
                    p.loadFromData(raw)
                    if not p.isNull():
                        self._icon.addPixmap(p)
        return self._icon

    def __repr__(self):
        return self.value

    def draw_item(self, painter, style, option):
        option.features |= option.HasDecoration
        option.icon = self.icon
        text_rect = style.subElementRect(style.SE_ItemViewItemText, option, None)
        x, y = text_rect.x(), text_rect.y()
        y += (text_rect.height() - self.left.size().height()) // 2
        if not option.icon.isNull():
            icon_rect = style.subElementRect(style.SE_ItemViewItemDecoration, option, None)
            icon_rect.setTop(y), icon_rect.setBottom(text_rect.bottom())
            option.icon.paint(painter, icon_rect)
        option.icon = QIcon()
        width = (text_rect.width() // 2) - 10
        painter.setClipRect(x, text_rect.y(), width, text_rect.height())
        painter.drawStaticText(QPoint(x, y), self.left)
        painter.setClipRect(text_rect)
        x += width + 20
        painter.drawStaticText(QPoint(x, y), self.right)
开发者ID:kovidgoyal,项目名称:vise,代码行数:60,代码来源:open.py

示例3: slotAdvanced

# 需要导入模块: from PyQt5.Qt import QIcon [as 别名]
# 或者: from PyQt5.Qt.QIcon import addPixmap [as 别名]
    def slotAdvanced(self):
        icon_path = None
        if self.ui.scrollArea.isVisible():
            icon_path = ":/gui/pics/expand.png"
            self.time_line.start()
        else:
            self.ui.scrollArea.show()
            icon_path = ":/gui/pics/collapse.png"
            self.time_line.start()

        icon = QIcon()
        icon.addPixmap(QPixmap(icon_path), QIcon.Normal, QIcon.Off)
        self.ui.addMoreUsers.setIcon(icon)
        self.checkUsers()
开发者ID:MusaSakizci,项目名称:yali-family,代码行数:16,代码来源:ScrUsers.py

示例4: slotCheckCD

# 需要导入模块: from PyQt5.Qt import QIcon [as 别名]
# 或者: from PyQt5.Qt.QIcon import addPixmap [as 别名]
 def slotCheckCD(self):
     if self.check_media_stop:
         self.check_media_stop = False
         self.ui.progressBar.show()
         icon = QIcon()
         icon.addPixmap(QPixmap(":/gui/pics/dialog-error.png"), QIcon.Normal, QIcon.Off)
         self.ui.checkButton.setIcon(icon)
         self.ui.checkButton.setText("")
         self.checkMedia()
     else:
         self.check_media_stop = True
         self.ui.progressBar.show()
         icon = QIcon()
         icon.addPixmap(QPixmap(":/gui/pics/task-accepted.png"), QIcon.Normal, QIcon.Off)
         self.ui.checkButton.setIcon(icon)
         self.ui.checkButton.setText(_("Validate"))
开发者ID:MusaSakizci,项目名称:yali-family,代码行数:18,代码来源:ScrCheckCD.py

示例5: resetWidgets

# 需要导入模块: from PyQt5.Qt import QIcon [as 别名]
# 或者: from PyQt5.Qt.QIcon import addPixmap [as 别名]
 def resetWidgets(self):
     # clear all
     self.edititemindex = None
     self.ui.username.clear()
     self.ui.realname.clear()
     self.ui.pass1.clear()
     self.ui.pass2.clear()
     self.ui.admin.setChecked(False)
     self.ui.noPass.setChecked(False)
     self.ui.userIDCheck.setChecked(False)
     self.ui.createButton.setEnabled(False)
     if self.ui.cancelButton.isVisible():
         self.ui.cancelButton.setHidden(self.sender() == self.ui.cancelButton)
         self.checkUsers()
     self.ui.createButton.setText(_("Add"))
     icon = QIcon()
     icon.addPixmap(QPixmap(":/gui/pics/user-group-new.png"), QIcon.Normal, QIcon.Off)
     self.ui.createButton.setIcon(icon)
开发者ID:MusaSakizci,项目名称:yali-family,代码行数:20,代码来源:ScrUsers.py

示例6: slotDeleteUser

# 需要导入模块: from PyQt5.Qt import QIcon [as 别名]
# 或者: from PyQt5.Qt.QIcon import addPixmap [as 别名]
    def slotDeleteUser(self):
        if self.ui.userList.currentRow() == self.edititemindex:
            self.resetWidgets()
            self.ui.autoLogin.setCurrentIndex(0)
        _cur = self.ui.userList.currentRow()
        item = self.ui.userList.item(_cur).getUser()
        if item.uid in self.used_ids:
            self.used_ids.remove(item.uid)
        self.ui.userList.takeItem(_cur)
        self.ui.autoLogin.removeItem(_cur + 1)
        self.ui.createButton.setText(_("Add"))

        icon = QIcon()
        icon.addPixmap(QPixmap(":/gui/pics/user-group-new.png"), QIcon.Normal, QIcon.Off)
        self.ui.createButton.setIcon(icon)

        self.ui.cancelButton.hide()
        self.checkUsers()
开发者ID:MusaSakizci,项目名称:yali-family,代码行数:20,代码来源:ScrUsers.py

示例7: contextMenuEvent

# 需要导入模块: from PyQt5.Qt import QIcon [as 别名]
# 或者: from PyQt5.Qt.QIcon import addPixmap [as 别名]
 def contextMenuEvent(self, event):
     if self.item != None:
         menu = QMenu(self.parent())
         self.actionUpdate = QtWidgets.QAction(self.parent())
         icon = QIcon()
         icon.addPixmap(QPixmap(":/icons/16x16/update"), QIcon.Normal, QIcon.Off)
         self.actionUpdate.setIcon(icon)
         self.actionUpdate.setObjectName(self.item.name)
         self.actionUpdate.setText("Update")
         self.actionUpdate.triggered.connect(self.onUpdate)
         menu.addAction(self.actionUpdate)
         self.actionDelete = QtWidgets.QAction(self.parent())
         icon = QIcon()
         icon.addPixmap(QPixmap(":/icons/16x16/delete"), QIcon.Normal, QIcon.Off)
         self.actionDelete.setIcon(icon)
         self.actionDelete.setObjectName(self.item.name)
         self.actionDelete.setText("Supprimer")
         self.actionDelete.triggered.connect(self.onDelete)
         menu.addAction(self.actionDelete)
         menu.exec_(self.mapToGlobal(event.pos()))
开发者ID:cyril711,项目名称:git-MythicWar,代码行数:22,代码来源:buttonK.py


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