请让我知道它是否是一种功能行为

发布于 2024-09-08 00:33:50 字数 1024 浏览 6 评论 0原文

我有一个充满项目的列表视图。默认情况下,将选择第 0 项。

如果我尝试使用移动键盘浏览列表,它不会获得焦点 - 相反,我需要使用移动选择键来获得焦点。在此过程中,我的手机左软键更改为“完成”。为什么会出现“完成”菜单?

如何为列表视图提供默认焦点?如何避免左软键显示“完成”?

这是我的代码:

#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 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

醉梦枕江山 2024-09-15 00:33:50

对于默认焦点,停止调用 listui->viewport()->setFocus(); 并调用 listui->setFocus() 为其提供焦点。被创建。

至于“完成”的显示,我不太确定,但您可能需要发布更多代码来显示您正在创建的对话框。大多数都有一组默认按钮或一个设置为默认的按钮。 “完成”键可能与此有关。正如此处所示,“退出”是显示的软键。

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.

南渊 2024-09-15 00:33:50

该问题是关于 Qt 4.6.2 的,该问题已在 Qt 4.6.3 中修复

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文