管理多个显示器
Manage multiple displays
我正在使用QSplashScreen为我的QtQuick 2应用程序显示初始屏幕。
QScreen *screen = QGuiApplication::primaryScreen();
QRect screen_geometry = screen->geometry();
int screen_width = screen_geometry.width();
QPixmap pixmap("splash.png");
QSplashScreen splash(pixmap.scaledToWidth(screen_width*0.35,Qt::SmoothTransformation));
screen_width用于缩放图像。我的笔记本电脑已连接到 2K 显示器。
问题是,对于不同的"显示管理选项",图像的显示方式不同,例如
">仅限PC","重复显示"和"仅第二屏幕"。
我的问题是,如何管理两个显示器,以使图像在两个显示器上都显示良好。
我所需要的只是以 35% 的屏幕宽度显示初始屏幕。它应该在两个显示器中以 35% 的屏幕宽度显示。
我不知道
我的问题的确切解决方案。但这是我目前正在做的事情。
为此,我需要辅助高分辨率图像说"splash@2x.png">
参考: https://doc.qt.io/qt-5/scalability.html#loading-files-depending-on-platform
QScreen *screen = QGuiApplication::primaryScreen();
QRect screen_geometry = screen->geometry();
int DPR = static_cast<int>(screen->devicePixelRatio()); // 1 or 2
int screen_width = screen_geometry.width();
QString splash_screen_image= "splash.png";
if(DPR == 2)
{
//2K screen connected directly to PC
splash_screen_image= "splash@2x.png";
screen_width*=2;
}
if(DPR == 1 && screen_width >1920)
{
//'Second screen only' selected when laptop is connected to 2K display
splash_screen_image= "splash@2x.png";
screen_width*=2;
}
if(DPR == 1 && screen_width <=1920)
{
//'Duplicate display' or 'PC only' selected when laptop is connected to 2K display
// or Desktop PC connected to HD monitor
//Use "splash.png"
}
QPixmap pixmap(splash_screen_image);
QSplashScreen splash(pixmap.scaledToWidth(screen_width*0.35,Qt::SmoothTransformation));
相关文章:
- 当vector是tje全局变量时,c++中vector的内存管理
- 如何维护资源管理器项目视图中当前可见的项目列表
- 如何在GTK程序运行时禁用屏幕保护程序/电源管理/屏幕消隐
- 资源管理设计模式
- 使用"Task"函数指针队列定义作业管理器
- 实现动态插件管理器
- Alt+Enter 在 Win32 应用中,管理大小调整和分辨率
- libcurl 和 DNS ttl 中的内部连接管理
- 如何在qt中同步应用程序和显示器的刷新率?
- 当分配一个字符串值并稍后通过分配另一个值进行更改时C++如何管理内存?
- 在C++管理一家中国.txt
- 编译器资源管理器和 GCC 具有不同的输出
- 我们可以通过 IPC 传递具有动态管理成员的类对象吗?
- 使用 Git 处理 C++ Visual Studio 2019 解决方案的外部依赖项源代码管理的最佳方法是什么?
- Q没有管理权限的 exe 无法启动维护工具
- QT:管理来自 QNetworkReply 的回复
- 使用 std::vector<double> 访问由 std::unique_ptr<double[2] 管理的数据>
- 读取 TCP 标头并使用RAW_SOCKET管理 TCP 连接
- 管理多个显示器
- 检查显示器是否被windows电源管理关闭