Results 1 to 10 of 10

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

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: QTextImageFormat HTML not write <img width= height>

    Quote Originally Posted by patrik08 View Post
    QTextImageFormat Edit_Image::GetFormat()
    {
    int swi = spinBox->value();
    int shi = spinBox_2->value();
    nowimage.setHeight(shi);
    nowimage.setWidth(swi);
    SavePicimage();
    return nowimage;
    }
    What are the values of swi and shi in this method?

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

    Default Re: QTextImageFormat HTML not write <img width= height>

    Quote Originally Posted by jacek View Post
    What are the values of swi and shi in this method?

    int swi = spinBox->value(); /* width spinbox & qsliderhorrizzonat */
    int shi = spinBox_2->value(); /* height spinbox & qsliderhorrizzonat */

    swi white in pixel int
    shi height in pixel int

    from qpixmap resize operation and QSize actual;

    on mainwindow ...

    Qt Code:
    1. QTextImageFormat newforminepic = Edit_Image::self( this )->GetFormat();
    2. if (newforminepic.isValid()) {
    3. nowimage = newforminepic;
    4. qDebug() << "### Draw image h ... " << nowimage.height();
    5. qDebug() << "### Draw image w... " << nowimage.width();
    To copy to clipboard, switch view to plain text mode 

    debug out console is correct value new value is valid ....but on tag is only <img src="path...">


    void QTextImageFormat::setHeight ( qreal height ) i put int not qreal and work ok...

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: QTextImageFormat HTML not write <img width= height>

    Quote Originally Posted by patrik08 View Post
    debug out console is correct value new value is valid ....but on tag is only <img src="path...">.
    Where do you actually use "nowimage" as the format for your image?

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

    Default Re: QTextImageFormat HTML not write <img width= height>

    Quote Originally Posted by jacek View Post
    Where do you actually use "nowimage" as the format for your image?

    QTextImageFormat nowimage;

    Contain all image data can extract and reinsert ....
    1 - NAME *** path
    2 - name from resource
    3 - can save height
    4 -weight

    + info from
    doc->addResource( QTextDocument::ImageResource, QUrl(filename), QPixmap(QString("%1%_%2").arg(registername).arg(im posi)) );

    on load html i RegExp

    QRegExp expression( "src=[\"\'](.*)[\"\']", Qt::CaseInsensitive );
    expression.setMinimal(true);

    all image list and download remote image to cache and local image go to cache ....
    why? i prepare all image to same dir to zip & upload after on remote cms dir ...
    and i must only replace cache dir with the remote dir path.....
    to edit or reedit i get the remote zip to cache image....

    How You chance wieth height attribute on img tag? all img to QRegExp

    Why #include "table_setting.h" run so clean and chance all table attribute? + cell row ecc...

    QTextTableFormat & QTextImageFormat have different Target .. to usage?

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: QTextImageFormat HTML not write <img width= height>

    Where do you change the format of an image that is already in the document? Because it seems that you never use the information stored in "nowimage".

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

    Default Re: QTextImageFormat HTML not write <img width= height>

    Quote Originally Posted by jacek View Post
    Where do you change the format of an image that is already in the document? "nowimage".
    Yes i reformat .... image inside qtextbrowser .... & not open other apps photoshop or so... the image must stay on html size ... and not waist time to other photoshop or gimp action...

    table i reformat so ... is run OK super....

    Qt Code:
    1. void Edit::TableSetting()
    2. {
    3. QTextCursor findercursor(wtext->textCursor());
    4. Etable = findercursor.currentTable();
    5. if (Etable) {
    6. Table_Setting::self( this )->SetFormat(nowtable);
    7. Table_Setting::self( this )->exec();
    8. QTextTableFormat newformine = Table_Setting::self( this )->GetNewFormats(); /* incomming other attribute by table .... from dialog */
    9. if (newformine.isValid()) {
    10. nowtable->setFormat(newformine); /* nowtable = QTextTable */
    11. }
    12. }
    13.  
    14. }
    To copy to clipboard, switch view to plain text mode 

    Image i reformat so .... and run image have new size small or bigger is ok.....

    &&& <img src="tanzbaer.gif" width="368" height="383" >
    only width="368" height not write .....

    If i put on tidy lib only alt can append..... ... i hope the problem or bug is solved on
    http://www.trolltech.com/developer/t...ntry&id=149069


    QTextTable -> setformat ( QTextTableFormat ) run ok....

    QTextImage -> setformat (QTextImageFormat ) class QTextImage not present on qt4.2 .
    && lastcursor.setCharFormat(newforminepic); run only 1/2


    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. /* QTextCursor lastcursor; ( last cursor from action ) */
    11. lastcursor.setCharFormat(newforminepic);
    12. qDebug() << "### Draw image h ... " << nowimage.height();
    13. qDebug() << "### Draw image w... " << nowimage.width();
    14. Reload_Editor(); /* repaint new size from image and go back to last QScrollBar *wysiwyg_sroll; int value setvalue(int)*/
    15. /* http://www.qtcentre.org/forum/f-qt-programming-2/t-loading-images-in-qtextbrowser-5046.html/?highlight=QTextImageFormat */
    16. }
    17. }
    18.  
    19. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by patrik08; 8th February 2007 at 02:05.

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

    Default Re: QTextImageFormat HTML not write <img width= height>

    Quote Originally Posted by jacek View Post
    What are the values of swi and shi in this method?
    on ubuntu linux is running but not the img tag and drag image in render other mime...???.
    on window if i drag a image from firefox to apps is work .+ html .. not on linux.... && img....

    ## 65KB
    wget http://ppk.ciz.ch/qt_c++/html_edit.tar.gz
    ## curl -O http://ppk.ciz.ch/qt_c++/html_edit.tar.gz
    tar -zxvf html_edit.tar.gz
    cd html_edit && qmake && make

    ## pro file app destdir is ./ not desktop...
    Last edited by patrik08; 7th February 2007 at 23:42.

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
  •  
Qt is a trademark of The Qt Company.