Quote Originally Posted by wysota View Post
QFileIconProvider is not a QObject, so you can't use Q_OBJECT with it.

if i remove Q_OBJECT can compile but not running...! and not display my icons..

i put Q_OBJECT why? on scribus apps having....

http://stuff.mit.edu/afs/athena/soft...ustomfdialog.h

maybe is qt3 ... i dont no..
Qt Code:
  1. #include "scribusapi.h"
  2.  
  3. /**
  4.   *@author Franz Schmid
  5.   */
  6. class SCRIBUS_API ImIconProvider : public QFileIconProvider
  7. {
  8. Q_OBJECT
  9. QPixmap imagepm;
  10. QPixmap docpm;
  11. QPixmap pspm;
  12. QPixmap pdfpm;
To copy to clipboard, switch view to plain text mode 



i put so... and default icon is here ...

modeluser = new QDirModel();
modeluser->setIconProvider(new ImIconProvider());
modeluser->setResolveSymlinks(false);
usertree->setModel(modeluser);
modeluser->setSupportedDragActions(Qt::CopyAction);
usertree->setDragEnabled(true);
usertree->setRootIndex(modeluser->index(ustart));

i can drag file direct to desktop (on model or outsite model) or viceversa .. is running rename delete , open file on clicked all running .. only the icon is fake....










Qt Code:
  1. class ImIconProvider : public QFileIconProvider
  2. {
  3. public:
  4. QStringList file_image;
  5. QStringList file_text;
  6. QStringList file_other;
  7. ImIconProvider();
  8. ~ImIconProvider() {};
  9. QIcon icon( const QFileInfo & fi );
  10. QIcon icon( IconType type );
  11. };
  12.  
  13. ImIconProvider::ImIconProvider()
  14. {
  15. file_image.clear();
  16. file_text.clear();
  17. file_other.clear();
  18. file_image << "eps" << "gif" << "png" << "jpg" << "jpeg" << "xpm" << "tif" << "tiff" << "bmp" << "pbm" << "pgm" << "ppm" << "xbm" << "xpm" << "psd";
  19. file_text << "txt" << "cpp" << "h" << "dat" << "conf" << "ini" << "rtf" << "fos" << "xml" << "htm" << "html" << "css" <<"js";
  20. file_other << "pdf" << "doc" << "pdf" << "exe" << "rar" << "bz" << "tar" << "gz" << "zip";
  21. }
  22.  
  23. QIcon ImIconProvider::icon(const QFileInfo &fi)
  24. {
  25. qDebug() << "### filename " << fi.fileName(); /* nothing comming!! */
  26.  
  27. const QString ext = fi.suffix().toLower();
  28. if (file_image.contains(ext)) {
  29. return QIcon("image.png");
  30. } else if (file_image.contains(ext)) {
  31. return QIcon("text.png");
  32. } else if (file_image.contains(ext)) {
  33. return QIcon("other.png");
  34. } else {
  35. return QIcon("other.png");
  36. }
  37. /* end icon s*/
  38. }
  39.  
  40. QIcon ImIconProvider::icon( IconType type )
  41. {
  42. return QIcon("other.png");
  43. }
To copy to clipboard, switch view to plain text mode