Я создаю QWidget
. Накладаю на нево QVBoxLayout
. До QVBoxLayout
додаю QLineEdit
. Размер QLineEdit
установляю таков как QWidget
. При исполнении програми QLineEdit
есть обрезаный. Почему?
class functionSticker : public QWidget
{
Q_OBJECT
QTextEdit* text_description;
public:
explicit functionSticker(const QString& text, QWidget *parent = 0 );
public slots:
void resizeFrame();
};
functionSticker::functionSticker(const QString& text, QWidget *parent) :
QWidget(parent),
text_description(new QTextEdit)
{
text_description->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setLayout(new QVBoxLayout);
layout()->setSpacing(0);
layout()->addWidget(text_description);
text_description->setText(text);
setFixedHeight(100);
show();
connect(text_description, SIGNAL(textChanged()), this,SLOT(resizeFrame()));
}
void functionSticker::resizeFrame()
{
int height = text_description->document()->size().height();
setFixedHeight(height);
text_description->setFixedHeight( height );
updateGeometry();
}