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. [solved]How to add a link to next page?
Forum Updated to NodeBB v4.3 + New Features

[solved]How to add a link to next page?

Scheduled Pinned Locked Moved General and Desktop
10 Posts 5 Posters 4.9k 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.
  • C Offline
    C Offline
    codeartist
    wrote on last edited by
    #1

    I am right now working on a project which has a login page. I wanted to make the "can't access" as a hyperlink look not a push button not anything else. Can anyone please help me?

     ************CODE-ARTIST************
    
    1 Reply Last reply
    0
    • L Offline
      L Offline
      leon.anavi
      wrote on last edited by
      #2

      Consider using "QTextBrowser":http://doc.qt.nokia.com/4.7/qtextbrowser.html as it inherits QTextEdit and provides a rich text browser with hypertext navigation.

      http://anavi.org/

      1 Reply Last reply
      0
      • C Offline
        C Offline
        codeartist
        wrote on last edited by
        #3

        Can you plz show me a example code. So that It could be a bit more clear :)

         ************CODE-ARTIST************
        
        1 Reply Last reply
        0
        • D Offline
          D Offline
          dangelog
          wrote on last edited by
          #4

          What's the "can't access" thing you're talking about?
          You can always add a QLabel with some rich text and catch the linkActivate signal.

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

          1 Reply Last reply
          0
          • C Offline
            C Offline
            codeartist
            wrote on last edited by
            #5

            I am doing a project. I had created a login page. Which has some fields like the following:

            @Username(QLabel) :(QTextEdit)
            Password(QLabel) :
            (QTextEdit)

            Login(QPushButton) Quit(QPushButton)

            Can't access my account(QPushButton)
            @
            Instead of making that "Can't access my account" a QPushButton, I want it to look like a hyperlink, when clicked on that area, It will go to Can't access page that I have created.

             ************CODE-ARTIST************
            
            1 Reply Last reply
            0
            • D Offline
              D Offline
              dangelog
              wrote on last edited by
              #6

              As I said:

              bq. You can always add a QLabel with some rich text and catch the linkActivate signal.

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

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

                I guess you want to make the button look just like a link.In that case, You can set "flat":http://doc.qt.nokia.com/latest/qpushbutton.html#flat-prop property using the method setFlat(bool);

                You can change the colour and give an underline,by setting the style sheet.

                EDIT : May be its a good idea to change the thread title ,something like "Appear a button as hyperlink" etc..


                Declaration of (Platform) independence.

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  andre
                  wrote on last edited by
                  #8

                  As peppe said:

                  @
                  //in constructor
                  QLabel* noAccessLabel = new QLabel(this);
                  //put the label in the appropriate layout

                  noAccessLabel->setText(tr("<html><a >I can't access my account</a></html>/"));

                  connect(noAccessLabel, SIGNAL(linkActivated(QString)), this, SLOT(forgotPasswordActivated(QString)));

                  /...

                  LoginForm::forgotPasswordActivated(const QString& url)
                  {
                  if (url == "app://forgotPassword") {
                  //do your magic here
                  }
                  }
                  @

                  Edit:
                  line 5 of the code should have a valid, nicely escaped URL in the < a > tag, but it seems the forum is messing that up (perhaps to prevent spam?)

                  1 Reply Last reply
                  0
                  • R Offline
                    R Offline
                    Rahul Das
                    wrote on last edited by
                    #9

                    @
                    noAccessLabel->setText(tr("<html>
                    <a href ='developer.qt.nokia.com/forums/viewthread/9196/'>I can't access my account</a> </html>"));
                    @


                    Declaration of (Platform) independence.

                    1 Reply Last reply
                    0
                    • C Offline
                      C Offline
                      codeartist
                      wrote on last edited by
                      #10

                      Thanks a lot to you all. It was a great help.. Truely very much thanks. :)

                       ************CODE-ARTIST************
                      
                      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