How to take ScreenShot Qt/QML

后端 未结 1 1000
傲寒
傲寒 2020-12-17 03:05

QtQuick1 example I can’t make it work on QtQuick2

screenCapture.hpp

#include 

class QString;
class QQuickView;

class screenCapture :         


        
相关标签:
1条回答
  • 2020-12-17 03:28

    I found a solution, pretty simple, change the function “capture” to

    void screenCapture::capture(QString const &path) const
    {
        QImage img = currentView_->grabWindow();
        img.save(path);
    }
    
    0 讨论(0)
提交回复
热议问题