qt获取屏幕分辨率

1
2
3
4
//获取主屏分辨率 
QRect mRect
mRect = QGuiApplication::primaryScreen()->geometry();
qDebug()<<"width:"<<mRect.width()<<" height:"<<mRect.height();

.获取多个显示器屏幕大小

1
2
3
4
5
6
7
8
9
10
11
// 获取多显示器,通过list存储当前主机所有显示器 
QList<QScreen *> list_screen = QGuiApplication::screens();
// 通过循环可以遍历每个显示器
for (int i = 0; i < list_screen.size(); i++)
{
QRect rect = list_screen.at(i)->geometry();
int desktop_width = rect.width();
int desktop_height = rect.height();
// 打印屏幕分辨率
qDebug() << desktop_width <<desktop_height;
}

error:

libQt5WebEngineCore.so: .dynsym local symbol at index 3

解决:sudo ln -sf /usr/bin/x86_64-linux-gnu-ld.gold /usr/bin/ld