Results 1 to 3 of 3

Thread: writing a layout manager

  1. #1
    Join Date
    Feb 2006
    Posts
    26
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt3
    Platforms
    MacOS X Windows

    Default writing a layout manager

    Hello,

    Since Qt's layouts never work for my custom widgets, I'm afraid I'm going to have to write my own .

    Does anybody have an example of a custom layout manager they would be able to share? I know about the example in the documentation, but I need more (and more complex) examples.

    Thank you for helping !

    Jay

  2. #2
    Join Date
    Feb 2006
    Posts
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: writing a layout manager

    Qt's layouts should work with your custom widgets just fine... if you coded them properly.

    All you generally need to do is reimplement:

    QSize minimumSizeHint() const;
    QSize sizeHint() const;

    Also, in your constructor it would be best to call setSizePolicy. You may also need to call setMaximumSize() if your widget needs it.

    I make lots of custom widgets, make them into designer plugins, and then look and work great with all of Qt's layouts.

  3. #3
    Join Date
    Feb 2006
    Posts
    26
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt3
    Platforms
    MacOS X Windows

    Default Re: writing a layout manager

    All you generally need to do is reimplement:

    QSize minimumSizeHint() const;
    QSize sizeHint() const;

    Also, in your constructor it would be best to call setSizePolicy. You may also need to call setMaximumSize() if your widget needs it.
    I'm not saying they don't do anything, but my widgets have unique alignment needs that aren't addressed by layouts. I've reimplemented everything I can, but that doesn't fit my needs. So, I'm forced to customize the wheel for my own needs.

    I see that Qt4 has a couple of more examples of custom layouts, but I only have Qt 3.3.4 and it appears some of the functions are missing. I've changed as much as I could, but stuff's missing and it won't compile.

    http://support.informatik.uni-freibu...qt/layout.html

    Does anyone know how to make this code work in Qt 3?

    Thank you!
    Jay

Similar Threads

  1. changing layout of a widget
    By mikro in forum Qt Programming
    Replies: 10
    Last Post: 4th August 2009, 20:21
  2. Qt like Layout Manager available for .NET platform
    By vkhaitan in forum Qt Programming
    Replies: 0
    Last Post: 5th November 2008, 13:36
  3. Replies: 2
    Last Post: 9th July 2008, 22:28
  4. Qt layout memory issue
    By bunjee in forum Qt Programming
    Replies: 9
    Last Post: 25th August 2007, 17:11
  5. QT4 layout of complex dialog is very slow
    By cboles in forum Qt Programming
    Replies: 15
    Last Post: 28th April 2006, 19:57

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.