mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-11-26 10:33:15 +03:00
Add frame for calling c++ screenshot code
This commit is contained in:
parent
f3fe3faf61
commit
6df435663b
3
main.cpp
3
main.cpp
@ -7,6 +7,7 @@
|
||||
#ifndef Q_OS_DARWIN
|
||||
#include <QtSingleApplication>
|
||||
#endif
|
||||
#include "screenshot.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@ -45,10 +46,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
app.setWindowIcon(QIcon(path_prefix + "/images/windowicon.png"));
|
||||
|
||||
ScreenShot screenshot;
|
||||
QQmlApplicationEngine engine;
|
||||
engine.rootContext()->setContextProperty("appDir", app_dir);
|
||||
engine.rootContext()->setContextProperty("urlPrefix", url_prefix);
|
||||
engine.rootContext()->setContextProperty("appVersion", APP_VERSION);
|
||||
engine.rootContext()->setContextProperty("ScreenShot", &screenshot);
|
||||
|
||||
qputenv("PYTHONDONTWRITEBYTECODE", "1");
|
||||
|
||||
|
@ -16,6 +16,7 @@ Dialog {
|
||||
Layout.columnSpan: 2
|
||||
text: qsTr("Scan a QR code")
|
||||
Layout.fillWidth: true
|
||||
onClicked: console.log(ScreenShot.capture());
|
||||
}
|
||||
Label {
|
||||
text: qsTr("Name")
|
||||
|
16
screenshot.h
Normal file
16
screenshot.h
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef SCREENSHOT_H
|
||||
#define SCREENSHOT_H
|
||||
#include <QObject>
|
||||
|
||||
class ScreenShot: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ScreenShot () : QObject() {}
|
||||
|
||||
Q_INVOKABLE int capture(){
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // SCREENSHOT_H
|
Loading…
Reference in New Issue
Block a user