
Originally Posted by
wysota
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..
#include "scribusapi.h"
/**
*@author Franz Schmid
*/
{
Q_OBJECT
#include "scribusapi.h"
/**
*@author Franz Schmid
*/
class SCRIBUS_API ImIconProvider : public QFileIconProvider
{
Q_OBJECT
QStringList fmts;
QPixmap imagepm;
QPixmap docpm;
QPixmap pspm;
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....

{
public:
ImIconProvider();
~ImIconProvider() {};
QIcon icon
( IconType type
);
};
ImIconProvider::ImIconProvider()
{
file_image.clear();
file_text.clear();
file_other.clear();
file_image << "eps" << "gif" << "png" << "jpg" << "jpeg" << "xpm" << "tif" << "tiff" << "bmp" << "pbm" << "pgm" << "ppm" << "xbm" << "xpm" << "psd";
file_text << "txt" << "cpp" << "h" << "dat" << "conf" << "ini" << "rtf" << "fos" << "xml" << "htm" << "html" << "css" <<"js";
file_other << "pdf" << "doc" << "pdf" << "exe" << "rar" << "bz" << "tar" << "gz" << "zip";
}
{
qDebug() << "### filename " << fi.fileName(); /* nothing comming!! */
const QString ext
= fi.
suffix().
toLower();
if (file_image.contains(ext)) {
return QIcon("image.png");
} else if (file_image.contains(ext)) {
return QIcon("text.png");
} else if (file_image.contains(ext)) {
return QIcon("other.png");
} else {
return QIcon("other.png");
}
/* end icon s*/
}
QIcon ImIconProvider
::icon( IconType type
) {
return QIcon("other.png");
}
class ImIconProvider : public QFileIconProvider
{
public:
QStringList file_image;
QStringList file_text;
QStringList file_other;
ImIconProvider();
~ImIconProvider() {};
QIcon icon( const QFileInfo & fi );
QIcon icon( IconType type );
};
ImIconProvider::ImIconProvider()
{
file_image.clear();
file_text.clear();
file_other.clear();
file_image << "eps" << "gif" << "png" << "jpg" << "jpeg" << "xpm" << "tif" << "tiff" << "bmp" << "pbm" << "pgm" << "ppm" << "xbm" << "xpm" << "psd";
file_text << "txt" << "cpp" << "h" << "dat" << "conf" << "ini" << "rtf" << "fos" << "xml" << "htm" << "html" << "css" <<"js";
file_other << "pdf" << "doc" << "pdf" << "exe" << "rar" << "bz" << "tar" << "gz" << "zip";
}
QIcon ImIconProvider::icon(const QFileInfo &fi)
{
qDebug() << "### filename " << fi.fileName(); /* nothing comming!! */
const QString ext = fi.suffix().toLower();
if (file_image.contains(ext)) {
return QIcon("image.png");
} else if (file_image.contains(ext)) {
return QIcon("text.png");
} else if (file_image.contains(ext)) {
return QIcon("other.png");
} else {
return QIcon("other.png");
}
/* end icon s*/
}
QIcon ImIconProvider::icon( IconType type )
{
return QIcon("other.png");
}
To copy to clipboard, switch view to plain text mode
Bookmarks