I am using Qt 3.3.5 and trying to emulate how the Acrobat PDF viewer works i.e. to view thumbnails of a document loaded.
The enclosed attachment details the layout I need.
Scenario
I have a 'MainWindowBase' in which I :
- created 2 toolbars, one on top, and a left toolbar.
- The main window loads a 'document' which I can navigate just like Acrobat. All this works fine.
I want to add:
A column (QListBox) to the left of the document, this will contain the thumbnails of the document (a la Acrobat viewer).
Code
I can't see QWidget lsited under 'Containers'in my QtDesigner, hence I am creating one at runtime. My code is as follows:
// ListBox for thumbnail sidebar
QListBox *thbNailListBox = new QListBox();
//thbNailListBox->setEnabled(true);
//thbNailListBox->setGeometry(10,10,50,100);
mainHLayout->add(thbNailListBox);
mainHLayout->addWidget(documentView); // documentView is the 'Document' object
setCentralWidget ( mainWidget );
QWidget *mainWidget = new QWidget;
QHBoxLayout* mainHLayout = new QHBoxLayout( mainWidget, 25, 0);
// ListBox for thumbnail sidebar
QListBox *thbNailListBox = new QListBox();
//thbNailListBox->setEnabled(true);
//thbNailListBox->setGeometry(10,10,50,100);
mainHLayout->add(thbNailListBox);
mainHLayout->addWidget(documentView); // documentView is the 'Document' object
setCentralWidget ( mainWidget );
To copy to clipboard, switch view to plain text mode
Problem
- I don't see the QListBox and the 'documentView' is not visible at the extreme top left corner
- While using QHBoxLayout, to view the toolbars I need to put spacing = 25, if not the toolbars are covered by the mainWidget
- But using spacing = 25, makes the window look ackward as there is an extra spacing of 25 on the right as well as bottom of the main window
- How can I add a QWidget to the QtDesigner?
Could anyone suggest how best I can go about with this.
Any pointers will be appreciated.
Thanks,
Bookmarks