Important: Please read the Qt Code of Conduct -

[SOLVED] change the pen of a QGraphicsItemGroup

  • hello,

    i have QGraphicsItemGroup used to store a group of QGraphicsLineItem ,
    i want to change the pen of QGraphicsLineItem childs but the QGraphicsItemGroup does not have a such mlethod , so i did a cast from QGraphicsItemGroup to QGraphicsLineItem but the program has stopped !!

  • Hi,

    the solution could be one of the following:

    • Iterate over the list returned by childItems(), then check if the item is a QGraphicsLineItem and set Pen to it
    • Create a class derived by QGraphicsLineItem and implement a method doing the above job