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. Set Grid Location of A Widget within a Frame

Set Grid Location of A Widget within a Frame

Scheduled Pinned Locked Moved General and Desktop
4 Posts 1 Posters 3.5k Views
  • 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.
  • W Offline
    W Offline
    webmaster.skelton
    wrote on last edited by
    #1

    I am having trouble understanding exactly how to place a widget at a specific point in a frame with a given gridlayout. I have tried manually setting the row and column values, but when i add the widget( from another class) no matter how I change the location the widget either stays the center or the corners. Any suggestions?

    1 Reply Last reply
    0
    • W Offline
      W Offline
      webmaster.skelton
      wrote on last edited by
      #2

      FrameFactory::frame->setLayout(FrameFactory::gridlayout);

      FrameFactory::gridlayout->addWidget(ButtonFactory::GetInstance()->createButton_Save(),2,1,Qt::AlignBottom | Qt::AlignHCenter);
      
      FrameFactory::frame->show();
      

      here is a bit of code that goes along with that

      1 Reply Last reply
      0
      • ? This user is from outside of this forum
        ? This user is from outside of this forum
        Guest
        wrote on last edited by
        #3

        Use spacerItem .. refer the QGridLayout documentation
        Also it helps to markup the code using @ tag

        1 Reply Last reply
        0
        • W Offline
          W Offline
          webmaster.skelton
          wrote on last edited by
          #4

          Well I have been Trying and have looked over the documentation.... But I am still now sure how to actually place a spacer into a given x and y position with a given height and width. I am trying to add several widgets to a gridlayout within a frame. I cant get everything aligned left with the spacer, but im not sure yet as to how you go about setting the spacers from a given x to a given x.

          Thanks

          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