Drawing Rectangle with only 2 corners rounded in Qt

前端 未结 3 1805
谎友^
谎友^ 2021-01-12 11:46

I am working on an application where I need to fill the color for the Pixmap using Painter. Pixmap is of type rectangle with (bottom edge) 2 rounded corners. Top 2 corners a

3条回答
  •  不思量自难忘°
    2021-01-12 12:14

    You can use stylesheets (on runtime or loading the file qss). You could manage to do it very easily:

    QString str = "bottom-right-radius: 10px; top-right-radius: 0px....";
    box->setStylesheet(str);
    

    I suppose the box is a pixmap inside a QLabel ( label->setPixmap(...) )

    OR

    Set the object name to something (the label), and then use the

    QLabel#name { bottom-right-radius: 10px... }

    In a stylesheet you load.

    Check this site out. It helps: http://border-radius.com/

提交回复
热议问题