CSSmargin: 3 7 10 15;border-width: 3 7 10 15;padding: 3 7 10 15;
C++ (Qt) void MyWidget::paintEvent(QPaintEvent * /* event */) { QPainter painter(this); QStyleOptionFocusRect option; option.initFrom(this); option.backgroundColor = palette().color(QPalette::Background); style()->drawPrimitive(QStyle::PE_FrameFocusRect, &option, &painter, this); } void MyWidget::paintEvent(QPaintEvent * /* event */) { QStylePainter painter(this); QStyleOptionFocusRect option; option.initFrom(this); option.backgroundColor = palette().color(QPalette::Background); painter.drawPrimitive(QStyle::PE_FrameFocusRect, option); }
C++ (Qt)class QRenderRule{public: QRect borderRect(const QRect &r) const; QRect outlineRect(const QRect &r) const; QRect paddingRect(const QRect &r) const; QRect contentsRect(const QRect &r) const;