Second Window doesnt open properly while executing it displays and the fraction of seconds its again closed
-
I have the Warning message like this
QWidget::setLayout: Attempting to set QLayout "" on MainWindow "MainWindow", which already has a layout -
@sankarapandiyan
For the error message, aQMainWindow
already has a layout, you're duplicating that with yoursetLayout(layout1);
. Try using the existingQMainWindow::layout()
.Do the
popup_progress->setMaximum(10);
before thepopupPB->start(1000);
.I don't understand why you are going
timer->stop();
as soon as you start it? For what you want, thestop()
should be inSetValueProgress()
when it has reached the maximum.I don't understand why you have 2
QTimer
s. Again, from our discussion of this in your other thread you should only have one timer.I don't know how all this related to your thread title, but start by getting the code all right and have a look again from there.
Incidentally, I don't know whether you want to display your progress bar on the main window, but be aware that Qt has a https://doc.qt.io/qt-5/qprogressdialog.html
QProgressDialog
class, which pops up a separate dialog with a progress bar. This is the way many people would handle a progress bar. -
@sankarapandiyan said in Second Window doesnt open properly while executing it displays and the fraction of seconds its again closed:
setLayout(layout1);
Here you definitly try to set the created layout to the current window - this is what @JonB said above. If you want another dialog, create a new QDialog or QWidget
-
@sankarapandiyan said in Second Window doesnt open properly while executing it displays and the fraction of seconds its again closed:
@JonB No I want to display on another Window
It would be really nice if you tried following the whole load of suggestion instead of just this answer...
And if you do want to "display on another Window" did you think about the
QProgressDialog
? -
This post is deleted!
-
@Christian-Ehrlicher sure thanks
-
@sankarapandiyan said in Second Window doesnt open properly while executing it displays and the fraction of seconds its again closed:
Yes i know , we dnt want a another window its automatically created
QProgressdialogFair enough. Ignore that bit, but start by changing code as per the other suggestions.