Results 1 to 6 of 6

Thread: QWidget Shyness Syndrome

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QWidget Shyness Syndrome

    Here you go(untested)
    Qt Code:
    1. void FrameInfo::addInfo (QString infoName, QString val)
    2. {
    3. QWidget *w = new QWidget(holder);
    4. QHBoxLayout* infoLayout = new QHBoxLayout(w);
    5. QLabel* lblValue = new QLabel (infoName,w);
    6. infoLayout->addWidget(lblValue);
    7. QLineEdit* leValue = new QLineEdit (val,w);
    8. leValue->setReadOnly ( true );
    9. leValue->setAlignment(Qt::AlignRight);
    10. infoLayout->addWidget(leValue);
    11. infoLayout->addStretch();
    12. mainLayout->addWidget(w);
    13. mainLayout->update();
    14. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Aug 2007
    Posts
    275
    Thanks
    28
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QWidget Shyness Syndrome

    the shyness is still there marcel but when i pull (skip)my scrollArea out of the pic i will see my info fine... this is really made me pull my hair today ...

    i am attaching my files in question hoping you can help me

    baray98
    Attached Files Attached Files
    Last edited by baray98; 20th September 2007 at 21:16.

  3. #3
    Join Date
    Aug 2007
    Posts
    275
    Thanks
    28
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QWidget Shyness Syndrome

    i think my problem is that my holder widget won't adjust it size after adding my lineEdits and labels. I already added the resize() for holder widgets but still no effect. what else can i do.

    baray98

  4. #4
    Join Date
    Aug 2007
    Posts
    275
    Thanks
    28
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QWidget Shyness Syndrome

    my solution was to re-assign the widget holder again in scrollArea everytime i add some more widgets in my holder.

    Qt Code:
    1. QWidget* holder = scrollArea->takeWidget()
    2.  
    3. // add stuff to holder
    4.  
    5.  
    6. scrollArea->setWidget(holder)
    To copy to clipboard, switch view to plain text mode 

    baray98 (kudos to marcel)

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.