I think I have the solution.
I create this subclass :
class SquareLabel : public QLabel
{
public:
SquareLabel(QWidget* parent = 0) : QLabel(parent)
{
setMinimumSize(100, 100);
QSizePolicy pol(QSizePolicy::Preferred, QSizePolicy::Preferred);
pol.setHeightForWidth(true);
setSizePolicy(pol);
}
virtual int heightForWidth(int w) const { return w; }
virtual QSize sizeHint() const { int w = this->width(); return QSize(w, heightForWidth(w)); }
protected:
void resizeEvent(QResizeEvent* event) { }
};
All my labels are added in a QVBoxLayout, and I need this property :
layout->setAlignment(Qt::AlignTop);
Now, I need to resize my pixmap in my label.
I will post it before close this question.