本文整理汇总了C++中kservice::Ptr::constData方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::constData方法的具体用法?C++ Ptr::constData怎么用?C++ Ptr::constData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kservice::Ptr
的用法示例。
在下文中一共展示了Ptr::constData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: viewInInternalViewer
bool ArkViewer::viewInInternalViewer(const QString& fileName, const QMimeType &mimeType)
{
setWindowFilePath(fileName);
// Set icon and comment for the mimetype.
m_iconLabel->setPixmap(QIcon::fromTheme(mimeType.iconName()).pixmap(IconSize(KIconLoader::Small), IconSize(KIconLoader::Small)));
m_commentLabel->setText(mimeType.comment());
// Create the ReadOnlyPart instance.
m_part = KMimeTypeTrader::self()->createPartInstanceFromQuery<KParts::ReadOnlyPart>(mimeType.name(), this, this);
// Drop the KHTMLPart, if necessary.
const KService::Ptr service = KMimeTypeTrader::self()->preferredService(mimeType.name(), QStringLiteral("KParts/ReadOnlyPart"));
qCDebug(ARK) << "Preferred service for mimetype" << mimeType.name() << "is" << service->library();
if (service.constData()->desktopEntryName() == QLatin1String("khtml")) {
KService::List offers = KMimeTypeTrader::self()->query(mimeType.name(), QStringLiteral("KParts/ReadOnlyPart"));
offers.removeFirst();
qCDebug(ARK) << "Removed KHTMLPart from the offers for mimetype" << mimeType.name()
<< ". Using" << offers.first().constData()->desktopEntryName() << "instead.";
m_part = offers.first().constData()->createInstance<KParts::ReadOnlyPart>(this, this);
}
if (!m_part.data()) {
return false;
}
// Insert the KPart into its placeholder.
centralWidget()->layout()->replaceWidget(m_partPlaceholder, m_part.data()->widget());
createGUI(m_part.data());
setAutoSaveSettings(QStringLiteral("Viewer"), true);
m_part.data()->openUrl(QUrl::fromLocalFile(fileName));
m_part.data()->widget()->setFocus();
m_fileName = fileName;
return true;
}