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


Python QStandardItem.setToolTip方法代码示例

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


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

示例1: _cat_desc_to_std_item

# 需要导入模块: from AnyQt.QtGui import QStandardItem [as 别名]
# 或者: from AnyQt.QtGui.QStandardItem import setToolTip [as 别名]
    def _cat_desc_to_std_item(self, desc):
        """
        Create a QStandardItem for the category description.
        """
        item = QStandardItem()
        item.setText(desc.name)

        if desc.icon:
            icon = desc.icon
        else:
            icon = "icons/default-category.svg"

        icon = icon_loader.from_description(desc).get(icon)
        item.setIcon(icon)

        if desc.background:
            background = desc.background
        else:
            background = DEFAULT_COLOR

        background = NAMED_COLORS.get(background, background)

        brush = QBrush(QColor(background))
        item.setData(brush, self.BACKGROUND_ROLE)

        tooltip = desc.description if desc.description else desc.name

        item.setToolTip(tooltip)
        item.setFlags(Qt.ItemIsEnabled)
        item.setData(desc, self.CATEGORY_DESC_ROLE)
        return item
开发者ID:ales-erjavec,项目名称:orange-canvas,代码行数:33,代码来源:qt.py

示例2: _initialize

# 需要导入模块: from AnyQt.QtGui import QStandardItem [as 别名]
# 或者: from AnyQt.QtGui.QStandardItem import setToolTip [as 别名]
    def _initialize(self):
        for pp_def in PREPROCESSORS:
            description = pp_def.description
            if description.icon:
                icon = QIcon(description.icon)
            else:
                icon = QIcon()
            item = QStandardItem(icon, description.title)
            item.setToolTip(description.summary or "")
            item.setData(pp_def, DescriptionRole)
            item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable |
                          Qt.ItemIsDragEnabled)
            self.preprocessors.appendRow([item])

        try:
            model = self.load(self.storedsettings)
        except Exception:
            model = self.load({})

        self.set_model(model)

        if not model.rowCount():
            # enforce default width constraint if no preprocessors
            # are instantiated (if the model is not empty the constraints
            # will be triggered by LayoutRequest event on the `flow_view`)
            self.__update_size_constraint()

        self.apply()
开发者ID:benzei,项目名称:orange3,代码行数:30,代码来源:owpreprocess.py

示例3: _update_header

# 需要导入模块: from AnyQt.QtGui import QStandardItem [as 别名]
# 或者: from AnyQt.QtGui.QStandardItem import setToolTip [as 别名]
 def _update_header(self):
     # Set the correct horizontal header labels on the results_model.
     model = self.result_model
     model.setColumnCount(1 + len(self.scorers))
     for col, score in enumerate(self.scorers):
         item = QStandardItem(score.name)
         item.setToolTip(score.long_name)
         model.setHorizontalHeaderItem(col + 1, item)
     self._update_shown_columns()
开发者ID:benzei,项目名称:orange3,代码行数:11,代码来源:owtestlearners.py

示例4: RecentPath_asqstandarditem

# 需要导入模块: from AnyQt.QtGui import QStandardItem [as 别名]
# 或者: from AnyQt.QtGui.QStandardItem import setToolTip [as 别名]
def RecentPath_asqstandarditem(pathitem):
    icon_provider = QFileIconProvider()
    # basename of a normalized name (strip right path component separators)
    basename = os.path.basename(os.path.normpath(pathitem.abspath))
    item = QStandardItem(
        icon_provider.icon(QFileInfo(pathitem.abspath)),
        basename
    )
    item.setToolTip(pathitem.abspath)
    item.setData(pathitem, Qt.UserRole)
    return item
开发者ID:biolab,项目名称:orange3-imageanalytics,代码行数:13,代码来源:owimageimport.py

示例5: createRow

# 需要导入模块: from AnyQt.QtGui import QStandardItem [as 别名]
# 或者: from AnyQt.QtGui.QStandardItem import setToolTip [as 别名]
    def createRow(item):
        # type: (Item) -> List[QStandardItem]
        if isinstance(item, Installed):
            installed = True
            ins, dist = item.installable, item.local
            name = dist.project_name
            summary = get_dist_meta(dist).get("Summary", "")
            version = ins.version if ins is not None else dist.version
            item_is_core = item.required
        else:
            installed = False
            ins = item.installable
            dist = None
            name = ins.name
            summary = ins.summary
            version = ins.version
            item_is_core = False

        updatable = is_updatable(item)

        item1 = QStandardItem()
        item1.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable |
                       Qt.ItemIsUserCheckable |
                       (Qt.ItemIsUserTristate if updatable else 0))
        item1.setEnabled(not (item_is_core and not updatable))
        item1.setData(item_is_core, HasConstraintRole)

        if installed and updatable:
            item1.setCheckState(Qt.PartiallyChecked)
        elif installed:
            item1.setCheckState(Qt.Checked)
        else:
            item1.setCheckState(Qt.Unchecked)
        item1.setData(item, Qt.UserRole)

        item2 = QStandardItem(name)
        item2.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable)
        item2.setToolTip(summary)
        item2.setData(item, Qt.UserRole)

        if updatable:
            version = "{} < {}".format(dist.version, ins.version)

        item3 = QStandardItem(version)
        item3.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable)

        item4 = QStandardItem()
        item4.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable)

        return [item1, item2, item3, item4]
