Results 1 to 2 of 2

Thread: How to create customDesignerWidget with functional QBoxLayout

  1. #1
    Join Date
    Apr 2016
    Posts
    2
    Qt products
    Qt5
    Platforms
    MacOS X Windows

    Default How to create customDesignerWidget with functional QBoxLayout

    Hi,
    I have a customDesignerWidget that inherits from QGroupBox. Inside the groupBox I have a QVBoxLayout.
    By default when you do this, you can not interact with the QVBoxLayout, meaning that you can not drag any widgets to it in designer because the designer only sees the customDesignerWidget plugin.

    Any ideas how I could give access to the QVBoxLayout so that when the user drags a widget over this custom designer widget, the widget would be added to the QVBoxLayout?

    Thanks

  2. #2
    Join Date
    Apr 2016
    Posts
    2
    Qt products
    Qt5
    Platforms
    MacOS X Windows

    Default Re: How to create customDesignerWidget with functional QBoxLayout

    Found the answer and it was embarrissingly simple.
    Just add this to the domXml function in the subclassed QDesignerCustomWidgetInterface.

    <layout class='QVBoxLayout' name='verticalLayout_2'></layout>

    Note:
    If you add a layout as a private member and then set the layout to the widget, this method does not work if you want the layout to be functional in the designer.
    Last edited by PetriJ; 2nd May 2016 at 17:21.

Similar Threads

  1. Release build not fully functional
    By xeyos in forum Newbie
    Replies: 2
    Last Post: 26th October 2014, 18:12
  2. QBoxLayout with QMainWindow vs QWidget
    By Vyivrain in forum Qt Programming
    Replies: 1
    Last Post: 7th April 2014, 10:58
  3. dumpcpp creates non-functional code of procedure
    By stephan.storm in forum Qt Programming
    Replies: 1
    Last Post: 2nd July 2012, 18:28
  4. Application is fully functional ONLY on my laptop
    By juracist in forum Installation and Deployment
    Replies: 17
    Last Post: 25th June 2012, 00:58
  5. QBoxLayout removeWidget problem
    By jaime in forum Qt Programming
    Replies: 3
    Last Post: 30th August 2006, 21: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.