Hi,
I'm redesigning my UI to make use of the new Maemo5 buttons etc and thought I'd start by taking the picklist example (http://qt.nokia.com/doc/qt-maemo-4.6...kselector.html) and modifying it to use a QMainWindow.
The original code compiles and runs fine.
creating a class thus:
class MainWindow : public QMainWindow {
Q_OBJECT
public:
MainWindow(QWidget *parent = 0);
....
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent)
{
/// Test example
QStandardItemModel model(0, 1);
populateListModel(&model);
QVBoxLayout *layout = new QVBoxLayout;
QMaemo5ValueButton *button3 = new QMaemo5ValueButton("Value besides text");
button3->setValueLayout(QMaemo5ValueButton::ValueBesideText);
QMaemo5ListPickSelector *selector1 = new QMaemo5ListPickSelector;
selector1->setModel(&model);
// not setting the current index means that the value is empty.
//selector1->setCurrentIndex(1);
button3->setPickSelector(selector1);
layout->addWidget(button3);
button3->show();
}
Results in a window with no content but a title bar. using setLayout(layout) fails as QMainWindow has a defined layout.
Setting it up as a QDialog based class results in a small (half screen window) with no content.
Defining a new central QWidget thus...
QWidget *mainMan = new QWidget(this);
QMainWindow::setCentralWidget( mainMan);
QStandardItemModel model(0, 1, mainMan);
populateListModel(&model);
QVBoxLayout *layout = new QVBoxLayout (mainMan);
QMaemo5ValueButton *button3 = new QMaemo5ValueButton("Value besides text");
button3->setValueLayout(QMaemo5ValueButton::ValueBesideText);
QMaemo5ListPickSelector *selector1 = new QMaemo5ListPickSelector;
selector1->setModel(&model);
// not setting the current index means that the value is empty.
//selector1->setCurrentIndex(1);
button3->setPickSelector(selector1);
layout->addWidget(button3);
mainMan->setLayout(layout);
mainMan->show();
Results in the button being displayed fine but when selected displays a half size empty window rather than a pick list. I've tried to set the parent on the ValueButton and PickSelector but this has no effect.
This may be my ignorance on the window relationships or on QT generally but help and comment much appreciated. Advice on how to add a set of stacked windows with defined child widgets in each would be appreciated as, again, using the canned example doesn't work in the above MainWindow class definition even trying to be careful with parent/child relationships.
BR David

Reply With Quote


