Results 1 to 3 of 3

Thread: Port inherited QScrollView which contains custom widgets to Qt4

  1. #1
    Join Date
    May 2008
    Posts
    2

    Question Port inherited QScrollView which contains custom widgets to Qt4

    I'm in the process of a Qt 3 to Qt 4 port and ran into the following issue:
    In Qt3 we're sublcassing from QScrollView and overriding the addChild, removeChild and drawContents methods in order to populate the Scroll View with custom widgets. These custom widgets are usually fairly simple consisting of a label and another widget (QLineEdit, QSpinBox, QRadioButtonGroup, etc.) The widgets on the custom widgets are laid out horizontally and then the custom widgets themselves are laid out vertically. It roughly looks something along these lines:

    Label1 RadioButton1
    Label2 LineEdit2
    Label3 RadioButton3
    ...
    etc.

    Each pair of widgets above constitutes a custom widget itself

    I am looking to preserve the same look and similar ability to call an addChild(QWidget * customWidget) in order to add or remove items to this container. I also need to be able to get back the number of custom widgets in the container and a way to iterate through the widgets.

    How would I go about doing this without the Qt3 Support library in Qt4?

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Port inherited QScrollView which contains custom widgets to Qt4

    In Qt 4 you would construct and install a layout on a plain QWidget and set that widget inside the scroll area with QScrollArea::setWidget().
    J-P Nurmi

  3. #3
    Join Date
    May 2008
    Posts
    2

    Default Re: Port inherited QScrollView which contains custom widgets to Qt4

    Quote Originally Posted by jpn View Post
    In Qt 4 you would construct and install a layout on a plain QWidget and set that widget inside the scroll area with QScrollArea::setWidget().
    Thank you. How would I go about getting the count of the number of widgets in the layout and subsequently getting an iterator for them?

Similar Threads

  1. picking geometry in qt custom widgets
    By notsonerdysunny in forum Qt Programming
    Replies: 2
    Last Post: 18th July 2007, 00:01

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.