Results 1 to 3 of 3

Thread: Simple problem with layout

  1. #1
    Join Date
    Sep 2011
    Posts
    10
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Simple problem with layout

    Hi. I have a simple problem with layout. I'm creating label and text edit:

    Qt Code:
    1. QLabel *label = new QLabel("Label:");
    2. QTextEdit *textEdit = new QTextEdit;
    3.  
    4. QHBoxLayout *layout = new QHBoxLayout;
    5. layout->addWidget(label);
    6. layout->addWidget(textEdit);
    To copy to clipboard, switch view to plain text mode 

    and I'm getting something like:

    Qt Code:
    1. ------------------------
    2.  
    3. |-------------|
    4. |-------------|
    5. Label: |-------------|
    6. |-------------|
    7. |-------------|
    To copy to clipboard, switch view to plain text mode 




    but I would like to get this:


    Qt Code:
    1. ------------------------
    2.  
    3. Label: |-------------|
    4. |-------------|
    5. |-------------|
    6. |-------------|
    7. |-------------|
    To copy to clipboard, switch view to plain text mode 


    How to do that? Thanks in advance.

  2. #2
    Join Date
    Oct 2011
    Posts
    13
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Simple problem with layout

    You can try the setAlignment function.

  3. #3
    Join Date
    Sep 2011
    Posts
    10
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Simple problem with layout

    Yes, it works. Thanks for help.

Similar Threads

  1. problem in simple example for installEventFilter
    By navid in forum Qt Programming
    Replies: 2
    Last Post: 10th December 2009, 19:43
  2. Simple QScrollArea problem
    By jmsbc in forum Qt Programming
    Replies: 4
    Last Post: 2nd December 2008, 18:45
  3. Simple problem
    By s410i in forum Qt Programming
    Replies: 3
    Last Post: 22nd June 2008, 11:12
  4. Simple QtPainter problem
    By rishid in forum Qt Programming
    Replies: 3
    Last Post: 5th February 2008, 21:00
  5. simple thread layout question
    By mhoover in forum Qt Programming
    Replies: 1
    Last Post: 12th August 2006, 11:02

Tags for this Thread

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.