History

Add Desktop object to JavaScript with width and height properties

David Rowe committed 11 years ago

Commit 9d3d1041 parent 08ee5cb3 files · +60 −0Browse files

Showing the changes to interface/src/scripting/DesktopScriptingInterface.cpp (1 of 3 files). Show all

Unified · Split

interface/src/scripting/DesktopScriptingInterface.cpp+27−0
@@ -0,0 +1,27 @@
1+//
2+// DesktopScriptingInterface.h
3+// interface/src/scripting
4+//
5+// Created by David Rowe on 25 Aug 2015.
6+// Copyright 2015 High Fidelity, Inc.
7+//
8+// Distributed under the Apache License, Version 2.0.
9+// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10+//
11+
12+#include "DesktopScriptingInterface.h"
13+
14+#include <QWindow>
15+#include <QScreen>
16+
17+#include "Application.h"
18+#include "MainWindow.h"
19+
20+int DesktopScriptingInterface::getWidth() {
21+ QSize size = Application::getInstance()->getWindow()->windowHandle()->screen()->virtualSize();
22+ return size.width();
23+}
24+int DesktopScriptingInterface::getHeight() {
25+ QSize size = Application::getInstance()->getWindow()->windowHandle()->screen()->virtualSize();
26+ return size.height();
27+}