0

I have a listview filled with items. By default, the 0th item will be selected.

If I try to navigate the list using the mobile keypad, it's not gaining focus - instead I need to use my mobile select key for focus. In this process my mobile left soft key gets changed to “Done”. Why is the "Done" menu appearing?

How do I provide default focus to the listview? And how do I avoid the display of “Done” at left soft key?

Here is my code:

#include "Test_Doco.h"

#include <QtGui>
#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QListView *listui = new QListView();
    listui->setSelectionMode(QAbstractItemView::SingleSelection);

    listui->viewport()->setFocusPolicy(Qt::WheelFocus);
    listui->viewport()->setFocus();

    QStandardItemModel* listModel = new QStandardItemModel(); 

    for(int i =0; i<10;i++)
            {
                QStandardItem *item1 = new QStandardItem("AOL");
                listModel->appendRow(item1);
            }
         QModelIndex index = listModel->index(0,0);
        listui->setCurrentIndex(index);


    listui->setModel(listModel);
    listui->showMaximized();

        return a.exec();
}

Edit: I have updated the code. Please check it.

JavaAndCSharp
  • 1,507
  • 3
  • 23
  • 47
Naruto
  • 9,476
  • 37
  • 118
  • 201

2 Answers2

0

For the default focus, stop calling listui->viewport()->setFocus(); and call listui->setFocus() to give it focus when it is created.

As for the display of "Done", I'm not too sure, but you might need to post more code to show the dialog you are creating. Most have a set of default buttons or a button set to default. The "Done" key might be related to that. As seen here "Exit" is the softkey shown.

Adam W
  • 3,648
  • 22
  • 18
  • Hi, thanks i have updated the code, please see the above code by placing in your editor, where am i missing please tell.. – Naruto Jul 06 '10 at 13:41
  • Oh, you aren't using a dialog, you just have the widget. I forgot that is common for mobile devices. What happens when you click "Done"? – Adam W Jul 06 '10 at 15:27
  • Thanks for showing interest on this issue, one good news i would like to say, its a known issue in Qt 4.6.2 and the issue is fixed in new version of Qt i.e Qt 4.6.3.. Thanks again, have a wonderful evening – Naruto Jul 07 '10 at 12:54
0

The issue is w.r.t Qt 4.6.2 and the issue is fixed in Qt 4.6.3

Naruto
  • 9,476
  • 37
  • 118
  • 201