src/hbcore/primitives/hbtoucharea.cpp
changeset 5 627c4a0fd0e7
parent 1 f7ac710697a9
child 7 923ff622b8b9
equal deleted inserted replaced
3:11d3954df52a 5:627c4a0fd0e7
    60     HbTouchAreaPrivate::outlinesEnabled = enabled;
    60     HbTouchAreaPrivate::outlinesEnabled = enabled;
    61 
    61 
    62     // Because this method is static we need to toggle QGraphicsItem::ItemHasNoContents flag 
    62     // Because this method is static we need to toggle QGraphicsItem::ItemHasNoContents flag 
    63     // value hard way. This is RnD feature anyway.
    63     // value hard way. This is RnD feature anyway.
    64     foreach (HbMainWindow *window, hbInstance->allMainWindows()) {
    64     foreach (HbMainWindow *window, hbInstance->allMainWindows()) {
    65         QGraphicsScene *scene = static_cast<QGraphicsScene*>(window->scene());
    65         QGraphicsScene *scene = static_cast<QGraphicsScene*>(window->scene()); //krazy:exclude=qclasses
    66         foreach( QGraphicsItem *item, scene->items() ) {
    66         foreach( QGraphicsItem *item, scene->items() ) {
    67             if (HbTouchArea *widget = qgraphicsitem_cast<HbTouchArea *>(item)) {
    67             if (HbTouchArea *widget = qgraphicsitem_cast<HbTouchArea *>(item)) {
    68                 widget->setFlag(QGraphicsItem::ItemHasNoContents, !enabled);
    68                 widget->setFlag(QGraphicsItem::ItemHasNoContents, !enabled);
    69             }
    69             }
    70         }
    70         }
   130     HbWidgetBase::paint(painter, option, widget);
   130     HbWidgetBase::paint(painter, option, widget);
   131 
   131 
   132     // The paint method is called only if HbTouchAreaPrivate::outlinesEnabled is true (RnD feature)
   132     // The paint method is called only if HbTouchAreaPrivate::outlinesEnabled is true (RnD feature)
   133     // because flag QGraphicsItem::ItemHasNoContents is set otherwise.
   133     // because flag QGraphicsItem::ItemHasNoContents is set otherwise.
   134     if (HbTouchAreaPrivate::outlinesEnabled) {
   134     if (HbTouchAreaPrivate::outlinesEnabled) {
   135         painter->setPen(Qt::red);
   135         painter->setPen(Qt::red); //krazy:exclude=qenums
   136         painter->drawLine(contentsRect().topLeft(), contentsRect().bottomRight());
   136         painter->drawLine(contentsRect().topLeft(), contentsRect().bottomRight());
   137         painter->drawLine(contentsRect().topRight(), contentsRect().bottomLeft()); 
   137         painter->drawLine(contentsRect().topRight(), contentsRect().bottomLeft()); 
   138         painter->setBrush(QBrush(QColor(255, 0, 0, 50)));
   138         painter->setBrush(QBrush(QColor(255, 0, 0, 50)));
   139         painter->drawRect(contentsRect());
   139         painter->drawRect(contentsRect());
   140     }
   140     }