Results 1 to 20 of 40

Thread: attach more widgets to a QScrollArea

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    694
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default attach more widgets to a QScrollArea

    Hi to all,
    I'm able to attach a widget to a scrollarea. I would know if it's possible to attach more than one qwidget to the same scrollarea.
    So when I move the scrollbar, both widgets should be moved.

    I tried with this code:
    Qt Code:
    1. /* scroll area */
    2. QScrollArea* sa = new QScrollArea( this );
    3. sa->setWidgetResizable( true );
    4. sa->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
    5. sa->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
    6.  
    7. QScrollBar *scrollBar = sa->horizontalScrollBar();
    8.  
    9. m_WaveDisplay = new WaveDisplay; //QWidget
    10. m_TimeDisplay = new TimeWidget; //QWidget
    11.  
    12. sa->setWidget(m_TimeDisplay);
    13. sa->setWidget(m_WaveDisplay);
    14.  
    15. QVBoxLayout* layout = new QVBoxLayout();
    16. layout->addWidget( sa );
    17.  
    18. ..more code..
    To copy to clipboard, switch view to plain text mode 

    but I get a crash when the application starts.
    Maybe is not possible?

    Best
    Last edited by franco.amato; 14th January 2010 at 17:34.
    Franco Amato

Similar Threads

  1. Adding widgets to QScrollArea
    By ser_bur in forum Qt Programming
    Replies: 6
    Last Post: 19th August 2013, 10:38
  2. QSharedMemory won't attach
    By MattPhillips in forum Qt Programming
    Replies: 3
    Last Post: 27th November 2009, 15:45
  3. Replies: 2
    Last Post: 10th March 2008, 20:16
  4. QScrollArea With Custom Widgets
    By VireX in forum Qt Programming
    Replies: 30
    Last Post: 22nd April 2007, 16:48

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
  •  
Qt is a trademark of The Qt Company.