The database stores "Notes" about the company, and since there can be an unlimited number of notes, I made their output using dynamic QTextEdit and dynamic QFrame. Everything would be fine, but here's the problem - the size of QTextEdit is fixed, which makes it look rather miserable. How to adjust the size? The text of the notes cannot be changed, that is, the text will always be fixed, it comes from the database.
QSqlRecord rec = query.record();
while(query.next()){
dynamicText *text = new dynamicText(this);
text->setReadOnly(true);
text->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
text->setFont(defaultfont);
dynamicFrame *frame = new dynamicFrame(this);
frame->setStyleSheet("background-color:rgb(220, 220, 220)");
QHBoxLayout *lay = new QHBoxLayout(frame);
text->setText(query.value(rec.indexOf("text")).toString());
text->setStyleSheet("background-color: transparent");
lay->addWidget(text);
lay->addWidget(date);
ui->verticalLayout_11->addWidget(frame);
}
I tried with text->resize(), but I couldn't find the right arguments, almost always the text remains the same.