Details
-
Bug
-
Resolution: Duplicate
-
P2: Important
-
4.3.2
-
None
Description
When having a QLabel with word wrapping in a layout inside a QDialog, then later after the dialog is shown setting a larger text on the QLabel the text appears clipped.
It would be expected that the text would be shown properly.
If the word wrapping is off, the dialog is resized to fit the content, it would also be expected that this would happen when word wrapping is on. If calling adjustSize() after the text has been set the dialog is resized and the text is shown properly.
If setting the text before the dialog is shown in the first place the text is laid out properly.
Also on Mac the buttons become flat in Qt 4.3, and in Qt 4.4 the buttons do not become flat but shrink a bit.
Reproducible with:
--main.cpp
#include <QtCore>
#include <QApplication>
#include "TestDlg.h"
int main(int argc, char *argv[])
{ QApplication app(argc, argv); CTestDlg dialog; return dialog.exec(); } --- --testdialog.cpp #include <QtGui> #include "TestDlg.h" CTestDlg::CTestDlg(QDialog *parent /*=NULL*/) : QDialog(parent) { btnExec = new QPushButton("Exec"); btnCancel = new QPushButton("Cancel"); QHBoxLayout* hlay = new QHBoxLayout; hlay->addWidget(btnExec); hlay->addWidget(btnCancel); hlay->addStretch(); label = new QLabel; label->setWordWrap(true); QVBoxLayout* vlay = new QVBoxLayout; vlay->addLayout(hlay); vlay->addWidget(label); setLayout(vlay); connect(btnExec, SIGNAL(clicked()), this, SLOT(btnExecClicked())); connect(btnCancel, SIGNAL(clicked()), this, SLOT(reject())); } void CTestDlg::btnExecClicked() { QString psztxt("[ABCDEFGHIJKLMN] Function[TestFunction] ErrNo[2] File[/Applications/abc-def/X0010/W123/PROGRAM/TEST0001.app/Contents/MacOS/TEST0001 /Users/Shared/abc-def/X0010/W123/TMP/1234567/890123/DATE/2007/1119001.DAT"); label->setText( psztxt ); //adjustSize(); } -- ---testdialog.h #include <QtGui> class CTestDlg : public QDialog { Q_OBJECT public: CTestDlg(QDialog *pParent = NULL); private slots: void btnExecClicked(); private: QPushButton* btnExec; QPushButton* btnCancel; QLabel* label; };
—