Hi all, Please bear with my English.
I have some problems with qscrollview and I need you guys help. I'm trying to add a scroll bar to my main image window. Please find my code as following: In the mainw::qmainwidow class: ====================== ... sv = new QScrollView(this); setCentralWidget(sv); sv->setResizePolicy(QScrollView::AutoOneFit); QVBox* vb = new QVBox(sv->viewport()); sv->addChild(vb); ws = new QWorkspace(vb); ws-> setScrollBarsEnabled(TRUE); sv->addChild(vb); In main: ===== I need to use xlib code to draw the image, so I get the winId of the ws (the QWorkspace) here, and draw the image on it. (it works fine) The problem: ========= The scroll bar shows in the main window, covers the whole window and resize along the window, But the scroll bar cann't cover the whole image, for example, my window size is 500*500, image size is 800*800, I ran the program, the image shows in the window with H and V scroll bars, I slide the scroll bars till the very end, but only about 600*600 of the image can only be shown. The whole image can't be shown unless I maximum the window. How can I let the whole image shown without resizing the window? (Just sliding the scroll bars) Thank you for reading till this line. And thank you for any input. Jane
