本文整理汇总了C++中KFileItem::iconName方法的典型用法代码示例。如果您正苦于以下问题:C++ KFileItem::iconName方法的具体用法?C++ KFileItem::iconName怎么用?C++ KFileItem::iconName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KFileItem
的用法示例。
在下文中一共展示了KFileItem::iconName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateIconWidget
void StackFolder::updateIconWidget()
{
if (!m_placesModel) {
m_placesModel = new KFilePlacesModel(this);
const QModelIndex index = m_placesModel->closestItem(m_topUrl);
const KUrl url = m_placesModel->url(index);
KFileItem item = m_dirModel->itemForIndex(QModelIndex());
if (!item.isNull() && item.iconName() != "inode-directory") {
m_icon = KIcon(item.iconName(), 0, item.overlays());
}
else if (m_topUrl.protocol() == "desktop") {
m_icon = KIcon("user-desktop");
}
else if (m_topUrl.protocol() == "trash") {
m_icon = m_model->rowCount() > 0 ? KIcon("user-trash-full") : KIcon("user-trash");
}
else if (index.isValid() && url.equals(m_topUrl, KUrl::CompareWithoutTrailingSlash)) {
m_icon = m_placesModel->icon(index);
}
m_iconAnimation1 = new QPropertyAnimation(this, "popupIconSize");
m_iconAnimation1->setDuration(600);
m_iconAnimation2 = new QPropertyAnimation(this, "popupIconSize");
m_iconAnimation1->setDuration(600);
m_iconAnimationGroup = new QSequentialAnimationGroup;
m_iconAnimationGroup->addAnimation(m_iconAnimation1);
m_iconAnimationGroup->addAnimation(m_iconAnimation2);
m_iconAnimationGroup->setLoopCount(4);
connect(m_iconAnimationGroup, SIGNAL(finished()), this, SLOT(iconAnimationFinished()));
setPopupIcon(m_icon);
// Update the tooltip
Plasma::ToolTipContent data;
data.setMainText(i18n("Stack Folder"));
data.setSubText(m_topUrl.fileName(KUrl::IgnoreTrailingSlash));
data.setImage(m_icon);
Plasma::ToolTipManager::self()->setContent(this, data);
}
}
示例2: iconName
QString FolderModel::iconName() const
{
const KFileItem rootItem(m_dirModel->dirLister()->url());
if (!rootItem.isFinalIconKnown()) {
rootItem.determineMimeType();
}
return rootItem.iconName();
}
示例3: initializeItemListWidget
void KFileItemListView::initializeItemListWidget(KItemListWidget* item)
{
KStandardItemListView::initializeItemListWidget(item);
// Make sure that the item has an icon.
QHash<QByteArray, QVariant> data = item->data();
if (!data.contains("iconName") && data["iconPixmap"].value<QPixmap>().isNull()) {
Q_ASSERT(qobject_cast<KFileItemModel*>(model()));
KFileItemModel* fileItemModel = static_cast<KFileItemModel*>(model());
const KFileItem fileItem = fileItemModel->fileItem(item->index());
data.insert("iconName", fileItem.iconName());
item->setData(data, QSet<QByteArray>() << "iconName");
}
}
示例4: Value
KJS::Value KJSEmbed::Bindings::KFileItemImp::call( KJS::ExecState * exec, KJS::Object & self, const KJS::List & args )
{
kdDebug() << "KFileItemImp::call() " << mid << endl;
JSOpaqueProxy *op = JSProxy::toOpaqueProxy( self.imp() );
if ( !op ) {
kdWarning() << "KFileItemImp::call() failed, not a JSOpaqueProxy" << endl;
return KJS::Value();
}
if ( op->typeName() != "KFileItem" ) {
kdWarning() << "KFileItemImp::call() failed, type is " << op->typeName() << endl;
return KJS::Value();
}
KFileItem *obj = op->toNative<KFileItem >();
KJS::Value retValue = KJS::Value();
switch ( mid ) {
case Methodrefresh:
obj->refresh();
break;
case MethodrefreshMimeType:
obj->refreshMimeType();
break;
case Methodurl:
{
QString url = obj->url().url();
retValue = KJS::String(url);
break;
}
case MethodsetUrl:
{
QString url = extractQString(exec, args, 0);
obj->setURL(url);
break;
}
case MethodsetName:
case MethodpermissionsString:
case Methoduser:
case Methodgroup:
case MethodisLink:
case MethodisDir:
case MethodisFile:
case MethodisReadable:
case MethodlinkDest:
case MethodtimeString:
case MethodisLocalFile:
case Methodtext:
{
retValue = convertToValue(exec, obj->text() );
break;
}
case Methodname:
case MethodmimeType:
case MethodisMimeTypeKnown:
case MethodmimeComment:
case MethodiconName:
{
retValue = convertToValue( exec, obj->iconName() );
break;
}
case Methodpixmap:
{
int size = extractInt(exec, args, 0);
int state = extractInt(exec, args, 1);
retValue = convertToValue(exec, obj->pixmap(size, state));
break;
}
case Methodoverlays:
{
retValue = convertToValue(exec, obj->overlays());
break;
}
case MethodgetStatusBarInfo:
{
retValue = KJS::String( obj->getStatusBarInfo() );
break;
}
case MethodgetToolTipText:
{
int maxcount = extractInt(exec, args, 0);
retValue = KJS::String(obj->getToolTipText(maxcount));
break;
}
case Methodrun:
obj->run();
break;
default:
kdWarning() << "KFileItemImp has no method " << mid << endl;
break;
}
op->setValue((void*) obj, "KFileItem");
return retValue;
}