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. Using text label as pushbutton
Forum Updated to NodeBB v4.3 + New Features

Using text label as pushbutton

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 4 Posters 1.4k Views 2 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.
  • ronyNSR Offline
    ronyNSR Offline
    ronyNS
    wrote on last edited by
    #1

    How to use text label as pushbutton.
    i just want to use the text that can be clicked.
    Thanks.

    John_38J 1 Reply Last reply
    0
    • ronyNSR ronyNS

      How to use text label as pushbutton.
      i just want to use the text that can be clicked.
      Thanks.

      John_38J Offline
      John_38J Offline
      John_38
      wrote on last edited by John_38
      #2
      This post is deleted!
      1 Reply Last reply
      0
      • Andy314A Offline
        Andy314A Offline
        Andy314
        wrote on last edited by Andy314
        #3

        The QWidget base is not overfilled with signals compared with other widget-tool (.net VCL). I missed that feature too. You can install a eventfilter to catch all events, but this is no a comfortable reusable way.

        I have made my own Widgets by subclassing of nearly all standard QWidgets to enhance its features. In a QLabel subclass you can overwrite the mousePressEvent and the mouseReleaseEvent an make you own signals. Here example code

        //=======================================================================
        void AdvLabel::mouseReleaseEvent(QMouseEvent * event)
        //=======================================================================
        {
            if (!this->rect().contains(event->pos()))
            {
                QLabel::mouseReleaseEvent(event);
                return;
            }
            switch(event->button())
            {
                case Qt::LeftButton:   emit clicked(); break;
                case Qt::RightButton:  emit clickedRight(); break;
            }
            QLabel::mouseReleaseEvent(event);
         }
        
        
        1 Reply Last reply
        1
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          Do you want to be able to click on it like a link or do you want a real button ? If the later, why not use a button ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          ronyNSR 1 Reply Last reply
          0
          • SGaistS SGaist

            Hi,

            Do you want to be able to click on it like a link or do you want a real button ? If the later, why not use a button ?

            ronyNSR Offline
            ronyNSR Offline
            ronyNS
            wrote on last edited by
            #5

            @SGaist
            I want to click on the text like a link .

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Something like provided by the openExternalLinks property ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1

              • Login

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