How to set QSizePolicy in QSS stylesheet

  c++, qt, qtstylesheets

Is it possible to change the QSizePolicy property from the stylesheet?

So far I know every QWidget has the property sizePolicy. But the QSizePolicy constructor takes two arguments; so I’m not sure how to set this property from a QSS file. Also calling:

MyWidget
{
    qproperty-sizePolicy: 2; // or "Expanding"
}

Does not seem to do anything.

Source: Windows Questions C++

LEAVE A COMMENT