How to set shadow border of a custom button?
I am a newvie in qt.I made a hexagon shape button through paint now i have to set its border which reflecting shadow view. I tried it with draw开发者_JS百科ing lines on the surrounding the button but it is not reflect shadow view.If the pen style can set to groove then it is possible to draw the lines with groove style than my purpose will solve. Any suggestion is highly appriciated. Thanks in advance.
For simple styling of UI elements look at
QML/QtQuick http://doc.qt.nokia.com/4.7/qtquick.html
and Qt Stylesheets http://doc.qt.nokia.com/latest/stylesheet.html.
Coming back to your question, Assuming you are drawing by overloading the PaintEvent function , have you looked at QPainter::setPen(Qt::PenStyle) http://doc.qt.nokia.com/latest/qpainter.html#setPen-3
QPainter painter;
painter.setPen(Qt::DashLine);
It is also possible to define a custom pen style using Qt::CustomDashLine
精彩评论