The QLabel class is inherited from QFrame , and the latter has methods for setting the frame , the style of the shadow , and the thickness of the lines ( here and here ).
But you can manually on the widget by overriding the corresponding method:
void MyWidget::paintEvent(QPaintEvent *event) { QPixmap pix("image.png"); if(pix.isNull() == false) { QRect dst_rc = rect(); if(dst_rc.width() > dst_rc.height()) pix = pix.scaledToHeight(dst_rc.height()); else if(dst_rc.height() > dst_rc.width()) pix = pix.scaledToWidth(dst_rc.width()); dst_rc = pix.rect(); dst_rc.moveCenter(rect().center()); const QBrush brush(Qt::black); const QPen pen(brush, 2); // Второй аргумент - толщина линии. QPainter painter(this); painter.setPen(pen); painter.setBrush(brush); painter.drawPixmap(dst_rc, pix); painter.drawRect(dst_rc); } event->accept(); }
... where MyWidget is a QWidget descendant.