> > However, implementing a paint function that draws the contents of a 
> > normal QWidget is not as simple as I imagined. And after I get 
> > painting to work, I'd like the widgets to actually *work* 
> as well (I'm 
> > looking for a progress bar, text and a web link and some icons).
> 
> Right. That might make things more difficult. It suddenly 
> occurred to me that you could use QListWidget for your view 
> and call setItemWidget() for each item, but you may encounter 
> problems depending on how many widgets you have and how 
> dynamic they are:
> 
>   http://doc.trolltech.com/4.4/qlistwidget.html#setItemWidget

I must be doing something wrong. I create my gui this way:

    QListWidget*theListView = new QListWidget(this);
    setCentralWidget(theListView);

    QListWidgetItem* theItem1 = new QListWidgetItem(tr("t1"),
theListView );
    theListView->addItem(theItem1);
    theListView->addItem(tr("t2"));
    theListView->addItem(tr("t3"));


    QWidget* theWidget1 = new QWidget();
    QHBoxLayout* theLayout = new QHBoxLayout(theWidget1);
    theWidget1->setLayout(theLayout);
    theLayout->addWidget( new QPushButton(tr("a"), theWidget1));
    theLayout->addWidget( new QLabel(tr("b"), theWidget1));
 
theWidget1->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
    theWidget1->adjustSize();

    theListView->setItemWidget(theListView->item(1), theWidget1);
    theListView->setItemWidget(theListView->item(2), new
QPushButton(tr("ttt")));

And only the pushbutton shows, the other widget doesn't. (I tried to
replace theWidget1 with a 'MyWidget' from
http://doc.trolltech.com/4.4/tutorials-tutorial-t4.html but that didn't
help either.)


Arnt

_______________________________________________
Qt4-preview-feedback mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt4-preview-feedback

Reply via email to