开发者ID:ales-erjavec,项目名称:orange-canvas,代码行数:52,代码来源:addons.py

示例6: row_for_state

# 需要导入模块: from AnyQt.QtGui import QStandardItem [as 别名]
# 或者: from AnyQt.QtGui.QStandardItem import setToolTip [as 别名]
 def row_for_state(self, score, state):
     attrs = sorted((self.attrs[x] for x in state), key=attrgetter("name"))
     attr_items = []
     for attr in attrs:
         item = QStandardItem(attr.name)
         item.setData(attrs, self._AttrRole)
         item.setData(Qt.AlignLeft + Qt.AlignTop, Qt.TextAlignmentRole)
         item.setToolTip(attr.name)
         attr_items.append(item)
     correlation_item = QStandardItem("{:+.3f}".format(score[1]))
     correlation_item.setData(score[2], self.PValRole)
     correlation_item.setData(attrs, self._AttrRole)
     correlation_item.setData(
         self.NEGATIVE_COLOR if score[1] < 0 else self.POSITIVE_COLOR,
         gui.TableBarItem.BarColorRole)
     return [correlation_item] + attr_items
开发者ID:PrimozGodec,项目名称:orange3,代码行数:18,代码来源:owcorrelations.py

示例7: _widget_desc_to_std_item

# 需要导入模块: from AnyQt.QtGui import QStandardItem [as 别名]
# 或者: from AnyQt.QtGui.QStandardItem import setToolTip [as 别名]
    def _widget_desc_to_std_item(self, desc, category):
        """
        Create a QStandardItem for the widget description.
        """
        item = QStandardItem(desc.name)
        item.setText(desc.name)

        if desc.icon:
            icon = desc.icon
        else:
            icon = "icons/default-widget.svg"

        icon = icon_loader.from_description(desc).get(icon)
        item.setIcon(icon)

        # This should be inherited from the category.
        background = None
        if desc.background:
            background = desc.background
        elif category.background:
            background = category.background
        else:
            background = DEFAULT_COLOR

        if background is not None:
            background = NAMED_COLORS.get(background, background)
            brush = QBrush(QColor(background))
            item.setData(brush, self.BACKGROUND_ROLE)

        tooltip = tooltip_helper(desc)
        style = "ul { margin-top: 1px; margin-bottom: 1px; }"
        tooltip = TOOLTIP_TEMPLATE.format(style=style, tooltip=tooltip)
        item.setToolTip(tooltip)
        item.setWhatsThis(whats_this_helper(desc))
        item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable)
        item.setData(desc, self.WIDGET_DESC_ROLE)

        # Create the action for the widget_item
        action = self.create_action_for_item(item)
        item.setData(action, self.WIDGET_ACTION_ROLE)
        return item
开发者ID:ales-erjavec,项目名称:orange-canvas,代码行数:43,代码来源:qt.py

示例8: load

# 需要导入模块: from AnyQt.QtGui import QStandardItem [as 别名]
# 或者: from AnyQt.QtGui.QStandardItem import setToolTip [as 别名]
    def load(self, saved):
        """Load a preprocessor list from a dict."""
        name = saved.get("name", "")
        preprocessors = saved.get("preprocessors", [])
        model = StandardItemModel()

        def dropMimeData(data, action, row, column, parent):
            if data.hasFormat("application/x-qwidget-ref") and \
                    action == Qt.CopyAction:
                qname = bytes(data.data("application/x-qwidget-ref")).decode()

                ppdef = self._qname2ppdef[qname]
                item = QStandardItem(ppdef.description.title)
                item.setData({}, ParametersRole)
                item.setData(ppdef.description.title, Qt.DisplayRole)
                item.setData(ppdef, DescriptionRole)
                self.preprocessormodel.insertRow(row, [item])
                return True
            else:
                return False

        model.dropMimeData = dropMimeData

        for qualname, params in preprocessors:
            pp_def = self._qname2ppdef[qualname]
            description = pp_def.description
            item = QStandardItem(description.title)
            if description.icon:
                icon = QIcon(description.icon)
            else:
                icon = QIcon()
            item.setIcon(icon)
            item.setToolTip(description.summary)
            item.setData(pp_def, DescriptionRole)
            item.setData(params, ParametersRole)

            model.appendRow(item)
        return model
开发者ID:benzei,项目名称:orange3,代码行数:40,代码来源:owpreprocess.py

示例9: _icon_item

