QT获取屏幕刷新率

#include <QScreen>
#include <QWidget>
#include <QWindow>
class A:public QWidget
{
       
     void FetchRefreshRate(int * rate)
    {
        QScreen* ws = QWidget::windowHandle()->screen();

if (ws) { *rate = ws->refreshRate(); } } }

 相关:#include <QSurfaceFormat>

void QSurfaceFormat::setSwapInterval(int interval)


Sets the preferred swap interval. The swap interval specifies the minimum number of video frames
that are displayed before a buffer swap occurs. This can be used to sync the GL drawing into a window
to the vertical refresh of the screen.


Setting an interval value of 0 will turn the vertical refresh syncing off, 
any value higher than 0 will turn the vertical syncing on. Setting interval to a higher value,

for example 10, results in having 10 vertical retraces between every buffer swap.


The default interval is 1.


Changing the swap interval may not be supported by the underlying platform. 
In
this case, the request will be silently ignored. This function was introduced in Qt 5.3. See also swapInterval().

 

posted on 2022-11-15 20:43  邗影  阅读(316)  评论(0编辑  收藏  举报

导航