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. What may be the error in the following function?
Forum Updated to NodeBB v4.3 + New Features

What may be the error in the following function?

Scheduled Pinned Locked Moved General and Desktop
8 Posts 3 Posters 3.5k 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.
  • P Offline
    P Offline
    pratik041
    wrote on last edited by
    #1

    @void of_tooltip::enterEvent (QEvent *e)
    {

    QToolTip::showText (this->pos ()+QPoint(70,80), "text",this,QRect(0,0,50,50));
    
    
    QPushButton::enterEvent (e);
    

    }
    @
    Here i want to display tooltip when mouse enter the provided rect(0,0,50,50) area of button but the problem i am getting here is when mouse enter the area of button which are not under rect the tooltip is displaying and suddenly hiding.Actually in this area which are not under rect the tooltip should not be display then why it is showing and hiding?

    Pratik Agrawal

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Can't you use the standard toolTip for QPushButton?

      From QToolTip documentation:
      [quote]Shows text as a tool tip, with the global position pos as the point of interest. The tool tip will be shown with a platform specific offset from this point of interest.
      If you specify a non-empty rect the tip will be hidden as soon as you move your cursor out of this area.
      The rect is in the coordinates of the widget you specify with w. If the rect is not empty you must specify a widget. Otherwise this argument can be 0 but it is used to determine the appropriate screen on multi-head systems.[/quote]

      I guess you might be assuming different coordinates than this function. The first argument is in global coordinate system, the other one in local. Maybe that's the problem here?

      (Z(:^

      1 Reply Last reply
      0
      • P Offline
        P Offline
        pratik041
        wrote on last edited by
        #3

        what coordinate i should set. can you give any small example.

        Pratik Agrawal

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          I'd say you could experiment to verify which points point where.

          For a start, try calling:
          @
          QToolTip::showText (this->pos() + QPoint(70, 80), "text", this);
          @

          Which is the same statement, but without the QRect. You could also test some changes to "QPoint" part.

          (Z(:^

          1 Reply Last reply
          0
          • P Offline
            P Offline
            pratik041
            wrote on last edited by
            #5

            I have checked it but not able to find what is the mistake.

            Pratik Agrawal

            1 Reply Last reply
            0
            • sierdzioS Offline
              sierdzioS Offline
              sierdzio
              Moderators
              wrote on last edited by
              #6

              There's not much more I can think of here, sorry. I've never used this function myself.

              (Z(:^

              1 Reply Last reply
              0
              • P Offline
                P Offline
                pratik041
                wrote on last edited by
                #7

                ok no problem i will try to explore more on that.

                Pratik Agrawal

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

                  You're always displaying the tool tip on entering the widgets area, regardless whether the mouse cursor is in the hot spot or not. So check for the correct position before displaying the tool tip at all.

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

                  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