Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Qt QDesktopWidget::screenGeometry返回不正确的值_Qt_Directfb - Fatal编程技术网

Qt QDesktopWidget::screenGeometry返回不正确的值

Qt QDesktopWidget::screenGeometry返回不正确的值,qt,directfb,Qt,Directfb,我已经在DirectFB 1.7.4之上运行了Qt5.3(还有一个qdirectfbintegration的小补丁,因为没有实现platformNativeInterface) 我使用3840x2160分辨率,然后使用下面的代码更改为1920x1080分辨率。分辨率改变,我可以确认fbset输出。我看到的问题是,在将分辨率更改为1920x1080之后,Qt仍然将其报告为3840x2160 有人知道如何强制Qt重新检查/更新其报告的分辨率吗?或者directfb插件中可能缺少什么来通知Qt引擎盖下

我已经在DirectFB 1.7.4之上运行了Qt5.3(还有一个qdirectfbintegration的小补丁,因为没有实现platformNativeInterface)

我使用3840x2160分辨率,然后使用下面的代码更改为1920x1080分辨率。分辨率改变,我可以确认fbset输出。我看到的问题是,在将分辨率更改为1920x1080之后,Qt仍然将其报告为3840x2160

有人知道如何强制Qt重新检查/更新其报告的分辨率吗?或者directfb插件中可能缺少什么来通知Qt引擎盖下发生了变化

谢谢

IDirectFB * dfb = (IDirectFB*)m_app->platformNativeInterface();
if(dfb){
    std::cerr << "######## New resolution is " << width << "x" << height << std::endl;

    IDirectFBDisplayLayer *layer;
    DFBDisplayLayerConfig config;

    std::cerr << "######## Getting primary IDirectFBDisplayLayer" << std::endl;
    /* Get an interface to the primary layer. */
    dfb->GetDisplayLayer(dfb, DLID_PRIMARY, &layer);
    if(layer){
        DFBResult dres;
        std::cerr << "######## Got the primary display layer, setting admin" << std::endl;
        // This level allows window stack mode switches
        dres = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE);
        if(dres != DFB_OK){
            std::cerr << "######## Error: " << DirectFBErrorString(dres) << std::endl;
        }

        std::cerr << "######## Getting layer configuration" << std::endl;
        // Get layer configuration
        dres = layer->GetConfiguration(layer, &config);
        if(dres != DFB_OK){
            std::cerr << "######## Error: " << DirectFBErrorString(dres) << std::endl;
        }
        // Set the new resolution
        std::cerr << "######## Setting layer resolution" << std::endl;
        config.width = width;
        config.height = height;
        dres = layer->SetConfiguration(layer, &config);
        if(dres != DFB_OK){
            std::cerr << "######## Error: " << DirectFBErrorString(dres) << std::endl;
        }
    }

    // Print out resolution from Qt
    QRect res = QApplication::desktop()->screenGeometry();
    std::cerr << "######## QApplication resolution is now " << res.width() << "x" << res.height() << std::endl;
IDirectFB*dfb=(IDirectFB*)m_app->platformNativeInterface();
if(dfb){

std::cerrdirectfb qpa插件缺少几个功能。我正在对该插件进行一些更新,提交时将在此处发布链接

对于临时解决方案,请调用:

WindowsSystemInterface::HandleScreengeMethodChange(m_app->screens().first(),QRect(0,0,宽度,高度));

正在努力更新Qt中的分辨率