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. Widget overlapping on a widget
Forum Updated to NodeBB v4.3 + New Features

Widget overlapping on a widget

Scheduled Pinned Locked Moved General and Desktop
17 Posts 3 Posters 6.4k 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.
  • raven-worxR Offline
    raven-worxR Offline
    raven-worx
    Moderators
    wrote on last edited by
    #8

    [quote author="tanmay2227" date="1383814041"]but how do i show the tooltip because a tooltip has a constructor of only string
    [/quote]
    a QToolTip is a special widget which only accepts strings. To simulate a tool-tip with a abitrary widget use the way i said.

    [quote author="tanmay2227" date="1383814041"]
    and if i use the show function it becomes a seperate window[/quote]
    like a tool-tip...

    --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
    If you have a question please use the forum so others can benefit from the solution in the future

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tanmay2227
      wrote on last edited by
      #9

      can you tell me the function used to call the widget as a tooltip because the ones i have tried are not working

      Tanmay Priyadarshi

      1 Reply Last reply
      0
      • raven-worxR Offline
        raven-worxR Offline
        raven-worx
        Moderators
        wrote on last edited by
        #10

        for the third time: QWidget::setWindowFlags(Qt::ToolTip)

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tanmay2227
          wrote on last edited by
          #11

          i understood what you are trying to say i have done that
          @customerList->setWindowFlags(Qt::ToolTip);
          // QWidget::setWindowFlags(Qt::ToolTip);@

          i have tried both these things but how to show it after this

          because i need it to appear when the cursor is on a particular widget

          Tanmay Priyadarshi

          1 Reply Last reply
          0
          • raven-worxR Offline
            raven-worxR Offline
            raven-worx
            Moderators
            wrote on last edited by
            #12

            just set the geometry and call show().
            Since you set the windowflags it becomes a top-level widget and thus has global coordinates.
            So maybe you want to do do something like this:
            @
            QPoint pos = errorMessageLabel->mapToGlobal(QPoint(0,0));
            //listView->setWindowFlags(Qt::ToolTip);
            listView->move( pos );
            listView->show();
            @

            --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
            If you have a question please use the forum so others can benefit from the solution in the future

            1 Reply Last reply
            0
            • T Offline
              T Offline
              tanmay2227
              wrote on last edited by
              #13

              i did that too but that is also not working . it shows up at the top left hand corner and also it stays even when i click elsewhere on the screen and even when i close the window it doesnt disappear .
              it is like a separate entity altogether

              Tanmay Priyadarshi

              1 Reply Last reply
              0
              • raven-worxR Offline
                raven-worxR Offline
                raven-worx
                Moderators
                wrote on last edited by
                #14

                i feel like i have to repeat myself a few times:
                [quote author="raven-worx" date="1383730620"]
                If you want to behave it like a QMenu you can set Qt::Popup, so it gets closed automatically when it loses focus or the mouse is pressed outside of the widget.

                Play around which of the 3 flags you want to use.[/quote]

                --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                If you have a question please use the forum so others can benefit from the solution in the future

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  tanmay2227
                  wrote on last edited by
                  #15

                  i am sorry that you have to repeat yourself but perhaps you misunderstood me
                  i have tried with both the flags i have played around with them but both of them are producing problems .

                  the main problem is occuring not because of whether i am using popup or tooltip but whether i am adding the list to the layout or not.

                  if i add the list to the layout and hide it and then on the event call for a show then it behaves like a normal widget and pushes the other widgets away and doesnt overlap them

                  and if i do not add it , be it popup or tooltip it is not losing focus from it

                  Tanmay Priyadarshi

                  1 Reply Last reply
                  0
                  • T3STYT Offline
                    T3STYT Offline
                    T3STY
                    wrote on last edited by
                    #16

                    quote author="tanmay2227" date="1383826314" but whether i am adding the list to the layout or not. (...)[/quote]

                    I think that you're using a QLayout to show some widgets and when you enter one of these you want a tooltip to appear.
                    If the tooltip widget (whatever type of widget you're using) is simply added to the QLayout, it would be displayed along the other widgets inside the QLayout grid - this forces the QLayout to reisze the grid to accommodate the new widget, so it moves and resizes existing widgets which is what you're desperately trying to avoid.
                    Solution: use a widget from the ones added to the QLayout as a parent of the tooltip widget you're displaying.

                    Now, don't get me wrong but raven has repeated himself because the question wasn't explained in its context. Next time try to explain you're using a QLayout or other widgets and even a little piece of code (even example if you don't want to share your source code) can be of help to determine your problem and solution :)

                    1 Reply Last reply
                    0
                    • T Offline
                      T Offline
                      tanmay2227
                      wrote on last edited by
                      #17

                      thank you and sorry for the misunderstanding

                      Tanmay Priyadarshi

                      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