qml: 截图(单窗口);

Item提供了grabToImage方法,能够对窗口内指定区域进行截图;

 Rectangle {
      id: source
      width: 100
      height: 100
      gradient: Gradient {
          GradientStop { position: 0; color: "steelblue" }
          GradientStop { position: 1; color: "black" }
      }
  }
      // ...
      source.grabToImage(function(result) {
                             result.saveToFile("something.png");
                         });

猜你喜欢

转载自www.cnblogs.com/yinwei-space/p/9436152.html
QML
今日推荐