[solved] resize the screen
-
I want to delete a table if the width is smaller than 500
translate
if the user resizes the screen then
in Qt -
What do you mean by delete a table? Do you mean like hide the widget or remove it from the layout entirely?
To hide it you can just use:
@
myTable->hide();
@To find when your window is resizing just override QWidget::resizeEvent(). That will let you find new sizes so when it goes below the "500" you are concerned with you can then hide the table or whatever you need to do.
-
Thank you so much!
@int width = this->width(); int height = this->height(); QString s_widht = QString::number(width); QString s_height = QString::number(height); ui->lineEdit_widht->setText(s_widht); ui->lineEdit_height->setText(s_height);@
I want whenever I resize the width and height appears
-
Well that code would work, just add it to your MyWidget::resizeEvent(...) function, like so:
@
// header
class MyWidget : public QWidget
{
// ...
protected:
void resizeEvent(QResizeEvent *event);
};// implementation
void MyWidget::resizeEvent(QResizeEvent *event)
{
ui->lineEdit_widht->setText(event->size().width());
ui->lineEdit_height->setText(event->size().height());
}
@ -
Thank you so much ambershark :)
-
Looks good, glad it worked. :) Make sure to add [solved] to the thread title.
-
done :)