alxobr
5th June 2011, 00:47
Hi all,
Though I have tried many things, I always get a tiny dialog with strings truncated. I can't figure out what happens. I have much more complex layouts and QListWidget's in the main window where it all works like a breeze.
Could someone tell me what I*overlooked ?
DiskList::DiskList( QWidget *parent, const char *name)
: QListWidget(parent)
{
setObjectName(name);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOf f);
int nb_entries=read_entries() ;
setSelectionMode(QAbstractItemView::ExtendedSelect ion);
setResizeMode(QListView::Adjust);
for (int i = 0; i< nb_entries; i++)
addItem(new QListWidgetItem(QString(entries[i]->mntpnt) + tr(" (removable drive)")));
}
GetUpdateList::GetUpdateList( QWidget *parent)
: QDialog( parent)
{
QVBoxLayout * whole = new QVBoxLayout;
whole->setObjectName("whole");
whole->setMargin(DIALOG_MARGIN);
whole->addWidget( disklist= new DiskList( this, "disklist"), 0, 0);
whole->addSpacing(DIALOG_SPACING);
QHBoxLayout *buttons = new QHBoxLayout();
update = new QPushButton( tr("&Update"), this );
connect( update, SIGNAL(clicked()), SLOT(updatedb()) );
buttons->addWidget(update, 0, 0);
done = new QPushButton( tr("&Done"), this );
connect( done, SIGNAL(clicked()), SLOT(accept()) );
buttons->addWidget(done, 0, 0);
whole->addLayout(buttons);
setLayout(whole);
}
Cheers,
Alexandre
-- added after 15*minutes
Hi again,
Even such instructions like:
setMinimumWidth(contentsRect().width() * 2 );[/QTCLASS]
do not solve the issue. Actually even the dialog's caption is truncated...
Alexandre
Added after 22 minutes:
I found an ugly workaround:
[QTCLASS]void DiskList::showEvent ( QShowEvent * )
{
setMinimumWidth(2 * contentsRect().width() + 2 * frameWidth());
}
Maybe I*should rather use the width of the QListWidgetItems. However I can't believe this has to be so far fetched to get such a straightforward behavior.
Alexandre
Though I have tried many things, I always get a tiny dialog with strings truncated. I can't figure out what happens. I have much more complex layouts and QListWidget's in the main window where it all works like a breeze.
Could someone tell me what I*overlooked ?
DiskList::DiskList( QWidget *parent, const char *name)
: QListWidget(parent)
{
setObjectName(name);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOf f);
int nb_entries=read_entries() ;
setSelectionMode(QAbstractItemView::ExtendedSelect ion);
setResizeMode(QListView::Adjust);
for (int i = 0; i< nb_entries; i++)
addItem(new QListWidgetItem(QString(entries[i]->mntpnt) + tr(" (removable drive)")));
}
GetUpdateList::GetUpdateList( QWidget *parent)
: QDialog( parent)
{
QVBoxLayout * whole = new QVBoxLayout;
whole->setObjectName("whole");
whole->setMargin(DIALOG_MARGIN);
whole->addWidget( disklist= new DiskList( this, "disklist"), 0, 0);
whole->addSpacing(DIALOG_SPACING);
QHBoxLayout *buttons = new QHBoxLayout();
update = new QPushButton( tr("&Update"), this );
connect( update, SIGNAL(clicked()), SLOT(updatedb()) );
buttons->addWidget(update, 0, 0);
done = new QPushButton( tr("&Done"), this );
connect( done, SIGNAL(clicked()), SLOT(accept()) );
buttons->addWidget(done, 0, 0);
whole->addLayout(buttons);
setLayout(whole);
}
Cheers,
Alexandre
-- added after 15*minutes
Hi again,
Even such instructions like:
setMinimumWidth(contentsRect().width() * 2 );[/QTCLASS]
do not solve the issue. Actually even the dialog's caption is truncated...
Alexandre
Added after 22 minutes:
I found an ugly workaround:
[QTCLASS]void DiskList::showEvent ( QShowEvent * )
{
setMinimumWidth(2 * contentsRect().width() + 2 * frameWidth());
}
Maybe I*should rather use the width of the QListWidgetItems. However I can't believe this has to be so far fetched to get such a straightforward behavior.
Alexandre