Results 1 to 5 of 5

Thread: close() and show()->newwindow problem

  1. #1
    Join Date
    Jan 2012
    Posts
    15
    Qt products
    Qt3
    Platforms
    Windows

    Default close() and show()->newwindow problem

    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?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: close() and show()->newwindow problem

    Please describe your problem better. Possibly with a piece of code or a screenshot.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jan 2012
    Posts
    15
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: close() and show()->newwindow problem

    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...




  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: close() and show()->newwindow problem

    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).

  5. #5
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: close() and show()->newwindow problem

    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.

Similar Threads

  1. midi child does not close when I call close()
    By qlands in forum Qt Programming
    Replies: 7
    Last Post: 29th July 2011, 22:25
  2. QT application not close after close the mainwindow
    By artome in forum Qt Programming
    Replies: 1
    Last Post: 22nd July 2011, 22:23
  3. Replies: 2
    Last Post: 17th December 2010, 19:01
  4. There Signal Close or Show in MainWindow??
    By macgayver in forum Qt Programming
    Replies: 1
    Last Post: 26th August 2010, 05:35
  5. problem with show Chinese
    By osmanthus in forum Qt Programming
    Replies: 1
    Last Post: 20th January 2009, 02:49

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.