Results 1 to 3 of 3

Thread: Shape changing under other tab using slider/spinbox

  1. #1
    Join Date
    Aug 2007
    Location
    Ontario, Canada
    Posts
    22
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Shape changing under other tab using slider/spinbox

    Hi there,

    I just joined the site, I am pleased there are forums for Qt developers. I am sure I will glean much from these boards. Hopefully someone can point me in the right direction as this is the first time I have programmed using a GUI toolkit.

    What I am trying to accomplish is a shape changing dialog. My main window and tab accepts input from the user via a spin box/slider that are connected together. Based on that value (linked between the spin box and slider) which is limited between 0-8, I need 0-8 groups of input boxes/labels to show on another tab within the program, depending of course on the previous input from the other tab.

    I have the book C++ GUI Programming with Qt 4 but unfortunately the only shape shifting windows are only toggled via a boolean value. This is a little more complex. I understand the signals/slots/connections, but I am puzzled as to how to accomplish this with my little experience.

    If anyone has suggestions or a link to an example I would appreciate it. If I did not present enough information about what I am trying to accomplish, please let me know. I appreciate your time.

    Mark

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Shape changing under other tab using slider/spinbox

    I think "shape-changing" is a bit too much said.
    You only have to connect QSpinBox::valueChanged or QAbstractSlider::sliderChanged to some slot that handles those 8 widget groups( maybe you can use QGroupBox? ).

    What you have to do is: create and layout all group boxes and hide the las 7 of them( considering the initial slider value is 1 ).

    Next, when the user drags the slider or changes the spin box value, in the slot connected the changed signal you have to show the corresponding groups( or all of them up until that value ).
    If you create the layout(s) correctly, the tab widget will resize itself.

    Regards

  3. #3
    Join Date
    Aug 2007
    Location
    Ontario, Canada
    Posts
    22
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Shape changing under other tab using slider/spinbox

    Thanks a ton Marcel. I got it working. Its ugly code but its working.

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.