How to layout controlArea and mainArea horizontally
Question: I am trying to create a new widget for Orange 3. I see that it provides some
default areas (controlArea and mainArea) to which I can add my components. As
far as I can tell, widget.py places both of these inside 'self.leftWidgetPart'
which uses vertical orientation for its layout. From widget.py:

    
    
    self.leftWidgetPart = gui.widgetBox(self.topWidgetPart,
        orientation="vertical", margin=0)
    
        if self.want_main_area:
            ...
            self.mainArea = gui.widgetBox(self.topWidgetPart,
                orientation="vertical",
                sizePolicy=QSizePolicy(QSizePolicy.Expanding,
                QSizePolicy.Expanding),
                margin=0)
    

I would like to layout controlArea and mainArea horizontally instead. I
believe this is possible because the OWBoxPlot widget appears to do it, but I
can't work out what/where the relevant code snippet is (I guess my Python is
weak).

Any help appreciated,

David


Answer: In PyQt in general, you can change the orientation by removing the existing
layout and replacing it with another (hopefully before you populate it).

For `self.controlArea` in Orange, you can do something like this.

    
    
        from PyQt4.QtGui import QHBoxLayout
        import sip
    
        sip.delete(self.controlArea.layout())
        self.controlArea.setLayout(QHBoxLayout())
    

