Problem when inserting html



  • I got a Problem when i am trying to insert a html along with the image.

    <a href = ".... "><img src= "... "> </img> </a>

    The Problem is after inserting the Hyperlink!! Whatever the text am typing after that it is coming as a Hyperlink..



  • Where is here Qt?



  • Ya. In QT..



  • Where do you insert that?



  • See i have inserted it in the TextEdit, Inserting isn't a problem.
    But after inserting , the text which i am typing it is coming as an Hyperlink.
    Even i made sure whether the Tags are closed well, but still i got this problem.



  • O_O i tryed... same result??
    if you use. code change ('img src -> img src)

    @
    ui->textEdit->setHtml("<a href='http://www.google.com'>
    <'img src='d:\a.png'/>
    http://www.google.com</a>");
    @

    but. not click T_T;;;;
    maybe. need click event...

    @
    void MainWindow::on_label_linkActivated(QString link)
    {
    QString qs = "www.google.com";
    QDesktopServices::openUrl( qs );
    }
    @



  • I already have an click event too,not problem with events, there is something we need to do that makes the close the tags.



  • Shint, what are these O_O and T_T thingies?



  • //Volker. this emoticon? mean is......
    O_O ~~ happy
    T_T ~~ ashamed
    ;;;;;~~ through..... i think. so....
    do you like emoticon??

    //leojoseph.
    //i make. the style code. this code able to image link.
    @
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
    <html><head><meta name="qrichtext" content="1" /><style type="text/css">
    p, li { white-space: pre-wrap; }
    </style></head><body style=" font-family:'굴림'; font-size:9pt; font-weight:400; font-style:normal;">
    <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="www.google.com"><img src=":/prefix/a.png" /></a></p></body></html>
    @

    and.
    i used signal & solts

    @
    void MainWindow:: on_textEdit_selectionChanged()
    {
    QUrl url;
    url.setUrl( "www.google.com" );
    QDesktopServices:: openUrl( url );
    }
    @

    click. -> open browser.

    [EDIT: code formatting, please use @-tags, Volker]



  • [quote author="shint" date="1296560051"]//Volker. this emoticon? mean is......
    O_O ~~ happy
    T_T ~~ ashamed
    ;;;;;~~ through..... i think. so....
    do you like emoticon??
    [/quote]

    These are not well known. We use standard smiles like :) or :-/ or :( in this forum - you can happily use these, they even get some nice highlighting.

    Additionally, they may disturb the flow of reading a text. Please don't feel offended, but your english is not so good and hard to read anyways, adding some additional kind of "noise" does not make it easier to read.



  • [quote author="leojoseph" date="1296555469"]See i have inserted it in the TextEdit, Inserting isn't a problem.
    But after inserting , the text which i am typing it is coming as an Hyperlink.
    Even i made sure whether the Tags are closed well, but still i got this problem.[/quote]

    Did you try out, what happens if you do the following:

    @
    ui->textEdit->setHtml("my text before the link <a href='http://www.google.com'>
    d:\\\\a.png
    http://www.google.com</a> my text after the link");
    @

    and edit in the text before and after the link?
    Perhaps, if there is only the link, you edit inside the <a> tag...



  • oh. good man. volker.
    i understand. you very well understand me.
    i tryed use :) this emoticon.

    english is very hard :(....

    //Gerolf
    you're right.
    style code is... lost. after copy & paste...

    re paste now. (if you use. change code -> 'img src -> img src)
    @
    ui->textEdit->setHtml("<a href='http://www.google.com'>
    <'img src= 'd:\a.png'/>
    http://www.google.com</a>");
    @

    i much is not enough. fighting!!



  • [quote author="shint" date="1296562237"]oh. good man. volker.
    i understand. you very well understand me.
    i tryed use :) this emoticon.

    english is very hard :(....
    [/quote]

    No problem, you're welcome. And you never tried to learn German - you will never complain about English again ;-)



  • ok. i understand. :)
    have a nice day~~



  • Thanx for Replying.
    I have tried the way as you peolpz said , but it is not working :( .

    @
    QString abc("<a ><img ></img></a>").arg(file);

    Cursor.inserthtml(abc);
    @

    This s what the coding i used, "Whatever the txt am typing after insert , it is hyperlink"

    [EDIT: code formatting, Volker]


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.