Results 1 to 10 of 10

Thread: QTextImageFormat HTML not write <img width= height>

Threaded View

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

    Default QTextImageFormat HTML not write <img width= height>

    I have build a small html editor (to append on a CMS - CRM ) that load automatic image remote or local in to local Cache
    and i enable drag in image or text/html text/plain and to edit all text attribute also table ...... but now i have problem on
    image attribute width="xxx" height="xxx" ..

    On Edit::RContext( const QPoint & pos ) (Contex menu) i grab QTextImageFormat from image i open Image_mod_Setting() on a
    dialog and i edit image large height and save image and i send back QTextImageFormat and my problem ....

    QTextImageFormat not write the new width="xxx" height="xxx" !!

    On QTextTableFormat runn all ok and set all attribute correct padding bgcolor spacing ecc... and QTextImageFormat no! why?







    Qt Code:
    1. void Edit::Image_mod_Setting()
    2. {
    3. /* QTextImageFormat nowimage; */
    4. if (nowimage.isValid()) {
    5. Edit_Image::self( this )->SetFormat(nowimage);
    6. Edit_Image::self( this )->exec();
    7. QTextImageFormat newforminepic = Edit_Image::self( this )->GetFormat();
    8. if (newforminepic.isValid()) {
    9. nowimage = newforminepic;
    10. qDebug() << "### Draw image h ... " << nowimage.height();
    11. qDebug() << "### Draw image w... " << nowimage.width();
    12. }
    13. }
    14.  
    15. }
    16.  
    17.  
    18.  
    19.  
    20.  
    21.  
    22. void Edit::RContext( const QPoint & pos )
    23. {
    24. ////////////////qDebug() << "### contextMenuEvent " << pos;
    25. Eframe = false;
    26. Eimage = false;
    27. Etable = false;
    28.  
    29. QTextCursor findercursor(wtext->textCursor());
    30. Eframe = findercursor.currentFrame();
    31. nowimage = findercursor.charFormat().toImageFormat();
    32. nowtable = findercursor.currentTable();
    33. Eimage = nowimage.isValid();
    34. Etable = findercursor.currentTable();
    35. qDebug() << "### Eframe " << Eframe;
    36. qDebug() << "### Eimage " << Eimage;
    37. qDebug() << "### Etable " << Etable;
    38. TContext = new QMenu(this);
    39. if (editrun) {
    40. TContext->addAction(tr( "View Modus" ), this , SLOT( ShowModusPanelView() ) );
    41. TtableContext = new QMenu(tr("Table edit or new "),TContext);
    42. TtableContext->addAction(tr( "Insert Table here" ), this , SLOT( CreateanewTable() ) );
    43. if (findercursor.currentTable()) {
    44. TtableContext->addAction(tr( "Table (this) Propriety BackgroundColor, Padding, Spacing" ), this , SLOT( TableSetting() ) );
    45. TtableContext->addAction(tr( "Merge selected cell (if select)" ), this , SLOT( MergeCellByCursorPosition() ) );
    46. TtableContext->addAction(tr( "Append Row on this table" ), this , SLOT( AppendTableRows() ) );
    47. TtableContext->addAction(tr( "Append Cools on this table" ), this , SLOT( AppendTableCools() ) );
    48. TtableContext->addAction(tr( "Remove this row" ), this , SLOT( RemoveRowByCursorPosition() ) );
    49. TtableContext->addAction(tr( "Remove this cool" ), this , SLOT( RemoveCoolByCursorPosition() ) );
    50. }
    51. TContext->addAction(TtableContext->menuAction());
    52. TimageContext = new QMenu(tr("Image edit or new "),TContext);
    53. TimageContext->addAction(tr( "Insert new image" ), this , SLOT( CreateanewImage() ) );
    54. if (Eimage) {
    55. QString picname = nowimage.name();
    56. QFileInfo locinfo(picname);
    57. TimageContext->addAction(tr( "Image edit \"%1\" width - height" ).arg(locinfo.fileName()), this , SLOT( Image_mod_Setting() ) );
    58. }
    59. TContext->addAction(TimageContext->menuAction());
    60. } else {
    61. TContext->addAction(tr( "Edit Modus" ), this , SLOT( ShowModusPanelEdit() ) );
    62. }
    63.  
    64.  
    65. /* ..cute past & source view ecc........ */
    To copy to clipboard, switch view to plain text mode 
    Last edited by jacek; 7th February 2007 at 13:41. Reason: reformatted to look better

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.