Results 1 to 2 of 2

Thread: qt exandable widgets

  1. #1
    Join Date
    Nov 2006
    Posts
    96

    Default qt exandable widgets

    Hello, I defined an new class (that adds a new line) that consists of:

    Qt Code:
    1. class attachLine : public QWidget {
    2. public:
    3. attachLine(QWidget *parent=0);
    4.  
    5. QLabel *location_label;
    6. QLineEdit *location_edit;
    7. QHBoxLayout *location_layout;
    8. QPushButton *open_button;
    9. QLabel *validate_icon;
    10. };
    To copy to clipboard, switch view to plain text mode 

    in my main application I need a functionality that a new line will show in one of the QHBoxLayouts when a certain button is pressed.

    What I did is:
    - I defined a new widget QWidget
    - I added lines_layout with addLayout to the main_layout
    - set main_layout as layout of QWidget

    and when a QPushButton is pressed, I do this:
    - I only add the the lines_layout the upper class (attachLine->location_layout) with addLayout

    The problem is that this isn't working. Nothing happens when I press the button.
    Does anybody have any idea what am I doing wrong. Maybe there's even a class more appropriate to use for this functionality.

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Napoli, Italy
    Posts
    621
    Thanks
    5
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: qt exandable widgets

    In general, if you use layouts you can hide widgets and layout auto-resizes himself. Remember to use QLayout::setSizeConstraint (QLayout::SetMinAndMaxSize) to the widget's main layout to resize it automatically
    A camel can go 14 days without drink,
    I can't!!!

Similar Threads

  1. Qt3 - Multiple transparent widgets
    By bythesea in forum Qt Programming
    Replies: 4
    Last Post: 11th September 2009, 11:24
  2. Mac OS X Top-Level Transparent Widgets
    By tinsuke in forum Qt Programming
    Replies: 0
    Last Post: 17th October 2008, 16:01
  3. Upper limit on number of widgets?
    By jdiewald in forum Qt Programming
    Replies: 1
    Last Post: 29th September 2008, 23:00
  4. Replies: 2
    Last Post: 16th May 2008, 14:39
  5. widgets behind hidden widgets not working
    By bpetty in forum Newbie
    Replies: 13
    Last Post: 7th September 2007, 20:23

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.