kw
17th March 2006, 02:15
Hi,
I have a custom widget which I want to place into a QScrollArea, which in turn goes on to a QMainWindow. This is done in a few examples, and I think my code pretty much matches theirs, but I don't seem to get the scroll bars when I resize my window. I am using a QLabel with an image in it for testing. The code in my mainwindow constructor is:
label = new QLabel;
QString fileName = QFileDialog::getOpenFileName(this,
tr("Open File"), QDir::currentPath());
QImage image(fileName);
label->setPixmap(QPixmap::fromImage(image));
scroll = new QScrollArea;
scroll->setWidget(label);
setCentralWidget(scroll);
Any advice or ideas what Im doing wrong?
The image is displayed on the label, but when I resize the main window to something smaller than the image, no scrollbars appear.. Where am I going wrong? Do I need additional code?
Thx in advance,
kw
I have a custom widget which I want to place into a QScrollArea, which in turn goes on to a QMainWindow. This is done in a few examples, and I think my code pretty much matches theirs, but I don't seem to get the scroll bars when I resize my window. I am using a QLabel with an image in it for testing. The code in my mainwindow constructor is:
label = new QLabel;
QString fileName = QFileDialog::getOpenFileName(this,
tr("Open File"), QDir::currentPath());
QImage image(fileName);
label->setPixmap(QPixmap::fromImage(image));
scroll = new QScrollArea;
scroll->setWidget(label);
setCentralWidget(scroll);
Any advice or ideas what Im doing wrong?
The image is displayed on the label, but when I resize the main window to something smaller than the image, no scrollbars appear.. Where am I going wrong? Do I need additional code?
Thx in advance,
kw