Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to do such a layout ?
Qt 6.11 is out! See what's new in the release blog

How to do such a layout ?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    remmos
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • R Offline
      R Offline
      remmos
      wrote on last edited by
      #2

      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 ?

      1 Reply Last reply
      0
      • M Offline
        M Offline
        maxim.prishchepa
        wrote on last edited by
        #3

        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

        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz).

        1 Reply Last reply
        0
        • R Offline
          R Offline
          remmos
          wrote on last edited by
          #4

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

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved