QPushButton positioning to the top right corner and to the bottom right corner.
-
The following code postion the btn to the top right corner:
windowis aQWidgetbtn1 = new QPushButton(window); btnHistory->setFixedSize(10,10); auto* layout = new QGridLayout(window); layout->setContentsMargins(0,0,0,0); layout->setMargin(0); layout->setSpacing(0); layout->addWidget(btn1, 0, 1); layout->setRowStretch(1, 1); layout->setColumnStretch(0, 1);I would like to position the the next btn to the bottom right corner, but I do not know how could I reach that.
btn2 = new QPushButton(window); btnHistory->setFixedSize(10,10); -
The following code postion the btn to the top right corner:
windowis aQWidgetbtn1 = new QPushButton(window); btnHistory->setFixedSize(10,10); auto* layout = new QGridLayout(window); layout->setContentsMargins(0,0,0,0); layout->setMargin(0); layout->setSpacing(0); layout->addWidget(btn1, 0, 1); layout->setRowStretch(1, 1); layout->setColumnStretch(0, 1);I would like to position the the next btn to the bottom right corner, but I do not know how could I reach that.
btn2 = new QPushButton(window); btnHistory->setFixedSize(10,10);@ekato993 said in QPushButton positioning to the top right corner and to the bottom right corner.:
I would like to position the the next btn to the bottom right corner, but I do not know how could I reach that.
layout->addWidget(btn1, 0, 1);
Your first button is in
row 0,column 1, which is top right (assuming you have a 2x2 grid).
Where is the difficulty in changing the the numbers here?