unchanged positions of controls in main window
-
I have a windows mainwindow.ui that contains a number of controls. I changed positions of controls in the window. After I compiled my project I run it and I see main window with previous positions of controls (they are unchanged). What could be a reason new position are not visible?
Please help. I use Qt5 and Qt Creator 6.0.1. -
I have a windows mainwindow.ui that contains a number of controls. I changed positions of controls in the window. After I compiled my project I run it and I see main window with previous positions of controls (they are unchanged). What could be a reason new position are not visible?
Please help. I use Qt5 and Qt Creator 6.0.1.@Robert-M Do you use layouts? Usually you should not position widgets manually.
Try a complete rebuild: delete build folder, run qmake and build. -
@Robert-M Do you use layouts? Usually you should not position widgets manually.
Try a complete rebuild: delete build folder, run qmake and build. -
@Robert-M You still did not say whether you're using layouts.
-
@Robert-M Well, it should work.
Did you save the file after changing the positions of the widgets?
Is this ui file really used? -
@Robert-M Well, it should work.
Did you save the file after changing the positions of the widgets?
Is this ui file really used?@jsulm
I failed to solve my problem using layouts. And I think I don't need a layout in my main window - my problem is simple.
I continue previous approach.
I have a text box and labeled button below text box.
I defined method:void MainWindow::resizeEvent(QResizeEvent *event)
{
int delta = event->size().height() - event->oldSize().height();
QMainWindow::resizeEvent(event);
// ui->command_text->resize(this->width() - 40, ui->command_text->height() + delta);
ui->label_2->move(ui->label_2->x(), ui->label_2->y() + delta);
ui->pushButton_obfuscate->move(ui->pushButton_obfuscate->x(), ui->pushButton_obfuscate->y() + delta);
}The problem is that in my program with this method I don't see labeled button on the screen - only text box is displayed. I don't know why - what is wrong with my method. Please help to correct resizeEvent method's code - this would solve my problem.
-
@jsulm
I failed to solve my problem using layouts. And I think I don't need a layout in my main window - my problem is simple.
I continue previous approach.
I have a text box and labeled button below text box.
I defined method:void MainWindow::resizeEvent(QResizeEvent *event)
{
int delta = event->size().height() - event->oldSize().height();
QMainWindow::resizeEvent(event);
// ui->command_text->resize(this->width() - 40, ui->command_text->height() + delta);
ui->label_2->move(ui->label_2->x(), ui->label_2->y() + delta);
ui->pushButton_obfuscate->move(ui->pushButton_obfuscate->x(), ui->pushButton_obfuscate->y() + delta);
}The problem is that in my program with this method I don't see labeled button on the screen - only text box is displayed. I don't know why - what is wrong with my method. Please help to correct resizeEvent method's code - this would solve my problem.
-
@Robert-M
The code without this method shows labeled button.
When I added this method, the labeled button is not displayed.
In this method I want to move the labeled button down/up depending on resizing main window.@Robert-M Did you check the value of delta? Maybe it is too big?
-
@jsulm
Bingo!
delta == 279
But I don't know why - I have a problem with debuuger now and I can't watch .height()
How to program it?:
int delta = event->size().height() - event->oldSize().height();