【QT应用】QFileDialog对话框中的ListView聚焦

1570阅读 0评论2014-11-14 644924073
分类:LINUX

QWidget * QWidget::childAt ( int x, int y ) const

Returns the visible child widget at the position (x, y) in the widget's coordinate system. If there is no visible child widget at the specified position, the function returns 0.


fileDialog->childAt(160,120)->setFocus();



    QFileDialog * fileDialog=new QFileDialog(this);
   
    fileDialog->setWindowTitle(tr("发送文件"));
    fileDialog->setDirectory("/lkj_send");
    //fileDialog.setFilter(tr("All Files(*.*)"));

    fileDialog->showMaximized();


    //----------------------------------


    // focusScrollArea


    //----------------------------------


    QDir dir("/test");
    QStringList files(dir.entryList());

    if(files.count()>3)
    {
       QString tmp2(files.at(2));
       qWarning(tmp2.toLatin1());
       fileDialog->selectFile(tmp2);
    }
    if(fileDialog->childAt(160,120)) //(160,120) viewWindow point


    {
        fileDialog->childAt(160,120)->setFocus();
        QString oname(fileDialog->childAt(160,120)->objectName());
        qWarning(oname.toLatin1());
    }
    else
    {
        qWarning("chindWidget not find");
    }
    


上一篇:linux设备驱动归纳总结
下一篇:QT知识点总结(强)