PDA

View Full Version : QTextEdit



ocean
13th September 2008, 10:07
I have an application that creates an html code and sends it to QTextEdit widget. In my computer, i can see images in that code, but when i run my app on another computer, nothing shows up. I set env. variables, reimplemented the html exporting code which contains full path (and tested it, works on my comp.), tried to use debug versions on the other computers, but i didn't able to work it out. Any suggestions?

patrik08
13th September 2008, 10:19
I have an application that creates an html code and sends it to QTextEdit widget. In my computer, i can see images in that code, but when i run my app on another computer, nothing shows up. I set env. variables, reimplemented the html exporting code which contains full path (and tested it, works on my comp.), tried to use debug versions on the other computers, but i didn't able to work it out. Any suggestions?

try to run this code to having sure that all image plug-in running on client..




static QString ImageFilterHaving() const
{
QString filter;
filter = tr( "All supported Types" ) + " (";
QList<QByteArray> formats = QImageReader::supportedImageFormats();
for ( int x = 0; x < formats.count(); ++x ) {

filter += QString( "*.%1" ).arg( QString( formats[ x ] ) );
if ( x != formats.count() - 1 )
filter += " ";
}
filter += ");;";
QString filterSimple;
double gsversion = 0; ///////getGSVersion();
//////qDebug() << "### args " << gsversion;
filterSimple += tr( "Scalable Vector Graphics" ) + " (*.svg *.svg.gz);;";
if (gsversion > 6.5) {
filterSimple += tr( "PostScript Vector Graphics" ) + " (*.ps *.eps);;";
filterSimple += tr( "PDF Page units" ) + " (*.pdf);;";
}

filterSimple += tr( "QPicture qt4.1 > " ) + " (*.pic);;";

for ( int y = 0; y < formats.count(); ++y ) {

QString form( formats[ y ] );
if ( form == "bmp" )
filterSimple += tr( "Windows Bitmap" ) + " (*.bmp)";
else if ( form == "gif" )
filterSimple += tr( "Graphic Interchange Format" ) + " (*.gif)";
else if ( form == "jpeg" || form == "jpg" ) {

if ( !filterSimple.contains( form ) )
filterSimple += tr( "Joint Photographic Experts Group" ) + " (*.jpeg *.jpg)";
} else if ( form == "mng" )
filterSimple += tr( "Multiple-image Network Graphics" ) + " (*.mng)";
else if ( form == "png" )
filterSimple += tr( "Portable Network Graphics" ) + " (*.png)";
else if ( form == "pbm" || form == "ppm" ) {

if ( !filterSimple.contains( form ) )
filterSimple += tr( "Portable Bitmap" ) + " (*.pbm *.ppm)";
} else if ( form == "pgm" )
filterSimple += tr( "Portable Graymap" ) + " (*.pgm)";
else if ( form == "xbm" || form == "xpm" ) {

if ( !filterSimple.contains( form ) )
filterSimple += tr( "X11 Bitmap" ) + " (*.xbm *.xpm)";
} else if ( form == "ico" )
filterSimple += tr( "Icon Image File Format" ) + " (*.ico)";
else if ( form == "jp2" || form == "j2k" ) {

if ( !filterSimple.contains( form ) )
filterSimple += tr( "JPEG 2000" ) + " (*.jp2 *.j2k)";
} else if ( form == "tif" || form == "tiff" ) {

if ( !filterSimple.contains( form ) )
filterSimple += tr( "Tagged Image File Format" ) + " (*.tif *.tiff)";
} else
filterSimple += tr( "Unknown Format" ) + QString( " (*.%1)" ).arg( form );

if ( y != formats.count() - 1 && !filterSimple.endsWith( ";;" ) )
filterSimple += ";;";
}
filterSimple = filterSimple.left( filterSimple.length() - 2 );
filter += filterSimple;
return filter;
}

QString file = QFileDialog::getOpenFileName(0, tr( "Choose Image to insert..." ), "" , ImageFilterHaving() );

if ( file.isEmpty() ) {
return;
}

ocean
13th September 2008, 10:43
Yeah, this code was really useful. Thank you.

patrik08
13th September 2008, 11:03
Yeah, this code was really useful. Thank you.

I tested it on my client computers, .JPG is not on the list. That sounds interesting to me. How to enable JPEG plugins on win32 platform?


use PNG image ( base format from qt ) its evry time inside
PNG can make alpha / transparent chanel million color fast compression
if you use firefox png lib compression is better/faster and you can animate image like gif inside QT

http://www.miwa-immobilien-allgaeu.de/privat/Animationen_gif2apng_gif2mng_gif2swf.htm
http://www.qt-apps.org/content/show.php/APNG+Image%2BVideo+format+assembler?content=81573
http://www.qt-apps.org/content/show.php/Apng+Video+Frame+Label?content=82221

or ...

tell your installer to copy imageformats recursive to application path...




Source: "D:\_INSTALLER_qt4.0\imageformats\*"; \
DestDir: "{app}/imageformats/"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "D:\_INSTALLER_qt4.0\locale\*"; DestDir: "{app}/locale/"; \
Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

wysota
13th September 2008, 13:19
http://www.qtcentre.org/forum/faq.php?faq=qt_general_category#faq_qt_missing_ima ges