Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problem when inserting html
QtWS25 Last Chance

Problem when inserting html

Scheduled Pinned Locked Moved General and Desktop
15 Posts 5 Posters 4.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rleojoseph
    wrote on last edited by
    #1

    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..

    1 Reply Last reply
    0
    • A Offline
      A Offline
      alexander
      wrote on last edited by
      #2

      Where is here Qt?

      1 Reply Last reply
      0
      • R Offline
        R Offline
        rleojoseph
        wrote on last edited by
        #3

        Ya. In QT..

        1 Reply Last reply
        0
        • G Offline
          G Offline
          giesbert
          wrote on last edited by
          #4

          Where do you insert that?

          Nokia Certified Qt Specialist.
          Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

          1 Reply Last reply
          0
          • R Offline
            R Offline
            rleojoseph
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              shint
              wrote on last edited by
              #6

              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 );
              }
              @

              1 Reply Last reply
              0
              • R Offline
                R Offline
                rleojoseph
                wrote on last edited by
                #7

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

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  goetz
                  wrote on last edited by
                  #8

                  Shint, what are these O_O and T_T thingies?

                  http://www.catb.org/~esr/faqs/smart-questions.html

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    shint
                    wrote on last edited by
                    #9

                    //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]

                    1 Reply Last reply
                    0
                    • G Offline
                      G Offline
                      goetz
                      wrote on last edited by
                      #10

                      [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.

                      http://www.catb.org/~esr/faqs/smart-questions.html

                      1 Reply Last reply
                      0
                      • G Offline
                        G Offline
                        giesbert
                        wrote on last edited by
                        #11

                        [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...

                        Nokia Certified Qt Specialist.
                        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          shint
                          wrote on last edited by
                          #12

                          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!!

                          1 Reply Last reply
                          0
                          • G Offline
                            G Offline
                            goetz
                            wrote on last edited by
                            #13

                            [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 ;-)

                            http://www.catb.org/~esr/faqs/smart-questions.html

                            1 Reply Last reply
                            0
                            • S Offline
                              S Offline
                              shint
                              wrote on last edited by
                              #14

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

                              1 Reply Last reply
                              0
                              • R Offline
                                R Offline
                                rleojoseph
                                wrote on last edited by
                                #15

                                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]

                                1 Reply Last reply
                                0

                                • Login

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • Users
                                • Groups
                                • Search
                                • Get Qt Extensions
                                • Unsolved