本文整理汇总了C++中kmimetype::Ptr::pixmap方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::pixmap方法的具体用法?C++ Ptr::pixmap怎么用?C++ Ptr::pixmap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kmimetype::Ptr
的用法示例。
在下文中一共展示了Ptr::pixmap方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setIconAndTextForType
void KMMimePartTreeItem::setIconAndTextForType( const QString & mime )
{
QString mimetype = mime.lower();
if ( mimetype.startsWith( "multipart/" ) ) {
setText( 1, mimetype );
setPixmap( 0, SmallIcon("folder") );
} else if ( mimetype == "application/octet-stream" ) {
setText( 1, i18n("Unspecified Binary Data") ); // don't show "Unknown"...
setPixmap( 0, SmallIcon("unknown") );
} else {
KMimeType::Ptr mtp = KMimeType::mimeType( mimetype );
setText( 1, (mtp && !mtp->comment().isEmpty()) ? mtp->comment() : mimetype );
setPixmap( 0, mtp ? mtp->pixmap( KIcon::Small) : SmallIcon("unknown") );
}
}
示例2: pixmap
QPixmap KFileItem::pixmap( int _size, int _state ) const
{
if (d && (!d->iconName.isEmpty()))
return DesktopIcon(d->iconName,_size,_state);
if ( !m_pMimeType )
{
static const QString & defaultFolderIcon =
KGlobal::staticQString(KMimeType::mimeType( "inode/directory" )->KServiceType::icon());
if ( S_ISDIR( m_fileMode ) )
return DesktopIcon( defaultFolderIcon, _size, _state );
return DesktopIcon( "unknown", _size, _state );
}
_state |= overlays();
KMimeType::Ptr mime;
// Use guessed mimetype if the main one hasn't been determined for sure
if ( !m_bMimeTypeKnown && !m_guessedMimeType.isEmpty() )
mime = KMimeType::mimeType( m_guessedMimeType );
else
mime = m_pMimeType;
// Support for gzipped files: extract mimetype of contained file
// See also the relevant code in overlays, which adds the zip overlay.
if ( mime->name() == "application/x-gzip" && m_url.fileName().right(3) == ".gz" )
{
KURL sf;
sf.setPath( m_url.path().left( m_url.path().length() - 3 ) );
//kdDebug() << "KFileItem::pixmap subFileName=" << subFileName << endl;
mime = KMimeType::findByURL( sf, 0, m_bIsLocalURL );
}
bool isLocalURL;
KURL url = mostLocalURL(isLocalURL);
QPixmap p = mime->pixmap( url, KIcon::Desktop, _size, _state );
//kdDebug() << "finding pixmap for " << url.url() << " : " << mime->name() << endl;
if (p.isNull())
kdWarning() << "Pixmap not found for mimetype " << m_pMimeType->name() << endl;
return p;
}
示例3: setAttachment
void AttachPropertyDialog::setAttachment(KTNEFAttach *attach)
{
QString s = (attach->fileName().isEmpty() ? attach->name() : attach->fileName());
filename_->setText("<b>"+s+"</b>");
setCaption(s);
display_->setText(attach->displayName());
mime_->setText(attach->mimeTag());
s.setNum(attach->size());
s.append(" bytes");
size_->setText(s);
KMimeType::Ptr mimetype = KMimeType::mimeType(attach->mimeTag());
QPixmap pix = loadRenderingPixmap( attach, colorGroup().background() );
if ( !pix.isNull() )
icon_->setPixmap( pix );
else
icon_->setPixmap(mimetype->pixmap(KIcon::Small));
description_->setText(mimetype->comment());
s.setNum(attach->index());
index_->setText(s);
formatPropertySet( attach, properties_ );
m_attach = attach;
}
示例4: TQTabWidget
//.........这里部分代码省略.........
"program files and images).</qt>");
TQToolTip::add(binaryContextCb,binaryTooltip);
TQPushButton* editRegExp = 0;
if ( !TDETrader::self()->query("KRegExpEditor/KRegExpEditor").isEmpty() ) {
// The editor is available, so lets use it.
editRegExp = new TQPushButton(i18n("&Edit..."), pages[2], "editRegExp");
}
metainfokeyEdit=new KLineEdit(pages[2], "textEdit" );
metainfoEdit=new KLineEdit(pages[2], "textEdit" );
TQLabel * textMetaInfo = new TQLabel(metainfoEdit, i18n("fo&r:"), pages[2], "text");
TQLabel * textMetaKey = new TQLabel(metainfokeyEdit, i18n("Search &metainfo sections:"), pages[2], "text");
// Setup
typeBox->insertItem(i18n("All Files & Folders"));
typeBox->insertItem(i18n("Files"));
typeBox->insertItem(i18n("Folders"));
typeBox->insertItem(i18n("Symbolic Links"));
typeBox->insertItem(i18n("Special Files (Sockets, Device Files, ...)"));
typeBox->insertItem(i18n("Executable Files"));
typeBox->insertItem(i18n("SUID Executable Files"));
typeBox->insertItem(i18n("All Images"));
typeBox->insertItem(i18n("All Video"));
typeBox->insertItem(i18n("All Sounds"));
initMimeTypes();
initSpecialMimeTypes();
for ( KMimeType::List::ConstIterator it = m_types.begin();
it != m_types.end(); ++it )
{
KMimeType::Ptr typ = *it;
typeBox->insertItem(typ->pixmap( TDEIcon::Small ), typ->comment());
}
if ( editRegExp ) {
// The editor was available, so lets use it.
connect( regexpContentCb, TQT_SIGNAL(toggled(bool) ), editRegExp, TQT_SLOT(setEnabled(bool)) );
editRegExp->setEnabled(false);
connect( editRegExp, TQT_SIGNAL(clicked()), this, TQT_SLOT( slotEditRegExp() ) );
}
else
regexpContentCb->hide();
// Layout
tmp = sizeEdit->fontMetrics().width(" 00000 ");
sizeEdit->setMinimumSize(tmp, sizeEdit->sizeHint().height());
TQGridLayout *grid2 = new TQGridLayout( pages[2], 5, 4,
KDialog::marginHint(),
KDialog::spacingHint() );
grid2->addWidget( typeL, 0, 0 );
grid2->addWidget( textL, 1, 0 );
grid2->addMultiCellWidget( typeBox, 0, 0, 1, 3 );
grid2->addMultiCellWidget( textEdit, 1, 1, 1, 3 );
grid2->addWidget( regexpContentCb, 2, 2);
grid2->addWidget( caseContextCb, 2, 1 );
grid2->addWidget( binaryContextCb, 3, 1);
grid2->addWidget( textMetaKey, 4, 0 );
grid2->addWidget( metainfokeyEdit, 4, 1 );
grid2->addWidget( textMetaInfo, 4, 2, Qt::AlignHCenter );
grid2->addWidget( metainfoEdit, 4, 3 );
metainfokeyEdit->setText("*");