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. Click URL
Forum Updated to NodeBB v4.3 + New Features

Click URL

Scheduled Pinned Locked Moved General and Desktop
15 Posts 5 Posters 43.0k Views 1 Watching
  • 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 18 Jan 2011, 11:55 last edited by
    #1

    Hi, I was trying to click URL in the QTextEdit. But it is not possible, i.e no signals can be emitted when we try to click the URL. But it is possible in the TextBrowser.

    Is there any breakthrough for this ? Like subclass a Widget or can i* inherit some properties or MouseEvents* of other widget into the TextEdit.??

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on 18 Jan 2011, 15:24 last edited by
      #2

      This functionality is added by QTextBrowser, which inherits QTextEdit. I guess you are after an editor where you can edit the text as well as use hyperlinks?

      You can extend QTextBrowser to support hyperlinks. You just have to implement the handling yourself. However, QTextBrowser has some methods to help you with that. Look at anchorAt(), for instance. If you handle the mouseClick event, you can use this method to see if there is an anchor under at the position you're at. If so, you can use that anchor.

      I am not sure it would be possible to submit QTextBrowser into being editable again.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dangelog
        wrote on 18 Jan 2011, 15:50 last edited by
        #3

        Yep. Subclass, take the cursor at the mouse click position (QTextEdit::cursorForPosition), take the fragment and activate the link. See also QTextControlPrivate::activateLinkUnderCursor.

        (Of course, you may choose to just use those private classes, with all the pros and cons.)

        Software Engineer
        KDAB (UK) Ltd., a KDAB Group company

        1 Reply Last reply
        0
        • R Offline
          R Offline
          rleojoseph
          wrote on 19 Jan 2011, 06:22 last edited by
          #4

          Subclass might be the optimum solution, but i haven't done it before. Like inheriting some properties of another class into existing one. Can you help me out??
          QTextCursor cursor = ui->textEdit->textCursor();
          Link is a String which is got by Dialog
          cursor.insertHtml(link);

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on 19 Jan 2011, 06:27 last edited by
            #5

            Subclassing is a basic element of the C++ language (and most (all?) object oriented languages for that matter). Qt is not going to free you from learning the language you write your code in. Perhaps you should pick up a beginners C++ book and start at the basics.

            1 Reply Last reply
            0
            • R Offline
              R Offline
              rleojoseph
              wrote on 25 Jan 2011, 11:15 last edited by
              #6

              Hi, i have made subclass of QTextEdit and its working too.
              But when i try to subclass the QTextEdit along with the Mainwindow and Myclass , i am getting some problem. i dont know how to implement it .
              Give me some lead.

              1 Reply Last reply
              0
              • G Offline
                G Offline
                giesbert
                wrote on 25 Jan 2011, 11:26 last edited by
                #7

                Your question is not realy clear to me. What exactly do you try and what goes wrong?

                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
                • G Offline
                  G Offline
                  goetz
                  wrote on 25 Jan 2011, 11:31 last edited by
                  #8

                  [quote author="leojoseph" date="1295954145"]Hi, i have made subclass of QTextEdit and its working too.
                  But when i try to subclass the QTextEdit along with the Mainwindow and Myclass , i am getting some problem. i dont know how to implement it .
                  Give me some lead.[/quote]

                  The crystal ball is on hiatus today, sorry. So, we're in dumb mode now and unfortunately unable to guess what you meant.

                  If you have a problem, you surely are able to explain to others what it is, so that they can understand it. If not, you have an even bigger problem, but that cannot be solved by the community.

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

                  1 Reply Last reply
                  0
                  • R Offline
                    R Offline
                    rleojoseph
                    wrote on 25 Jan 2011, 11:33 last edited by
                    #9

                    Previously i had created QTextEdit class and made use of that in Myclass.

                    Now I want to know how to subclass QTextEdit,QMouseEvent along with the QMainWindow and Myclass.

                    Eg: class Myclass:public QMainWindow,QTextEdit like that,

                    Note(Mouse Event in TextEdit)

                    1 Reply Last reply
                    0
                    • G Offline
                      G Offline
                      goetz
                      wrote on 25 Jan 2011, 12:15 last edited by
                      #10

                      Sorry, I'm lost.

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

                      1 Reply Last reply
                      0
                      • G Offline
                        G Offline
                        giesbert
                        wrote on 25 Jan 2011, 12:17 last edited by
                        #11

                        Me too...
                        you want to make a widget which is a cmobination of mainwindow and textedit?
                        why noz just make a myclass and put a myedit as child.
                        myedit would be derived from textedit?

                        Is it that what you want?

                        Sorry, I'm just guessing....

                        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 27 Jan 2011, 07:21 last edited by
                          #12

                          Ya almost like that. Let me Clear.

                          See,I have already created a class name Random which inherits QTextEdit.
                          Now i have to use the Random class to Myclass, where Myclass already contains QMainWindow.

                          In Brief: The Myclass project contains a textEdit widget and a PushButton, i need to invoke a mouse event in the textEdit widget. So i created a Random Class which inherits the QTextEdit. If i make use of the Random Class in the Myclass , i can make my Req done.

                          1 Reply Last reply
                          0
                          • G Offline
                            G Offline
                            giesbert
                            wrote on 27 Jan 2011, 07:48 last edited by
                            #13

                            Sorry, now you lost me too....

                            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 27 Jan 2011, 07:51 last edited by
                              #14

                              Oh!! Its Just Like implementing the Custom Widgets!!

                              I have created the class and its functions, all i need to do is integrate the two classes.

                              1 Reply Last reply
                              0
                              • R Offline
                                R Offline
                                rleojoseph
                                wrote on 28 Jan 2011, 07:20 last edited by
                                #15

                                No Probs!!

                                Why always the Hyperlink click is working in QT(QTextEdit) but the URL is not working!!

                                If i type www.mail.google.com , its not working.

                                But if i type http://mail.google.com is working!!

                                Do you know why ??
                                And is there any breakthrough for this?

                                1 Reply Last reply
                                0

                                1/15

                                18 Jan 2011, 11:55

                                • Login

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