If this is your first visit, be sure to
check out the
FAQ
by clicking the
link above. You may have to
register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.
Welcome to
Qt Centre
.
Qt Centre
is a community site devoted to programming in C++ using the
Qt framework
. Over 90 percent of questions asked here gets answered. If you are looking for information about Qt related issue —
register
and post your question.
You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our
free
community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please,
join our community today
!
If you have any problems with the registration process or your account login, please
contact us
.
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
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.
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.
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
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
the problem is that apparently the layout is at the bottom of ScrollArea, because it looks like the image is:
graficas.jpg
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);