Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt GraphicsItem Resize handlers
Qt 6.12 LTS is out! See what's new in the release blog

Qt GraphicsItem Resize handlers

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 712 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.
  • C Offline
    C Offline
    chedoska
    wrote on last edited by chedoska
    #1

    Hi, this my first post here :)
    I am not expirienced programmer and I would like to make something like when I click on my custom graphic object it becomes selected and the resize handlers appears around the item i know how to do the resizing and all the hard stuff but i dont know how to send information to my resizer object (which contains the pointer to my custom item) that my custom item has been clicked and the handlers should appear. I dont want to use slots and signals because I want to have many (like 100+) objects.

    I know that i can override mouseevent in my customitem but how to pass the info about being clicked to resizehandlers

    MyCustomItem *item = new MyCustomItem(parent);
        scene->addItem(item);
        ResizerItem *reItem = new ResizerItem(item); 
        scene->addItem(reItem);
    
    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi, welcome to the forum.

      You can make the item selectable by setting the QGraphicsItem::ItemIsSelectable flag on it.

      As for signals/slots - you do need to use them, but not on individual items. You can connect to the selectionChanged() signal of the scene, and in the slot handling that you will get currently selected items with scene's selectedItems() method.

      As for passing the mouse events - you don't need to do that. The resize handles can be separate items that get mouse events, so you don't need to pass them from the selected item.

      C 1 Reply Last reply
      3
      • Chris KawaC Chris Kawa

        Hi, welcome to the forum.

        You can make the item selectable by setting the QGraphicsItem::ItemIsSelectable flag on it.

        As for signals/slots - you do need to use them, but not on individual items. You can connect to the selectionChanged() signal of the scene, and in the slot handling that you will get currently selected items with scene's selectedItems() method.

        As for passing the mouse events - you don't need to do that. The resize handles can be separate items that get mouse events, so you don't need to pass them from the selected item.

        C Offline
        C Offline
        chedoska
        wrote on last edited by chedoska
        #3

        @Chris-Kawa Okay, Thank you very much for fast answer I think that I know how to do it now

        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
        • Unsolved