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 successfully load an image in QGraphicsView.
However, I'd love to show it without scrolling bar because I can ensure the size of the image is just equal to the size of the Widget view (I'm using the widget QGraphicsView).
But, it seems whenever I tried to load an image, the scroll bar will automatically jump out to show "I(the scroll bar )'m here". How can I disable this scroll bar?
An image is attached and the red curves show the scroll bar which is not what I expected.
Before I load an image (or image sequence), there is no such kind of bar.
Best Regards
JIA Pei
this->setHorizontalScrollBarPolicy ( Qt::ScrollBarAlwaysOff );
this->setVerticalScrollBarPolicy ( Qt::ScrollBarAlwaysOff );
this->setHorizontalScrollBarPolicy ( Qt::ScrollBarAlwaysOff );
this->setVerticalScrollBarPolicy ( Qt::ScrollBarAlwaysOff );
To copy to clipboard, switch view to plain text mode
in the class constructor of my own class CqtImageView, which inherits from QGraphicsView.
class CqtImageView : public QGraphicsView
Unfortunately, things become even worse.
This time, before loading an image (sequence), the view already shows the scroll bar !!
So, really, have you got any demo code for this issue?
Best Regards
Hi jiapei100!
I'm a newbie in Qt but I've read enough articles in order to efficiently remove scroll bars.
In my main class I have set the main window to occupy the whole screen as soon as the application start using the following code, mainWindow is my widget:
mainWindow.showFullScreen(); // in this case no scroll bars will appear because the app's window is already in full screen, no need to rebuild again and again
Then in my implementation file I have done this:
ui->graphicsView->setSceneRect(this->frameGeometry()); // set the scene's bounding rect to rect of mainwindow
ui->graphicsView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysO ff);
ui->graphicsView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff );