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. Setting widget "hitbox"
Forum Updated to NodeBB v4.3 + New Features

Setting widget "hitbox"

Scheduled Pinned Locked Moved Solved General and Desktop
11 Posts 3 Posters 1.0k 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.
  • S Offline
    S Offline
    SGaist
    Lifetime Qt Champion
    wrote on 30 Jun 2020, 18:32 last edited by
    #2

    Hi,

    Just to be sure we are on the same line, what would you use that hitbox for ?

    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
    • P Offline
      P Offline
      Pylvain
      wrote on 30 Jun 2020, 18:42 last edited by
      #3

      For registering a clicked event for example, or a mouse hover

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 30 Jun 2020, 18:46 last edited by
        #4

        Then that's something you have to do yourself.

        See the setAcceptHoverEvents, you'll have the related methods linked there that you may have to overload in order to do what you want.

        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
        • P Offline
          P Offline
          Pylvain
          wrote on 30 Jun 2020, 18:52 last edited by
          #5

          Would it be better to simply "glue" some rectangulars widgets together, connecting directly the signals of the small widgets to the signals of the bigger one ?

          M 1 Reply Last reply 30 Jun 2020, 19:01
          0
          • P Pylvain
            30 Jun 2020, 18:52

            Would it be better to simply "glue" some rectangulars widgets together, connecting directly the signals of the small widgets to the signals of the bigger one ?

            M Offline
            M Offline
            mrjj
            Lifetime Qt Champion
            wrote on 30 Jun 2020, 19:01 last edited by
            #6

            @Pylvain
            Hi
            I get slightly confused when you say widget and QGraphicScene.
            Do you have "real" widgets via QGraphicsProxyWidget
            or do you mean the normal items like QGraphicsItem ?

            1 Reply Last reply
            0
            • P Offline
              P Offline
              Pylvain
              wrote on 30 Jun 2020, 19:10 last edited by
              #7

              @mrjj Sorry, I mean Items, i'm not very familiar with the QGraphics* classes. That's just some pixmaps in want to display.

              M 1 Reply Last reply 30 Jun 2020, 19:18
              0
              • P Pylvain
                30 Jun 2020, 19:10

                @mrjj Sorry, I mean Items, i'm not very familiar with the QGraphics* classes. That's just some pixmaps in want to display.

                M Offline
                M Offline
                mrjj
                Lifetime Qt Champion
                wrote on 30 Jun 2020, 19:18 last edited by
                #8

                @Pylvain
                Hi
                thats super fine.
                I just wanted to be sure you didnt use actual std widgets as that's also possible.

                If the goal is to have some images with some shapes
                and you want to only be able to click inside the actual visual shape,
                i think you can use
                https://doc.qt.io/qt-5/qgraphicsitem.html#shape
                for that. But you would have to create a QPainterPath that follows the visual image so to speak.

                1 Reply Last reply
                0
                • P Offline
                  P Offline
                  Pylvain
                  wrote on 30 Jun 2020, 19:39 last edited by
                  #9

                  @mrjj i saw that article, but i did'nt find anything useful. That can detect colisions, but nothing related with events. The more i think of it, the more i think it's best to use rectangular units glued together. It's simpler optimisationwise, and connecting signals to signals seems very elegant to me.

                  M 1 Reply Last reply 30 Jun 2020, 19:43
                  0
                  • P Pylvain
                    30 Jun 2020, 19:39

                    @mrjj i saw that article, but i did'nt find anything useful. That can detect colisions, but nothing related with events. The more i think of it, the more i think it's best to use rectangular units glued together. It's simpler optimisationwise, and connecting signals to signals seems very elegant to me.

                    M Offline
                    M Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on 30 Jun 2020, 19:43 last edited by
                    #10

                    @Pylvain
                    Its also used for hit testing.
                    That said if you can get the effect you want using rectangles, that should also work fine.

                    1 Reply Last reply
                    0
                    • P Offline
                      P Offline
                      Pylvain
                      wrote on 30 Jun 2020, 19:53 last edited by
                      #11

                      I will use rectangular items glued together ! Thank you very much for your help !

                      1 Reply Last reply
                      1

                      11/11

                      30 Jun 2020, 19:53

                      • Login

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