QIcon set default size



  • Hey guys,

    after setting the iconsize via "setIconSize(QSize(screenY/30, screenY/30));", I would like to set it back to default.

    Any idea how to?

    Thanks in advance!



  • Hi,

    you can store the old values and restore them later

    class MyWindow: public MainWindow
    {
    ....
    private:
        QSize _originalSize;
    };
    
    void MyWindow::changeIconSize() 
    {
        _originalSize = iconSize();
        setIconSize(...);
    }
    
    void MyWindow::restoreSize()
    {
        setIconSize(_originalSize);
    }
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.