Results 1 to 8 of 8

Thread: scroll in QFrame

  1. #1
    Join Date
    Jul 2012
    Posts
    27
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default scroll in QFrame

    hi

    I have a QFrame inside this I have a QHBoxLayout within this HBox I have several QVBoxLayout containing (among other things) a QGraphicsView. the problem is that when I add many VBox scrollBar but does not appear that overlays the images.

    How I can do to bring up the scroll of the HBox or QFrame?

    thanks

  2. #2
    Join Date
    Jun 2012
    Posts
    173
    Thanks
    48
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: scroll in QFrame

    if i understand you issue right, all u need is to use QScrollArea not a Qfram.

  3. #3
    Join Date
    Jul 2012
    Posts
    27
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: scroll in QFrame

    try using the ScrollArea, but the result was the same. Although I say explicitly showing the scrolling so

    scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysO n);

    but the bar is turned off.


    Added after 4 minutes:


    no way to add a scrollbar to a QHBoxLayout?? the problem is that this object will grow dynamically during execution.
    Last edited by jackajack01; 2nd August 2012 at 21:09.

  4. #4
    Join Date
    Jun 2012
    Posts
    173
    Thanks
    48
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: scroll in QFrame

    the QcrollArea suppose to show the scroll bar .... are you sure you are adding your objects to the scrollArea ??

    play with the scorllArea and put punch of objects in it and make it small so u can see, when the scroll will show


    Added after 8 minutes:


    the bar will not show on unless you have more objects than what the area can display.
    Last edited by jesse_mark; 2nd August 2012 at 23:37.

  5. #5
    Join Date
    Jul 2012
    Posts
    27
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: scroll in QFrame

    I know that, if the object is within the area is small scroll the scroll bar will not display.

    within the ScrollArea I have a QHBoxLayout, which grows dynamically. within this HBox I can have one or more QGraphicsView, each QGraphicsView has its own scroll bar. The problem is that instead of scroll bar appears when there are many within the HBox QGraphicsView overlap the Qgraphics.

    so I have the class constructor

    ViewGraphics::ViewGraphics()
    {
    scroll = new QScrollArea();
    layerH = new QHBoxLayout(this);
    layerV = new QVBoxLayout(this);
    toolBar = new QToolBar("graphic");

    button = new QAction(QIcon(":/images/registro.ico"),tr("&Example"), this);
    button->setStatusTip(tr("Change palette"));
    connect(button, SIGNAL(triggered()), this, SLOT(ChangePalette()));

    toolBar->addAction(button);

    layerV->addWidget(toolBar);

    layerV->addLayout(layerH);

    scroll->setLayout(layerV);

    this->setWidget(scroll);
    }

    and in another method insert elements in the layerH

    This class inherits from QDockWidget
    Last edited by jackajack01; 3rd August 2012 at 15:49.

  6. #6
    Join Date
    Jun 2012
    Posts
    173
    Thanks
    48
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: scroll in QFrame

    sorry, but i didn't understand what you are trying to do here....

    so, why don't you try using the Qt Designer in Qt Creator, then run to see if the result is what you want.

    then if you don't want to use the Qt Designer to create your form, go to the build directory and you will find Ui.XXXX.h and see how you should layout your elements

  7. #7
    Join Date
    Jul 2012
    Posts
    27
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: scroll in QFrame

    the problem is that apparently the layout is at the bottom of ScrollArea, because it looks like the image is:

    graficas.jpg

  8. #8
    Join Date
    Jul 2012
    Posts
    27
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: scroll in QFrame [solved]

    I solved the problem as follows:

    instead of putting the layout directly in the ScrollArea, create a QWidget on which I put the layout QWidget and this is what I put in the ScrollArea.

    the code is as follows:

    ViewGraphics::ViewGraphics()
    {
    scroll = new QScrollArea(this);
    widget = new QWidget(scroll);
    layerH = new QHBoxLayout();
    layerV = new QVBoxLayout(widget);
    toolBar = new QToolBar("graphic");

    button = new QAction(QIcon(":/images/registro.ico"),tr("&Example"), this);
    button->setStatusTip(tr("Change palette"));
    connect(button, SIGNAL(triggered()), this, SLOT(ChangePalette()));

    toolBar->addAction(button);

    layerV->addWidget(toolBar);

    layerV->addLayout(layerH);

    widget->setLayout(layerV);

    scroll->setWidget(widget);

    this->setWidget(scroll);

    }

Similar Threads

  1. Scroll bars in scroll area not comming in scroll area
    By aurora in forum Qt Programming
    Replies: 3
    Last Post: 4th January 2012, 07:50
  2. Scroll bars in scroll area not comming
    By aurora in forum Qt Programming
    Replies: 3
    Last Post: 27th December 2011, 20:56
  3. QDial disabling key scroll and mouse wheel scroll
    By ldg20 in forum Qt Programming
    Replies: 2
    Last Post: 3rd June 2010, 00:05
  4. Replies: 0
    Last Post: 28th December 2009, 13:24
  5. Replies: 6
    Last Post: 14th April 2006, 06:39

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.