I'm using this on my program to call new windows, but there is a problem... I close the actual window and call a new one. It works, but the icon on the task bar vanishes so my application is "floating" on the desktop, what could be happening?
I'm using this on my program to call new windows, but there is a problem... I close the actual window and call a new one. It works, but the icon on the task bar vanishes so my application is "floating" on the desktop, what could be happening?
Please describe your problem better. Possibly with a piece of code or a screenshot.
MM ok...
I have 2 classes...
Window1.h
Window1.cpp
Window2.h
Window2.cpp
The program starts and Window1 shows up just fine...
Then using this code
in Window1.h
#include Window2.h
public slots:
void openwindow2();
private:
Window2 * window2win;
private slots:
void on_button_clicked();
in Window1.cpp
void Window1:n_button_clicked(){
openwindow2();
}
void Window1:penwindow2(){
close(); //closes current window
window2win = new Window2 (this);
window2->show(); //shows the new window but it doesn't appear on task bar...
}
Look:
I click on "codigos de ejemplo" and the new window shows up but the icon dissapears once the previous window closes... lol...
![]()
Only parent-less QWidgets become windows, and only top-level windows get a task bar presence. Make window2 parent-less and then worry about memory deallocation (Qt::WA_DeleteOnClose).
And have you thought about using QStackedWidget? Thus you don't have to close() and hide() your windows and can stay with one main window.
Bookmarks