Results 1 to 4 of 4

Thread: resize problem

  1. #1
    Join Date
    Apr 2009
    Posts
    61
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X

    Default resize problem

    Hi

    i am facing resize problem...

    My code is

    QStandard
    Qt Code:
    1. for (int i = 0; i < 24; ++i)
    2. {
    3. model->appendRow(item);
    4. }
    5. ui->listView->setModel(model);
    6. for (int i = 0; i < 24; ++i)
    7. {
    8. Tweet * t = new Tweet();
    9. t->resize(ui->listView->size().width(), 70);
    10. model->item(i)->setSizeHint(t->size());
    11.  
    12. ui->listView->setIndexWidget(model->item(i)->index(), t);
    13. if ( i == 24- 1 ){
    14. resizeData( ui->listView->width(), ui->listView->width() - 1 );
    15. }
    16. }
    To copy to clipboard, switch view to plain text mode 

    Here i calling the resizedata when i==24-1;


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

    here i am getting the listview current width and previous width ...

    From there i calculated the new width...and i assigned to my items...

    But this one is not displaying ...

    I don't know whats problem with me ....


    please help me


    Thanks

    Yuvaraj R

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: resize problem

    What is the question?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Apr 2009
    Posts
    61
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: resize problem

    My question is how do i display less amount of items(tweet) ,when i am minimizing the list view width

    and while maximizing list view width ,it has to show more items(tweet)



    Thanks

    Yuvaraj R

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: resize problem

    First of all, how do you expect anybody to know how your "Tweet" class behaves just by knowing what the class is called?

    Second of all this is the next thread in series where you show no understanding of the model-view concept and despite being asked continuously if you are sure if you should use it and why you place widgets inside each index of the list you don't answer but instead post yet another thread related to an incorrect usage of the list view. What you are trying to do is expecting a coffee machine to bake cookies. Coffee machine is for making coffee, not for baking cookies. List view is not for placing widgets inside it, use QScrollArea instead for God's sake!
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 1
    Last Post: 10th August 2008, 18:55
  2. QGLWidget Resize Problem
    By Sandip in forum Qt Programming
    Replies: 2
    Last Post: 28th February 2008, 06:47
  3. QGLWidget resize problem.
    By anderl in forum Qt Programming
    Replies: 2
    Last Post: 22nd January 2008, 08:57
  4. QMainWindow resize problem
    By edb in forum Qt Programming
    Replies: 5
    Last Post: 12th January 2007, 10:31
  5. QTable resize problem with large tables
    By Robzzz in forum Newbie
    Replies: 3
    Last Post: 22nd May 2006, 14:13

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.