views:

70

answers:

2

Hi all,

I am having an listview filled with the items, by default the 0th item will be selected. If I try to navigate the list using mobile keypad its not gaining focus, instead i need to use my mobile select key for focus. In this process my mobile left soft key gets change do “Done” I don’t know why this “Done” menu is appearing in my mobile soft Key..

How to provide default focus to listview? And how to avoid display of “Done” at left soft key. Here is the peace of sample 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();
}

i have updated the code, please check it

A: 

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
Hi, thanksi have updated the code, please see the above code by placing in your editor, where am i missing please tell..
Shadow
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
@Adam, 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
Shadow
A: 

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

Shadow