Set Grid Location of A Widget within a Frame



  • 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?



  • 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



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



  • 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


Log in to reply
 

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