Results 1 to 7 of 7

Thread: user resize QGroupBoxes size dynamically with the mouse

  1. #1
    Join Date
    Nov 2010
    Posts
    142
    Thanks
    24
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default user resize QGroupBoxes size dynamically with the mouse

    In Qt Creator and many other applications which contain a lot of tools the user can resize with the mouse the size of each docked window. Is it possible to do the same with QGroupBox? For example I have a QVBoxLayout with 2 QGroupBoxes. Is it possible to let the user decide the size of each QGroupBox as he desires?
    Thanks!

  2. #2
    Join Date
    Sep 2009
    Location
    Aachen, Germany
    Posts
    60
    Thanks
    2
    Thanked 7 Times in 7 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: user resize QGroupBoxes size dynamically with the mouse

    There are several ways.
    If it's only the two QGroupBoxes you could put a QSplitter between them.
    To make the QGroupBoxes resizeable individually for more complex grid structures would mean quite a bit of work.

  3. The following user says thank you to ChiliPalmer for this useful post:

    fatecasino (4th April 2011)

  4. #3
    Join Date
    Feb 2007
    Location
    Karlsruhe, Germany
    Posts
    469
    Thanks
    17
    Thanked 90 Times in 88 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: user resize QGroupBoxes size dynamically with the mouse

    Small correction: In Qt you need to add widgets to a splitter. Not put a splitter between them, like for example in Delphi. The splitter will replace a vertical or horizontal layout depending on its orientation.

    Joh

  5. The following user says thank you to JohannesMunk for this useful post:

    fatecasino (4th April 2011)

  6. #4
    Join Date
    Nov 2010
    Posts
    142
    Thanks
    24
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: user resize QGroupBoxes size dynamically with the mouse

    QSplitter is just fantastic!!
    it just did the job
    I added 2, one horizontal and one vertical and both work great.
    thanks!

  7. #5
    Join Date
    Nov 2010
    Posts
    142
    Thanks
    24
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: user resize QGroupBoxes size dynamically with the mouse

    coming back to solve a small bug
    I used QSplitter successfully but I have a little problem..
    I cannot see the handles!
    I have to guess their position by moving the mouse over the area.

  8. #6
    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: user resize QGroupBoxes size dynamically with the mouse

    Appearance is governed by the style in use, which generally mimics the platform's native look and feel by default. You are free to style the splitter or even provide a custom QSplitterHandle.

  9. The following user says thank you to ChrisW67 for this useful post:

    fatecasino (7th February 2012)

  10. #7
    Join Date
    Nov 2010
    Posts
    142
    Thanks
    24
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: user resize QGroupBoxes size dynamically with the mouse

    Thanks! I did it. I actually added an image on the handle


    Qt Code:
    1. QApplication app(argc, argv);
    2. app.setStyleSheet("QSplitter::handle { background-color: grey }");
    3. app.setStyleSheet("QSplitter::handle { image: url(images/ss.png) }");
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Dynamically resize text
    By antialias_forum in forum Qt Quick
    Replies: 4
    Last Post: 6th May 2011, 23:37
  2. How to resize the QIcon inside QPushButton dynamically?
    By gboelter in forum Qt Programming
    Replies: 2
    Last Post: 18th February 2010, 12:34
  3. Replies: 3
    Last Post: 3rd September 2008, 16:41
  4. Dynamically resize spacing
    By trskel in forum Qt Programming
    Replies: 6
    Last Post: 28th September 2007, 11:52

Tags for this Thread

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.