我有Qt 5.3在DirectFB 1.7.4之上运行(以及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;
我从控制台看到的输出是:
######## New resolution is 1920x1080
######## Getting primary IDirectFBDisplayLayer
######## Got the primary display layer, setting admin
######## Getting layer configuration
######## Setting layer resolution
(*) FBDev/Mode: Setting 1920x1080 ARGB
(*) FBDev/Mode: Switched to 1920x1080 (virtual 1920x2160) at 32 bit (ARGB), pitch 7680
######## QApplication resolution is now 3840x2160
root@output:~# fbset
mode "1920x1080-24"
# D: 74.250 MHz, H: 27.000 kHz, V: 24.000 Hz
geometry 1920 1080 1920 2160 32
timings 13468 148 638 36 4 44 5
accel false
rgba 8/16,8/8,8/0,8/24
endmode
答案 0 :(得分:1)
directfb qpa插件缺少几个功能。我正在处理插件的一些更新,我会在提交时发布一个链接。
对于临时解决方法:
WindowSystemInterface::handleScreenGeometryChange(m_app->screens().first(), QRect(0,0,width,height));
正在努力更新Qt中的分辨率。