Search code examples
c++qtqwidget

Changing width of QWidget with mouse


I have two QWidgets inside a QHBoxLayout. I want to be able to change the width of the left QWidget by clicking on its right side and moving mouse (such as the Qt Editor's projects browser).


Solution

  • You can do exactly what you want by using QSplitter. You can find a complete example here: https://stackoverflow.com/a/38433287/4297146