Results 1 to 7 of 7

Thread: Stucked on ScrollArea

  1. #1
    Join Date
    Mar 2012
    Posts
    9
    Platforms
    Windows Symbian S60

    Question Stucked on ScrollArea

    Hello have collided with QScrollArea problem. I have 5 QPushButton's on my form, what should I do if I want to place more than 5 button's on my layout, how can I use QScrollArea, so that I can scroll layout down and see other buttons. I tried to do this:
    QScrollArea* scroll = new QScrollArea();
    QWidget* w = new QWidget();
    scroll->setWidget(w);

    But scrollbar did not appeared. Please can you show how can I solve this issue. Thanks in advance

    Qt.jpg

    Widget::Widget(QWidget *parent)
    : QWidget(parent)
    {


    this->setFixedSize(640,360);

    setAttribute(Qt::WA_LockPortraitOrientation,true);


    layout=new QVBoxLayout;
    btn1=new QPushButton("1");
    btn2=new QPushButton("2");
    btn3=new QPushButton("3");
    btn4=new QPushButton("4");
    btn5=new QPushButton("5");

    layout->addWidget(btn1);
    layout->addWidget(btn2);
    layout->addWidget(btn3);
    layout->addWidget(btn4);
    layout->addWidget(btn5);

    this->setLayout(layout);

    }

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Stucked on ScrollArea

    Set the "widgetResizable" property in the scroll area to true.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Mar 2012
    Posts
    9
    Platforms
    Windows Symbian S60

    Default Re: Stucked on ScrollArea

    Thanks, for the fast respond.
    But this didn't worked, Scrollbar did not appeared

    QScrollArea* scroll = new QScrollArea();
    scroll->setWidgetResizable(true);
    QWidget* w = new QWidget();


    scroll->setWidget(w);

    this->setLayout(layout);

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Stucked on ScrollArea

    Hmmm.... Why are you setting the layout on "this" and not on "w"?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Mar 2012
    Posts
    9
    Platforms
    Windows Symbian S60

    Default Re: Stucked on ScrollArea

    I used this in most projects, to initialize my layout if I make this w->setLayout(layout); the layout will be empty

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Stucked on ScrollArea

    I don't know what you do in most of your projects, I only know you are setting the layout on the wrong widget.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Jul 2010
    Posts
    72
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt/Embedded Qt Jambi
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Stucked on ScrollArea

    Hi,
    I have similar problem: on custom QGraphicsView I add QGraphicsScene and put to the screen multiple custom items such that I expect my QGraphicsView scolls to see all the items, but they does not. I set ScrollBarAlwaysOn. I see scrollbars, but they doesn't updated. The same set QTreeView does update on scroll, but QGraphicsView doesn't. See video example attached:
    https://www.box.com/s/mhumghw4ad3nlj5ttl83

Similar Threads

  1. Replies: 1
    Last Post: 13th May 2011, 09:20
  2. scrollArea
    By skizzik in forum Qt Programming
    Replies: 1
    Last Post: 12th January 2011, 13:55
  3. Autoscroll in ScrollArea
    By BalaQT in forum Qt Programming
    Replies: 2
    Last Post: 26th October 2009, 06:37
  4. scrollArea not updating
    By user in forum Qt Programming
    Replies: 9
    Last Post: 3rd October 2007, 09:17
  5. QFileDialog::getOpenFileName() gets stucked
    By elcuco in forum Qt Programming
    Replies: 5
    Last Post: 29th March 2006, 00:09

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.