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
    #2

    @
    listWidget->setWindowFlags( Qt::Tool ); //or Qt::ToolTip
    @

    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.

    --- 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
      #3

      the popup thing is not working the list that pops up renders the remaining window useless . i just want it to display the message and move back.

      what i want is actually a type of an error log that displays only the latest message normally but whenever when i place my cursor on it it displays the whole list . but it should be displayed on top of the screen and not move the rest of the widgets

      Tanmay Priyadarshi

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

        something like a tool-tip then?

        --- 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
          #5

          yes but position over the calling widget
          can you tell me how to pass a list as a tool tip

          Tanmay Priyadarshi

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

            ok i think now i got you.

            You can use a QLabel (or any other appropriate widget you like) to display the last error message. Then on any desired action you can display the list widget over the label. To do so you can use 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
              #7

              but how do i show the tooltip because a tooltip has a constructor of only string
              and if i use the show function it becomes a seperate window

              Tanmay Priyadarshi

              1 Reply Last reply
              0
              • 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