Results 1 to 9 of 9

Thread: window crazing

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

    Default window crazing

    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

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: window crazing

    Quote Originally Posted by yuvaraj.yadav View Post
    Already Wysto told me don't use the list view to add widgets.... I don't use here after...
    He is called wysota and it looks like it's not enough for you that he told you to better use QListWidget. So I by myself tell you to use QListWidget. Even if I don't know what your problem is but for a bloody rookies that would be the best start. And by the way: this is the 7th thread always about the same topic...

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

    Default Re: window crazing

    I don't have any sources to get help except Qtforum, whats why i posted.

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

    Default Re: window crazing

    I have to finally ask this question - what is the base class for "Tweet"?
    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.


  5. #5
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: window crazing

    Quote Originally Posted by yuvaraj.yadav View Post
    I don't have any sources to get help except Qtforum, whats why i posted.
    You have. Just open Qt Assistant and Qt Examples & Demos
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

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

    Default Re: window crazing

    QWidget is the base class for Tweet class

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

    Default Re: window crazing

    Quote Originally Posted by yuvaraj.yadav View Post
    QWidget is the base class for Tweet class
    So why do you keep trying to push the widget to the list view? Why don't you use QScrollArea as I suggested a few times before?

    Qt Code:
    1. QWidget *viewport = new QWidget;
    2. QVBoxLayout *l = new QVBoxLayout(viewport);
    3. sa->setWidget(viewport);
    4. sa->setWidgetResizable(true);
    5. for(int i = 0; i<10; i++){
    6. l->addWidget(new Tweet);
    7. }
    To copy to clipboard, switch view to plain text mode 
    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.


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

    Cool Re: window crazing

    Our team asked me to use the list view only. thats why. Already we have worked in mobile side

    ok i have asked one issue regarding the resize problem...How do i solve that one.... I am getting problem,While i am trying to modify the tweet width with window current width...


    please help me.


    Thanks

    Yuvaraj R

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

    Default Re: window crazing

    Quote Originally Posted by yuvaraj.yadav View Post
    Our team asked me to use the list view only.
    In that case implement a delegate for your list instead of a widget.

    ok i have asked one issue regarding the resize problem...How do i solve that one.... I am getting problem,While i am trying to modify the tweet width with window current width...
    That has to be done through the delegate as well so better instead of doing crazy things, do it properly - implement a delegate showing the tweet.
    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. How to set Qt window transparent?
    By montylee in forum Qt Programming
    Replies: 17
    Last Post: 24th December 2013, 20:11
  2. QMain Window Problem
    By maveric in forum Qt Programming
    Replies: 1
    Last Post: 24th May 2008, 15:51
  3. Set a window as child at runtime
    By sabeesh in forum Qt Programming
    Replies: 1
    Last Post: 26th November 2007, 09:30
  4. Change shape of window / animate window
    By sabeesh in forum Qt Programming
    Replies: 3
    Last Post: 31st October 2007, 08:16
  5. move parent window to the front.
    By hvengel in forum Qt Programming
    Replies: 4
    Last Post: 2nd February 2007, 08:41

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
  •  
Qt is a trademark of The Qt Company.