H, clug talk,
I wrapped my xlib code into QWidget subclass to show an image which
generated through Xlib.
The image can be displayed in the Qt window successfully now, What I want
to do is add a scroll bar to the window.
The following are my code for scroll bar,
class PixmapView : public QScrollView
{
public:
PixmapView (QWidget* parent) : QScrollView(parent)
{
setVScrollBarMode (QScrollView :: AlwaysOn);
}
};
int main()
{
App a(argc, argv);
Board b; //board is my qwidget, shows the menu bar, and my image will
be shown in board too
a.setMainWidget(&b);
PixmapView *scrollView = new PixmapView(&b);
QVBoxLayout *vbox = new QVBoxLayout(&b);
vbox ->addWidget (scrollView);
vbox ->activate();
...
b.show();
return a.exec();
}
The problem is, if the scroll bar shows in the Qt window, the whole image
will be obscured by the QVBoxLayout
Would you guys please give me any idea?
Thanks a looot!
Jane