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


C++ XdgDesktopFile::icon方法代码示例

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


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

示例1: load

void XdgAction::load(const XdgDesktopFile& desktopFile)
{
    mDesktopFile = desktopFile;
    if (mDesktopFile.isValid())
    {
        setText(mDesktopFile.name());
        setToolTip(mDesktopFile.comment());

        setIcon(desktopFile.icon());
        if (icon().isNull())
            setIcon(XdgIcon::fromTheme("application-x-executable"));

        connect(this, SIGNAL(triggered()), this, SLOT(runConmmand()));
    }
    else
    {
        setText("");
        setToolTip("");
        setIcon(QIcon());
    }
}
开发者ID:grimtraveller,项目名称:netbas,代码行数:21,代码来源:xdgaction.cpp

示例2: loadDesktopFile

QVariantMap XdgModule::loadDesktopFile(const QString &fileName){
  QVariantMap result;

  XdgDesktopFile desktop;
  desktop.load(fileName);
  switch(desktop.type()){
  case XdgDesktopFile::UnknownType:
    result["type"] = "unknown";
    break;
  case XdgDesktopFile::ApplicationType:
    result["type"] = "application";
    break;
  case XdgDesktopFile::LinkType:
    result["type"] = "link";
    break;
  case XdgDesktopFile::DirectoryType:
    result["type"] = "directory";
  }
  result["valid"] = desktop.isValid();
  result["categories"] = desktop.categories();
  result["icon"] = desktop.icon().pixmap(icon_size, icon_size);
  result["icon_name"] = desktop.iconName();
  result["name"] = desktop.name();
  result["comment"] = desktop.comment();
  QString url = desktop.url();
  QVariant exec = desktop.value("Exec");
  QVariant no_display = desktop.value("NoDisplay");
  if(!url.isEmpty())
    result["url"] = url;
  if(exec.isValid())
    result["exec"] = exec;
  if(no_display.isValid())
    result["no_display"] = no_display;

  return result;
}
开发者ID:Icenowy,项目名称:Cubway,代码行数:36,代码来源:xdg.cpp

示例3: currentMimetypeChanged

void MimetypeViewer::currentMimetypeChanged()
{
    widget.iconLabel->hide();
    widget.descriptionLabel->setText(tr("None"));
    widget.mimetypeGroupBox->setEnabled(false);

    widget.patternsLabel->clear();
    widget.patternsGroupBox->setEnabled(false);

    widget.appIcon->hide();
    widget.applicationLabel->clear();
    widget.applicationsGroupBox->setEnabled(false);

    QTreeWidgetItem *sel = widget.mimetypeTreeWidget->currentItem();

    if (!sel || sel->type() == GroupType) {
        return;
    }

    MimeTypeData mimeData = sel->data(0, Qt::UserRole).value<MimeTypeData>();

    QMimeDatabase db;
    XdgMimeType mt = db.mimeTypeForName(mimeData.name());
    if (mt.name().isEmpty())
        return;

    m_CurrentMime = mt;

    widget.descriptionLabel->setText(mimeData.comment());

    QIcon icon = m_CurrentMime.icon();
    if (! icon.isNull())
    {
        widget.iconLabel->setPixmap(icon.pixmap(widget.iconLabel->size()));
        widget.iconLabel->show();
    }

    widget.mimetypeGroupBox->setEnabled(true);
    widget.patternsLabel->setText(mimeData.patterns());
    widget.patternsGroupBox->setEnabled(true);

    XdgDesktopFile* defaultApp = XdgDesktopFileCache::getDefaultApp(m_CurrentMime.name());
    if (defaultApp && defaultApp->isValid())
    {
        QString nonLocalizedName = defaultApp->value("Name").toString();
        QString localizedName = defaultApp->localizedValue("Name", nonLocalizedName).toString();
        QIcon appIcon = defaultApp->icon();
        widget.appIcon->setPixmap(appIcon.pixmap(widget.iconLabel->size()));
        widget.appIcon->show();
        widget.applicationLabel->setText(localizedName);
        widget.chooseApplicationsButton->setText(tr("&Change..."));
    }
    else
    {
        widget.applicationLabel->setText(tr("None"));
        widget.chooseApplicationsButton->setText(tr("&Choose..."));
    }

    widget.applicationsGroupBox->setEnabled(true);

}
开发者ID:lxde,项目名称:lxqt-config,代码行数:61,代码来源:mimetypeviewer.cpp


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