Get the brush color of objects in QgraphicsViews (For Squish testing)



  • Hi I have QTreeView and QGraphisview. From QtreeView I send a notification to QGrapphicsView and called setBrush to fill the colors in the selected items in QGraphicsView .

    For squish testing I want to get the color of Selected objects in in QgraphicsView

    Can someone guide for this



  • I'm not sure I understand what you are doing... Do you use your own graphics items or standard graphics items (e.g. QGraphicsRectItem)? How exactly you filling items in QGraphicsView?


  • Moderators

    @Qt-Enthusiast said:

    For squish testing I want to get the color of Selected objects in in QgraphicsView

    i haven't used Squish for a while now so i am not much of a help here. But IIRC Squish hooks into the application and accessing the object directly in the memory space.
    So i am afraid you will only see what Froglogic wants you to see in the test suite.

    But isn't there also python scripting available? Maybe this way you can access more properties?

    Anyway Froglogic most probably can answer you this question the best.



  • class Myitem : public QGraphicsItem
    {
    }

    foreach (QGraphicsItem* item, scene()->selectedItems()) {
    if (MyItem* pItem = static_cast<MyItem*>(item)) {
    pItem->setBrushStyle(Qt::SolidPattern, true);
    pItem->setBrushColor(color);
    }
    }
    Please see how I am coloring the items


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.