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"

Setting widget "hitbox"

Scheduled Pinned Locked Moved Solved General and Desktop
11 Posts 3 Posters 1.0k Views
  • 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on 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 last edited by
      #3

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

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on 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 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 ?

          mrjjM 1 Reply Last reply
          0
          • P Pylvain

            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 ?

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on 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 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.

              mrjjM 1 Reply Last reply
              0
              • P Pylvain

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

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on 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 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.

                  mrjjM 1 Reply Last reply
                  0
                  • P Pylvain

                    @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.

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on 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 last edited by
                      #11

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

                      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