want to create 3 triangle and widget them in QHVBoxLayout()



  • why is my code not working?
    want to create 3 triangle and widget them in QHVBoxLayout().

    QRectF rect= QRectF(0,0,100,100);
    
    QPainterPath path;
    path.moveTo(rect.topLeft(),rect.left());
    path.lineTo(rect.bottomLeft());
    path.lineTo(rect.topRight());
    
    QPainter painter;
    painter.setPen(Qt:: NoPen);
    painter.fillPath(path, QBrush(QColor("blue")) );

  • Moderators

    Your painter doesn't have anything to paint on. If the above code is inside an overriden paintEventthen it should be something like QPainter painter(this);.


Log in to reply
 

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