【问题标题】:What is the mistake in this code这段代码有什么错误
【发布时间】:2010-06-04 11:02:15
【问题描述】:

各位高手能告诉我解决办法吗,

我有一个列表视图,当我点击任何项目时,应该会出现一个弹出列表,然后根据从弹出列表中选择的项目我将更新我的 UI。

我已经编写了一个代码,可以在从我的视图中点击任何项目后获取弹出列表。

我的问题是,一旦我点击任何项目,将得到一个弹出列表,我还可以从弹出列表中选择项目。一旦我在弹出列表中按确定,我也会得到一个带有组合框的列表,我不知道有什么问题.. 这是我获取弹出列表的代码,请在我错的地方帮助我

void myPopupWindow::Popupdialog()
    {
      QInputDialog inputdialog;
      QStringList items;
             items << tr("Spring") << tr("Summer");


     // bool val = QObject::connect(inputdialog,SIGNAL(textValueChanged(const QString &text)),this,SLOT(selText( const QString & text )));
           bool val =  QObject::connect(&inputdialog,SIGNAL(textValueChanged(const QString &)),this,SLOT(selText(const QString &)));

           bool ok;

           inputdialog.setOptions(QInputDialog::UseListViewForComboBoxItems);
           inputdialog.setComboBoxItems(items);
           inputdialog.exec();

           QString item = inputdialog.getItem(this,        tr("QInputDialog::getItem()"),tr("Season:"), items, 0, false, &ok);


    }

【问题讨论】:

    标签: qt qt4 symbian nokia


    【解决方案1】:

    我找到了答案, 我需要从上面的源代码中删除这一行

    QString item = inputdialog.getItem(this,        tr("QInputDialog::getItem()"),tr("Season:"), items, 0, false, &ok);
    

    【讨论】:

    • @Shadow,没有什么比你自己的调试更能教你的了.. :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多