Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. How to link label with push Button
Forum Updated to NodeBB v4.3 + New Features

How to link label with push Button

Scheduled Pinned Locked Moved Qt Creator and other tools
7 Posts 4 Posters 2.7k 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.
  • D Offline
    D Offline
    Debjani
    wrote on last edited by
    #1

    Hi i am new to Qt and my question is i want to link my label with push button. For example: i have taken a label and set an image on it,now i want that when i click on the label my push button should get enable and before that it should be disable.
    And also i want to make my label clickable.
    please anybody help me out with this with a proper example so that it will be easier for me to understand.
    Thank You in advance.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      clochydd
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      I suggest to use a flat pushButton instead of label + button.
      It's the easiest way and you may work with icons as well.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        Debjani
        wrote on last edited by
        #3

        Thank you for your reply. But in my project i require to use label and have to make it clickable.

        1 Reply Last reply
        0
        • p3c0P Offline
          p3c0P Offline
          p3c0
          Moderators
          wrote on last edited by
          #4

          Hi,

          There are 2 ways for making it clickable:

          1. If you have subclassed the QLabel, override "mouseReleaseEvent":http://qt-project.org/doc/qt-5/qwidget.html#mouseReleaseEvent of your Label.

          2. If not subclassed then use "eventFilter":http://qt-project.org/doc/qt-4.8/qobject.html#eventFilter method.

          157

          1 Reply Last reply
          0
          • IamSumitI Offline
            IamSumitI Offline
            IamSumit
            wrote on last edited by
            #5

            OK so you want to make your label clickable..

            see
            https://qt-project.org/wiki/Make-a-QLabel-Clickable

            hope it helps !!

            Be Cute

            1 Reply Last reply
            0
            • D Offline
              D Offline
              Debjani
              wrote on last edited by
              #6

              Thanks to Every One.

              1 Reply Last reply
              0
              • IamSumitI Offline
                IamSumitI Offline
                IamSumit
                wrote on last edited by
                #7

                Hello Debjani..
                If you did it successfully then update this thread as SOLVED before the title.
                Thanks.

                Be Cute

                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