Solved How to resize custom Qpushbutton at runtime ?
-
How to increase width of custom Q push button at runtime ?
-
thanks for you suggestions. i have solved it by putting my two button on horizontal lay out and then i put this lay out on frame
below i wrote part of code that help me to achieve answer of my question
ui->pushButton_Save_2->hide();
ui->pushButton_Save_2->setHidden(true);
ui->pushButton_Save_2->setMinimumWidth(0);
ui->pushButton_Exit_2->setText(sExit());
ui->pushButton_Exit_2->setMinimumWidth(327);
ui->pushButton_Exit_2->resize(327,74);
ui->pushButton_Save_2->setText(sCalibrationSmall());
ui->pushButton_Exit_2->show(); -
@Qt-embedded-developer Easy to find in the documentation: https://doc.qt.io/qt-5/qwidget.html#size-prop ...
-
@jsulm
means before resize custom q push button i have called resize() but it not resize my custom q push button because it custom generated .i want to know is it possible to resize custom qpushbutton.
because by override qpushbutton it is possible but for custom qtreewidget it not works
-
@Qt-embedded-developer said in How to resize custom Qpushbutton at runtime ?:
i want to know is it possible to resize custom qpushbutton.
Yes.
-
@JonB so with resize() what extra things i need to implement?
-
@Qt-embedded-developer said in How to resize custom Qpushbutton at runtime ?:
so with resize() what extra things i need to implement?
Please show how you are calling resize().
Also: is your button in a layout? -
@jsulm ui->pushbutton->resize(280,74);
and no my push button is not on lay out . it is on splitter and splitter is on frame.
-
@Qt-embedded-developer said in How to resize custom Qpushbutton at runtime ?:
it is on splitter
So, you can change the size of the button if you move the splitter?
-
@jsulm move means ii have to remove splitter or move its position
-
@Qt-embedded-developer What I mean is: if you move the splitter using mouse - does your button change its size? If it does then it is in a layout (managed by splitter).
-
@jsulm yes by increasing or decreasing splitter the size of pushbutton get change .
so what i have to do to resizing it
-
@jsulm as you have replied if by moving splitter if qpushbutton moves then my pushbutton is on lay out. and so i can resize this pushbutton but my pushbutton is not get resize by writing
ui->pushbutton->resize(280,74);
-
@Qt-embedded-developer said in How to resize custom Qpushbutton at runtime ?:
yes by increasing or decreasing splitter the size of pushbutton get change .
so what i have to do to resizing itI'm not sure why you want to resize the button manually if its size is managed by the splitter?
If you want to do so, then add the button to a widget which is managed by the splitter, but do not put the button into a layout on this widget. -
thanks for you suggestions. i have solved it by putting my two button on horizontal lay out and then i put this lay out on frame
below i wrote part of code that help me to achieve answer of my question
ui->pushButton_Save_2->hide();
ui->pushButton_Save_2->setHidden(true);
ui->pushButton_Save_2->setMinimumWidth(0);
ui->pushButton_Exit_2->setText(sExit());
ui->pushButton_Exit_2->setMinimumWidth(327);
ui->pushButton_Exit_2->resize(327,74);
ui->pushButton_Save_2->setText(sCalibrationSmall());
ui->pushButton_Exit_2->show();