Results 1 to 3 of 3

Thread: custom QLayout help

  1. #1
    Join Date
    Jun 2007
    Posts
    56
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default custom QLayout help

    I am trying to implement a custom QLayout. I am using the card example in the Layout Classes page for a start. I noticed that the Qt supplied layouts allow nested layouts via the addLayout() method. I need to add both widgets and child layouts in my custom layout. How should I implement the addLayout method? The example doesn't cover this and I couldn't find any info by searching the forum.

    Thanks for any help.

    Mic

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: custom QLayout help

    QLayout doesn't have such method, so you don't need to implement it. Instead it has addItem() method that you should probably reimplement. If you keep working on QLayoutItem level, you'll be able to implement addLayout() through addItem().

  3. #3
    Join Date
    Jun 2007
    Posts
    56
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: custom QLayout help

    Ok I'm a dolt! Thanks wysota for making me look a little harder.

    It seems that QLayout inherits from QLayoutItem and that I can just call addItem() passing the pointer to the child layout that I want without the compiler flying out at me.

    I had already reimplemented it from the example, but was confused since it was expecting QLayoutItem pointers and I was wanting to add a QVBoxLayout!

    It compiles at least. Testing later.

    Thanks!

Similar Threads

  1. custom plug-in widget in another custom plug-in widget.
    By MrGarbage in forum Qt Programming
    Replies: 6
    Last Post: 27th August 2007, 15:38
  2. Replies: 1
    Last Post: 5th March 2007, 20:50
  3. Custom Widget Plugin Analog Clock
    By kemp in forum Qt Programming
    Replies: 8
    Last Post: 11th August 2006, 13:22
  4. Custom plugin for a layout
    By cocheci in forum Qt Tools
    Replies: 2
    Last Post: 12th June 2006, 18:36
  5. Replies: 16
    Last Post: 7th March 2006, 15: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.