# 需要导入模块: from AnyQt.QtGui import QStandardItem [as 别名]
# 或者: from AnyQt.QtGui.QStandardItem import setToolTip [as 别名]
 def _icon_item(tooltip):
     item = QStandardItem()
     item.setEditable(False)
     item.setToolTip(tooltip)
     return item
开发者ID:benzei,项目名称:orange3,代码行数:7,代码来源:owreport.py

示例10: set_items

# 需要导入模块: from AnyQt.QtGui import QStandardItem [as 别名]
# 或者: from AnyQt.QtGui.QStandardItem import setToolTip [as 别名]
    def set_items(self, items):
        # type: (List[Item]) -> None
        self.__items = items
        model = self.__model
        model.setRowCount(0)

        for item in items:
            if isinstance(item, Installed):
                installed = True
                ins, dist = item
                name = dist.project_name
                summary = get_dist_meta(dist).get("Summary", "")
                version = ins.version if ins is not None else dist.version
            else:
                installed = False
                (ins,) = item
                dist = None
                name = ins.name
                summary = ins.summary
                version = ins.version

            updatable = is_updatable(item)

            item1 = QStandardItem()
            item1.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable |
                           Qt.ItemIsUserCheckable |
                           (Qt.ItemIsTristate if updatable else 0))

            if installed and updatable:
                item1.setCheckState(Qt.PartiallyChecked)
            elif installed:
                item1.setCheckState(Qt.Checked)
            else:
                item1.setCheckState(Qt.Unchecked)
            item1.setData(item, Qt.UserRole)

            item2 = QStandardItem(cleanup(name))
            item2.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable)
            item2.setToolTip(summary)
            item2.setData(item, Qt.UserRole)

            if updatable:
                version = "{} < {}".format(dist.version, ins.version)

            item3 = QStandardItem(version)
            item3.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable)

            item4 = QStandardItem()
            item4.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable)

            model.appendRow([item1, item2, item3, item4])

        model.sort(1)

        self.__view.resizeColumnToContents(0)
        self.__view.setColumnWidth(
            1, max(150, self.__view.sizeHintForColumn(1)))
        self.__view.setColumnWidth(
            2, max(150, self.__view.sizeHintForColumn(2)))

        if self.__items:
            self.__view.selectionModel().select(
                self.__view.model().index(0, 0),
                QItemSelectionModel.Select | QItemSelectionModel.Rows
            )
        self.__proxy.sort(1)  # sorting list of add-ons in alphabetical order
开发者ID:PrimozGodec,项目名称:orange3,代码行数:68,代码来源:addons.py

示例11: _update_stats_model

# 需要导入模块: from AnyQt.QtGui import QStandardItem [as 别名]
# 或者: from AnyQt.QtGui.QStandardItem import setToolTip [as 别名]
    def _update_stats_model(self):
        # Update the results_model with up to date scores.
        # Note: The target class specific scores (if requested) are
        # computed as needed in this method.
        model = self.view.model()
        # clear the table model, but preserving the header labels
        for r in reversed(range(model.rowCount())):
            model.takeRow(r)

        target_index = None
        if self.data is not None:
            class_var = self.data.domain.class_var
            if self.data.domain.has_discrete_class and \
                            self.class_selection != self.TARGET_AVERAGE:
                target_index = class_var.values.index(self.class_selection)
        else:
            class_var = None

        errors = []
        has_missing_scores = False

        for key, slot in self.learners.items():
            name = learner_name(slot.learner)
            head = QStandardItem(name)
            head.setData(key, Qt.UserRole)
            if isinstance(slot.results, Try.Fail):
                head.setToolTip(str(slot.results.exception))
                head.setText("{} (error)".format(name))
                head.setForeground(QtGui.QBrush(Qt.red))
                errors.append("{name} failed with error:\n"
                              "{exc.__class__.__name__}: {exc!s}"
                              .format(name=name, exc=slot.results.exception))

            row = [head]

            if class_var is not None and class_var.is_discrete and \
                    target_index is not None:
                if slot.results is not None and slot.results.success:
                    ovr_results = results_one_vs_rest(
                        slot.results.value, target_index)

                    # Cell variable is used immediatelly, it's not stored
                    # pylint: disable=cell-var-from-loop
                    stats = [Try(scorer_caller(scorer, ovr_results))
                             for scorer in self.scorers]
                else:
                    stats = None
            else:
                stats = slot.stats

            if stats is not None:
                for stat in stats:
                    item = QStandardItem()
                    if stat.success:
                        item.setText("{:.3f}".format(stat.value[0]))
                    else:
                        item.setToolTip(str(stat.exception))
                        has_missing_scores = True
                    row.append(item)

            model.appendRow(row)

        self.error("\n".join(errors), shown=bool(errors))
        self.Warning.scores_not_computed(shown=has_missing_scores)
开发者ID:benzei,项目名称:orange3,代码行数:66,代码来源:owtestlearners.py


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