How to do such a layout ?



  • Hey,

    I want an Application with a layout like this:

    !http://img253.imageshack.us/img253/6606/bsp.png(layout)!

    What's the best way to do this within a QGraphicsScene ?

    The MenuBar should "animate" (increase/decrease) it's height [visible/hidden] and animate MenuBar-Items (animate out etc)
    Same for the Footer-Bar

    The "Bars" should always be 100% width and a pixel value of height ...

    I tried QGraphicsLinearLayout like this:

    QGraphicsLinearLayout[Vertical]---+--- QGraphicsLinearLayout[Horizontal] (<= MenuBar)
    +-- QGraphicsLinearLayout[Horizontal] (<= Content)
    -- QGraphicsLinearLayout[Horizontal] (<= Footer)

    But then my parent widget (a QGraphicsWidget subclass) got broken and i've no idea why
    (The parent widget is for a grey background color because the header-bar should have rounded corners )

    Hope someone have any idea



  • Ok, sorry I got it managed ;)

    But what’s the best way for resizing the menubars height, because it’s geometry is controlled by the layout ?

    Should I call “setPreferedHeight(height-1)” in a loop or is there a better way ?



  • if u can use a vertialLayout - do it :)
    @QWidget *mainWidget = new YourWidget();
    QVBoxLayout *mainLayout = new QVBoxLayout();

    QHBoxLayout *header = new QHBoxLayout();
    header->addSpacer(new QSpacerItem (1, 20, QSizePolicy::Minimum, QSizePolicy::Preferred);
    QHBoxLayout *content = new QHBoxLayout();
    content->addSpacer(new QSpacerItem (1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding);
    QHBoxLayout *footer = new QHBoxLayout();
    footer->addSpacer(new QSpacerItem (1, 20, QSizePolicy::Minimum, QSizePolicy::Preferred);

    mainLayout->addLayout(header);
    mainLayout->addLayout(content);
    mainLayout->addLayout(footer);

    mainWidget->setLayout(mainLayout);@

    but better use a UI



  • what do you mean with "better use a UI" ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.