Results 1 to 5 of 5

Thread: QTextEdit

  1. #1
    Join Date
    Sep 2008
    Posts
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QTextEdit

    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?

  2. #2
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTextEdit

    Quote Originally Posted by ocean View Post
    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..


    Qt Code:
    1. static QString ImageFilterHaving() const
    2. {
    3. QString filter;
    4. filter = tr( "All supported Types" ) + " (";
    5. QList<QByteArray> formats = QImageReader::supportedImageFormats();
    6. for ( int x = 0; x < formats.count(); ++x ) {
    7.  
    8. filter += QString( "*.%1" ).arg( QString( formats[ x ] ) );
    9. if ( x != formats.count() - 1 )
    10. filter += " ";
    11. }
    12. filter += ");;";
    13. QString filterSimple;
    14. double gsversion = 0; ///////getGSVersion();
    15. //////qDebug() << "### args " << gsversion;
    16. filterSimple += tr( "Scalable Vector Graphics" ) + " (*.svg *.svg.gz);;";
    17. if (gsversion > 6.5) {
    18. filterSimple += tr( "PostScript Vector Graphics" ) + " (*.ps *.eps);;";
    19. filterSimple += tr( "PDF Page units" ) + " (*.pdf);;";
    20. }
    21.  
    22. filterSimple += tr( "QPicture qt4.1 > " ) + " (*.pic);;";
    23.  
    24. for ( int y = 0; y < formats.count(); ++y ) {
    25.  
    26. QString form( formats[ y ] );
    27. if ( form == "bmp" )
    28. filterSimple += tr( "Windows Bitmap" ) + " (*.bmp)";
    29. else if ( form == "gif" )
    30. filterSimple += tr( "Graphic Interchange Format" ) + " (*.gif)";
    31. else if ( form == "jpeg" || form == "jpg" ) {
    32.  
    33. if ( !filterSimple.contains( form ) )
    34. filterSimple += tr( "Joint Photographic Experts Group" ) + " (*.jpeg *.jpg)";
    35. } else if ( form == "mng" )
    36. filterSimple += tr( "Multiple-image Network Graphics" ) + " (*.mng)";
    37. else if ( form == "png" )
    38. filterSimple += tr( "Portable Network Graphics" ) + " (*.png)";
    39. else if ( form == "pbm" || form == "ppm" ) {
    40.  
    41. if ( !filterSimple.contains( form ) )
    42. filterSimple += tr( "Portable Bitmap" ) + " (*.pbm *.ppm)";
    43. } else if ( form == "pgm" )
    44. filterSimple += tr( "Portable Graymap" ) + " (*.pgm)";
    45. else if ( form == "xbm" || form == "xpm" ) {
    46.  
    47. if ( !filterSimple.contains( form ) )
    48. filterSimple += tr( "X11 Bitmap" ) + " (*.xbm *.xpm)";
    49. } else if ( form == "ico" )
    50. filterSimple += tr( "Icon Image File Format" ) + " (*.ico)";
    51. else if ( form == "jp2" || form == "j2k" ) {
    52.  
    53. if ( !filterSimple.contains( form ) )
    54. filterSimple += tr( "JPEG 2000" ) + " (*.jp2 *.j2k)";
    55. } else if ( form == "tif" || form == "tiff" ) {
    56.  
    57. if ( !filterSimple.contains( form ) )
    58. filterSimple += tr( "Tagged Image File Format" ) + " (*.tif *.tiff)";
    59. } else
    60. filterSimple += tr( "Unknown Format" ) + QString( " (*.%1)" ).arg( form );
    61.  
    62. if ( y != formats.count() - 1 && !filterSimple.endsWith( ";;" ) )
    63. filterSimple += ";;";
    64. }
    65. filterSimple = filterSimple.left( filterSimple.length() - 2 );
    66. filter += filterSimple;
    67. return filter;
    68. }
    69.  
    70. QString file = QFileDialog::getOpenFileName(0, tr( "Choose Image to insert..." ), "" , ImageFilterHaving() );
    71.  
    72. if ( file.isEmpty() ) {
    73. return;
    74. }
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Sep 2008
    Posts
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTextEdit

    Yeah, this code was really useful. Thank you.
    Last edited by ocean; 13th September 2008 at 09:58.

  4. #4
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTextEdit

    Quote Originally Posted by ocean View Post
    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.d...ng_gif2swf.htm
    http://www.qt-apps.org/content/show....?content=81573
    http://www.qt-apps.org/content/show....?content=82221

    or ...

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

    Qt Code:
    1. Source: "D:\_INSTALLER_qt4.0\imageformats\*"; \
    2. DestDir: "{app}/imageformats/"; Flags: ignoreversion recursesubdirs createallsubdirs
    3. Source: "D:\_INSTALLER_qt4.0\locale\*"; DestDir: "{app}/locale/"; \
    4. Flags: ignoreversion recursesubdirs createallsubdirs
    5. ; NOTE: Don't use "Flags: ignoreversion" on any shared system files
    To copy to clipboard, switch view to plain text mode 

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

Similar Threads

  1. QTextEdit Performance handling large paragraphs
    By netuno in forum Qt Programming
    Replies: 14
    Last Post: 1st September 2010, 22:58
  2. QTextEdit and cursor
    By newplayer in forum Qt Programming
    Replies: 1
    Last Post: 30th July 2008, 23:24
  3. QTextEdit slow to insert text
    By thomaspu in forum Qt Programming
    Replies: 4
    Last Post: 10th January 2008, 12:05
  4. QTextEdit API questions (plain text)
    By Gaspar in forum Qt Programming
    Replies: 4
    Last Post: 16th May 2006, 06:03
  5. Obtaining clean (x)html from QTextEdit
    By ccf_h in forum Qt Programming
    Replies: 1
    Last Post: 5th February 2006, 14:47

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.