This problem was solved in Qt 5.2. The cute solution is:
QSizePolicy sp_retain = widget->sizePolicy();
sp_retain.setRetainSizeWhenHidden(true);
widget->setSizePolicy(sp_retain);
http://doc.qt.io/qt-5/qsizepolicy.html#setRetainSizeWhenHidden
More Related Contents:
- Qt Layout on QMainWindow
- Which yocto is best for me
- Porting C++ Builder to Qt [closed]
- How to make item view render rich (html) text in Qt
- Qt Stylesheet for custom widget
- Draw Rectangular overlay on QWidget at click
- How delete and deleteLater works with regards to signals and slots in Qt?
- How to set application’s taskbar icon in Windows 7
- How to Include OpenSSL in a Qt project
- How to build Qt 4.8/5.2 statically under VS2012, using the static MSVC runtime, with Windows XP support?
- Access sqlite from a remote server
- Understanding form layout mechanisms in Qt
- QListView/QListWidget with custom items and custom item widgets
- How to make a column in QTableWidget read only?
- Add a define to qmake WITH a value?
- Why does calling quit() before exec() not quit the application?
- QListView takes too long to update when given 100k items
- run apps using audio in a docker container
- How do i resize the contents of a QScrollArea as more widgets are placed inside
- How to get STDOUT from a QProcess?
- Why should nesting of QEventLoops be avoided?
- Why do stylesheets not work when subclassing QWidget and using Q_OBJECT?
- How to tell QWebPage not to load specific type of resources?
- Running a program/script from QMake
- How to create scrollbar in QtQuick 2.0?
- How to create a round mouse area in QML
- PyQt5 and QtGui module not found
- How to build the Qt-SQL-driver-plugin ‘QSQLCIPHER’ for SQLite-DB with SQLCipher-extension using the Windows/MinGW-platform?
- How to drop a custom QStandardItem into a QListView
- How to execute shell command after compile finished from .pro in QT?