1、头文件

#include<QScreen>

 

2、代码

QScreen *screen = QGuiApplication::primaryScreen ();
QRect screenRect = screen->availableVirtualGeometry(); resize(screenRect.width(),screenRect.height());

3、如果想直接初始主窗口最大化

setWindowState(Qt::WindowMaximized);

4、下面这些参数可用设定主窗口初始状态

Constant

Value

Description

Qt::WindowNoState

0x00000000

The window has no state set (in normal state).

Qt::WindowMinimized

0x00000001

The window is minimized (i.e. iconified).

Qt::WindowMaximized

0x00000002

The window is maximized with a frame around it.

Qt::WindowFullScreen

0x00000004

The window fills the entire screen without any frame around it.

Qt::WindowActive

0x00000008

The window is the active window, i.e. it has keyboard focus.

Qt获取当前屏幕大小的更多相关文章

  1. Xamarin.Forms获取设备屏幕大小

    Xamarin.Forms获取设备屏幕大小 可以借助device.Display获取.基本形式如下: var display = device.Display;然后就可以获取屏幕大小.display. ...

  2. android获取设备屏幕大小的方法

    // 通过WindowManager获取 DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay( ...

  3. qt 获取磁盘空间大小,cpu利用率,内存使用率

    转自:http://www.qtcn.org/bbs/read-htm-tid-60613.html. 1:封装成一个类,直接调用即可.已经在多个商业项目中使用.2:所有功能全平台 win linux ...

  4. flutter 获取设备屏幕大小

    import 'dart:ui'; var s = window.physicalSize;print(s);

  5. Java获取显示器屏幕大小

    public static void main(String[] args) { Dimension screensize = Toolkit.getDefaultToolkit().getScree ...

  6. Qt获取屏幕分辨率

    http://my.oschina.net/u/1255773/blog/159557 原 Qt获取屏幕分辨率 发表于1年前(2013-09-06 11:00)   阅读(546) | 评论(0) 3 ...

  7. Qt 获取屏幕信息

    void GetScreenInfo() { QDesktopWidget* desktopWidget = QApplication::desktop(); //获取可用桌面大小 QRect des ...

  8. (转)JS获取当前对象大小以及屏幕分辨率等

    原文 JS获取当前对象大小以及屏幕分辨率等   <script type="text/javascript">function getInfo(){       var ...

  9. JS获取当前对象大小以及屏幕分辨率等...

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"/> <meta nam ...

随机推荐

  1. SpringBoot学习(1) - 日志

    package com.study.spring_boot_log; import org.springframework.boot.SpringApplication; import org.spr ...

  2. linux 修改系统时间 同步网络时间

    一.date命令 date -s time  修改系统时钟时间为time 设置时间和日期 例如:将系统日期设定成2018年6月8日的命令 命令 : "date -s 06/08/2018&q ...

  3. nginx配置文件的通用语法介绍

    nginx的配置文件是ascii文本文件. 比如http{  }这种的是指令块,include  mime.types: 这种是指令,include是指令,mime.types指令的参数,指令和参数之 ...

  4. 机器学习(ML)七之模型选择、欠拟合和过拟合

    训练误差和泛化误差 需要区分训练误差(training error)和泛化误差(generalization error).前者指模型在训练数据集上表现出的误差,后者指模型在任意一个测试数据样本上表现 ...

  5. pandas 使用总结

    import pandas as pd import numpy as np ## 从字典初始化df ipl_data = {'Team': ['Riders', 'Riders', 'Devils' ...

  6. [win]更改win终端编码

    更改cmd的编码格式 chcp: 显示当前的编码格式 chcp 65001: 更改当前编码格式为UTF-8 字体选择`Lucida Console` 更改PowerShell编码格式(from zhi ...

  7. pdo数据操作,3-4,0724

    require 'connect.php'; $linshi = $dbh->prepare('UPDATE `category` SET `name` = :name, `alias`=:al ...

  8. 【Java并发工具类】StampedLock:比读写锁更快的锁

    前言 ReadWriteLock适用于读多写少的场景,允许多个线程同时读取共享变量.但在读多写少的场景中,还有更快的技术方案.在Java 1.8中, 提供了StampedLock锁,它的性能就比读写锁 ...

  9. Thread Based Parallelism - Thread Synchronization With a Condition

    Thread Based Parallelism - Thread Synchronization With a Condition from threading import Thread, Con ...

  10. 搭建grafana+telegraf+influxdb服务器性能监控平台

    最近在学习性能测试,了解到一套系统资源使用率低的监控环境,也就是grafana+telegraf+influxdb. InfluxDB是一款优秀的时间序列数据库,适合存储设备性能.日志.物联网传感器等 ...