Hi

I hope you people will encourage me...

Still I am reading the documents ... At same time trying with sample programs...

Already Wysto told me don't use the list view to add widgets.... I don't use here after...

Sorry , I am learning slowly....here i have been trying one small sample application

Nothing displaying the Tweets...I displayed tweets in listview with somebody help..

Here i am using the Event methods to get the current window position...and i assign the width to my tweet..

please see my code.

To display the tweet

Qt Code:
  1. for (int i = 0; i < 21; ++i)
  2. {
  3. model->appendRow(item);
  4. }
  5. ui->listView->setModel(model);
  6. for (int i = 0; i < 21; ++i)
  7. { Tweet * t = new Tweet(this);
  8. t->resize(ui->listView->size().width(), t->size().height());
  9. qDebug("width:%d",ui->listView->size().width());
  10. qDebug("Height:%d", t->size().height());
  11. model->item(i)->setSizeHint(t->size());
  12. ui->listView->setIndexWidget(model->item(i)->index(), t);
  13. }
  14. }
To copy to clipboard, switch view to plain text mode 

my event function

Qt Code:
  1. void MainWindow::resizeEvent( QResizeEvent *event )
  2. {
  3. emit resizeView( event->size().width(), event->oldSize().width() );
  4. }
To copy to clipboard, switch view to plain text mode 

this one emit the resizeView and call the resizeData slot...

My slot code is
Qt Code:
  1. void MainWindow ::resizeData(int width, int oldWidth)
  2. {
  3.  
  4. qDebug("current width:%d and old width : %d", width,oldWidth);
  5.  
  6. QSize itemSize;
  7. Tweet *aTweet;
  8. for ( int i = 0; i < 21; i++ ) {
  9. aTweet = t;
  10. aTweet->resize( width , aTweet->size().height() );
  11. itemSize = model->item(i)->sizeHint();
  12. itemSize.rwidth() += width - oldWidth;
  13. itemSize.rheight() = aTweet->size().height();
  14. model->item(i)->setSizeHint( itemSize );
  15. }
  16. }
To copy to clipboard, switch view to plain text mode 


here i resized my tweet width according to the window width....

If i try to modify the window window size, the window is crazed(closed)...




Please help me to solve this issue