Unsolved How can i change expansion direction?
-
HI:
I am using following code for automaticly resizing label, but how can i change expansion direction?
ParameterLabel->setText(ParamterText);
ParameterLabel->adjustSize();Regards.
-
@Yaldiz Is your label in a layout? You could then set https://doc.qt.io/qt-5/qlayout.html#setAlignment
-
ParameterLabel->setStyleSheet("border: none; color: #ffffff;"); ParameterLabel->move(365 , 10); ParameterLabel->setMinimumSize(50 , 24); ParameterLabel->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter); ParameterLabel->setFont(QFont{"SF Pro Text" , 12}); QHBoxLayout* HLayParameterLabel = new QHBoxLayout; HLayParameterLabel->setMargin(0); HLayParameterLabel->setAlignment(ParameterLabel,Qt::AlignLeft); ParameterLabel->setLayout(HLayParameterLabel);
void SubWidget::setParameterText(const QString& ParamterText)
{
ParameterLabel->setText(ParamterText );
ParameterLabel->adjustSize();
}I tried above code but doesn't changed anything.
-
@Yaldiz said in How can i change expansion direction?:
I tried above code but doesn't changed anything.
This code is not what you should do.
My question was whether the label itself is in a layout.
So: is it?
It rather looks like you do not use layouts for your widgets. -
Yes, I dont use layouts.