Results 1 to 11 of 11

Thread: Cannot make the LineEdit size to be "fixed"

  1. #1
    Join Date
    Aug 2008
    Posts
    18
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Cannot make the LineEdit size to be "fixed"

    Even when I set the LineEdit's SizePolicy to "fixed, fixed, 0, 0", the Layout manager still resizes it to the "predered" size when I apply the GridLayout to them. But, the same SizePolicy of a ComboBox keeps its size unchanged when putting it into a layout. Do I miss something ?

    Thanks!

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Cannot make the LineEdit size to be "fixed"

    in 4.4.1 it works fine.
    can you post your ui?

  3. #3
    Join Date
    Aug 2008
    Posts
    18
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Arrow Re: Cannot make the LineEdit size to be "fixed"

    Please find that in the attachment.

    Thank you!
    Attached Files Attached Files

  4. #4
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Cannot make the LineEdit size to be "fixed"

    you need to put all widgets in Settings in QGridLayout by cliking on tool bar.
    then set SizePolicy to Fixed for all QLineEdits.
    also, you need add main layout (QVBoxLayout) for QGroupBox, QLabel and QTreeWidget.

  5. #5
    Join Date
    Aug 2008
    Posts
    18
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Cannot make the LineEdit size to be "fixed"

    Thank you for the reply! My problem is that the size of the lineEdit fields cannot stick to the size I set even I tell the SizePolycy to be "fixed". When I put the "Settings" group Box in a GridLayout, the size of my lineEdit grows to its "prefered" size. If you look at the ComboBox, after I set its "SizePolicy" to be "fixed", it will stick to the original size, not the "prefered" size. It seems like the "SizePolicy" setting of the LineEdit doesn't do anything to it.

    Yi

  6. #6
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Cannot make the LineEdit size to be "fixed"

    I don't know what you do, but SizePolicy::Fixed works fine for QLineEdit.

  7. #7
    Join Date
    Aug 2008
    Posts
    18
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Cannot make the LineEdit size to be "fixed"

    It really bothers me that QT Designer is incapable to size the LineEdit according to the requirement in its layout manager. It always wants to make LineEdit at least certain size. If you want to create a small dialog with various LineEdits, each of them only holds 2 or 3 digits, you do not want the LineEdit in the size QT sets for you. I do not want to display a big dialog then resize it by user. Looks like QT is not ready for prime time yet.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 975 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Cannot make the LineEdit size to be "fixed"

    Quote Originally Posted by yren View Post
    Looks like QT is not ready for prime time yet.
    Or maybe you just don't know how to use Qt Designer properly.
    Attached Images Attached Images

  9. #9
    Join Date
    Aug 2008
    Posts
    18
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Cannot make the LineEdit size to be "fixed"

    That will mostly be the case! Could you post your UI so I can learn how you set them up with the layout manager.

    Thanks!

  10. #10
    Join Date
    Aug 2008
    Posts
    18
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Smile Re: Cannot make the LineEdit size to be "fixed"

    I got it. The Max/Min size need to be specified if I want to control the behavior of Layout Manager.

  11. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 975 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Cannot make the LineEdit size to be "fixed"

    Quote Originally Posted by yren View Post
    I got it. The Max/Min size need to be specified if I want to control the behavior of Layout Manager.
    The other option is to use stretch factors and spacers.

Similar Threads

  1. Replies: 1
    Last Post: 27th March 2008, 16:10
  2. Replies: 1
    Last Post: 14th May 2007, 15:55
  3. How can I make size of QGraphicsScene smaller?
    By troorl_ua in forum Qt Programming
    Replies: 6
    Last Post: 21st April 2007, 08:56
  4. Compiling with Qmake/Make
    By VireX in forum Newbie
    Replies: 25
    Last Post: 22nd February 2007, 06:57
  5. Qt 4.1.1 linker warnings
    By Matt Smith in forum Installation and Deployment
    Replies: 0
    Last Post: 26th February 2006, 23:14

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.