×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    118

    about QMaemo5ListPickSelector

    QStandardItemModel *testmodel = new QStandardItemModel(this);
    for (int i = 0; i < 50; ++i)
    {
    testmodel->appendRow(new QStandardItem(QIcon::fromTheme("chat_smiley_happy"), tr("Item number %1").arg(i+1)));
    }
    QMaemo5ListPickSelector *listpicker = new QMaemo5ListPickSelector();
    listpicker->setModel(testmodel);
    there will be a list dialog when i press a maemo5Button,

    but i want use a multi-ply chose list. what shall i do?

  2. #2
    Registered User
    Join Date
    Sep 2009
    Posts
    24

    Re: about QMaemo5ListPickSelector

    Quote Originally Posted by fily_love View Post
    but i want use a multi-ply chose list. what shall i do?
    if Ive got your question right, you could use a table model for your value list.
    there is a good example here

  3. #3
    Nokia Developer Moderator
    Join Date
    Oct 2009
    Posts
    4,326

    Re: about QMaemo5ListPickSelector

    You can enable multiple selection in list view, but of course you cannot show multiple choices in value button.

    Code:
    #include <QtGui>
    #include <QtMaemo5>
    
    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
    
        QStandardItemModel model(0, 1);
        for (int i = 0; i < 50; ++i) {
           model.appendRow(new QStandardItem(QString("Item number %1").arg(i+1)));
        }
    
        QListView *view = new QListView();
        view->setEditTriggers(QAbstractItemView::NoEditTriggers);
        view->setModel(&model); // set the model in order to get correct column widths
        view->setSelectionBehavior(QAbstractItemView::SelectRows);
        view->setSelectionMode(QAbstractItemView::MultiSelection);
    
        QMaemo5ListPickSelector *selector1 = new QMaemo5ListPickSelector;
        selector1->setModel(&model);
        selector1->setModelColumn(0);
        selector1->setView(view); // set our new custom view
        selector1->setCurrentIndex(0);
    
        QMaemo5ValueButton *button1 = new QMaemo5ValueButton("Value centered under text");
        button1->setValueLayout(QMaemo5ValueButton::ValueUnderTextCentered);
        button1->setPickSelector(selector1);
    
        QWidget toplevel;
        QVBoxLayout *layout = new QVBoxLayout(&toplevel);
        layout->addWidget(button1);
    
        toplevel.show();
    
        return app.exec();
    }

Similar Threads

  1. Picklist example as application
    By davidmct in forum Nokia N9
    Replies: 7
    Last Post: 2010-03-08, 14:31

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •