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. [SOLVED] QGraphicsItem::ItemSelectedChange or QGraphicsItem::ItemSelectedHasChanged?

[SOLVED] QGraphicsItem::ItemSelectedChange or QGraphicsItem::ItemSelectedHasChanged?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.0k 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.
  • I Offline
    I Offline
    isaacEnrique
    wrote on last edited by
    #1

    Greetings.

    I'm reimplementing the virtual function QGraphicsItem::ItemChange() to make my custom QGraphicsItem (QGraphicsItem subclass), change its color when the item is selected and/or released.

    My question is with which value of the enumerated type GraphicsItemChange, I must compare the parameter "change": QGraphicsItem::ItemSelectedChange or QGraphicsItem::ItemSelectedHasChanged?

    Thanks in advance for any help and/or suggestions.

    Isaac Pérez
    Programming is understanding.

    1 Reply Last reply
    0
    • Chris KawaC Online
      Chris KawaC Online
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Note the "Has" word in the enums. These two enums are sorta "I'm about to be changed" and "I've been changed just now".

      Which one you use is up to you but I don't think in this particular case (color change) it matters. Both will do. Conceptually you would change the color after the change has occurred to avoid having two items have that color at the same time, but I don't think this would be noticeable for such a brief moment.

      1 Reply Last reply
      0
      • I Offline
        I Offline
        isaacEnrique
        wrote on last edited by
        #3

        Thanks, I had tried both options and both options worked well, but was not sure which was the right choice. Here QGraphicsItem::ItemSelectedHasChanged

        Isaac Pérez
        Programming is understanding.

        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