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


C++ KFileItem::pixmap方法代码示例

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


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

示例1: TQListViewItem

KfFileLVI::KfFileLVI(KfindWindow* lv, const KFileItem &item, const TQString& matchingLine)
  : TQListViewItem(lv),
    fileitem(item)
{
  fileInfo = new TQFileInfo(item.url().path());

  TQString size = TDEGlobal::locale()->formatNumber(item.size(), 0);

  TQDateTime dt;
  dt.setTime_t(item.time(TDEIO::UDS_MODIFICATION_TIME));
  TQString date = TDEGlobal::locale()->formatDateTime(dt);

  int perm_index;
  if(fileInfo->isReadable())
    perm_index = fileInfo->isWritable() ? RW : RO;
  else
    perm_index = fileInfo->isWritable() ? WO : NA;

  // Fill the item with data
  setText(0, item.url().fileName(false));
  setText(1, lv->reducedDir(item.url().directory(false)));
  setText(2, size);
  setText(3, date);
  setText(4, i18n(perm[perm_index]));
  setText(5, matchingLine);

  // put the icon into the leftmost column
  setPixmap(0, item.pixmap(16));
}
开发者ID:Fat-Zer,项目名称:tdebase,代码行数:29,代码来源:kfwin.cpp

示例2: setPixmap

K3FileTreeViewItem::K3FileTreeViewItem( K3FileTreeView* parent,
				      const KFileItem &item,
				      KFileTreeBranch *brnch )
   :K3ListViewItem( (Q3ListView*)parent ),
    m_kfileitem(item ),
    m_branch( brnch ),
    m_wasListed(false)
{
   setPixmap(0, item.pixmap( KIconLoader::SizeSmall ));
   setText( 0, item.text());

   m_kfileitem.setExtraData( m_branch, this );
}
开发者ID:ssj-gz,项目名称:emscripten-kdelibs,代码行数:13,代码来源:k3filetreeviewitem.cpp

示例3: activatedDragAndDrop

void StackFolder::activatedDragAndDrop(const KFileItem &item)
{

    QMimeData *mime = new QMimeData;
    QList<QUrl> urls;
    urls.append(item.url());
    mime->setUrls(urls);
    QDrag *drag = new QDrag(view());
    drag->setMimeData(mime);
    QString local_path = item.localPath();
    PreviewGenerator *gen = PreviewGenerator::createInstance();
    Q_ASSERT(gen != 0);

    if (gen->hasPreviewPixmap(local_path)) {
        drag->setPixmap(gen->getPreviewPixmap(item.localPath()).scaled(KIconLoader::SizeMedium, KIconLoader::SizeMedium, Qt::KeepAspectRatio));
    }
    else
        drag->setPixmap(item.pixmap(0));
    drag->exec(Qt::CopyAction | Qt::MoveAction | Qt::LinkAction, Qt::CopyAction);
}
开发者ID:KDE,项目名称:stackfolder,代码行数:20,代码来源:stackfolder.cpp

示例4: slNewFileItems

void ThumbView::slNewFileItems( const KFileItemList& items )
{
   kdDebug(28000) << "Creating thumbnails for fileItemList" << endl;

   /* Fill the pending jobs list. */
   KFileItemListIterator it( items );
   KFileItem *item = 0;
   for ( ; (item = it.current()); ++it )
   {
      QString filename = item->url().prettyURL();
      if( item->isDir() )
      {
	 /* create a dir pixmap */
      }
      else
      {
	 QPixmap p(m_basePix) ;
	 QPixmap mime( item->pixmap(0) );

	 if( p.width() > mime.width() && p.height() > mime.height() )
	 {
	    QPainter paint( &p );
	    paint.drawPixmap( (p.width()-mime.width())/2,
			      (p.height()-mime.height())/2,
			      mime );
	    paint.flush();
	 }

	 /* Create a new empty preview pixmap and store the pointer to it */
	 ThumbViewItem *newIconViewIt = new ThumbViewItem( m_iconView,
							   item->url().filename(),
							   createPixmap( p ),
							   item );

	 newIconViewIt->setItemUrl( item->url() );

	 /* tell the file item about the iconView-representation */
	 item->setExtraData( this, newIconViewIt );

	 m_pendingJobs.append( item );
      }
   }

   /*
     From a mail from Waldo Bastian pointing out problems with thumbview:

     2) I think you may end up creating two PreviewJob's in parallel
        when the slNewFileItems() function is called two times in
        quick succession. The current code doesn't seem to expect
        that, given the comment in slPreviewResult(). In the light of
        1) it might become fatal since you will not be able to call
        PreviewJob::removeItem on the proper job. I suggest to queue
        new items when a job is already running and start a new job
        once the first one is finished when there are any items left
        in the queue. Don't forget to delete items from the queue if
        they get deleted in the mean time.

        The strategy is as follows: In the global list m_pendingJobs
        the jobs to start are appended. Only if m_job is zero (no job
        is running) a job is started on the current m_pendingJobs list.
        The m_pendingJobs list is clear afterwords.
   */

   if( ! m_job && m_pendingJobs.count() > 0 )
   {
      /* Progress-Bar */
      m_progress->show();
      m_progress->setTotalSteps(m_pendingJobs.count());
      m_cntJobsStarted = 0;

      /* start a preview-job */
      m_job = KIO::filePreview(m_pendingJobs, m_pixWidth, m_pixHeight );

      if( m_job )
      {
	 connect( m_job, SIGNAL( result( KIO::Job * )),
		  this, SLOT( slPreviewResult( KIO::Job * )));
	 connect( m_job, SIGNAL( gotPreview( const KFileItem*, const QPixmap& )),
		  SLOT( slGotPreview( const KFileItem*, const QPixmap& ) ));

         m_pendingJobs.clear();

         /* KIO::Jo result is called in any way: Success, Failed, Error,
	  * thus connecting the failed is not really necessary.
	  */
        // connect( job, SIGNAL( failed( const KFileItem* )),
        //          this, SLOT( slotFailed( const KFileItem* ) ));

      }
   }
开发者ID:serghei,项目名称:kde3-kdegraphics,代码行数:90,代码来源:thumbview.cpp

示例5: 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;

} 
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:96,代码来源:kfileitemloader.cpp


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