Make tablet popups work like they should

This commit is contained in:
Zach Fox 2017-03-16 10:32:49 -07:00
parent 2552e572a7
commit 05fec328c0
4 changed files with 28 additions and 21 deletions

View file

@ -101,11 +101,11 @@ Item {
}
onNewViewRequested:{
// desktop is not defined for web-entities
if (desktop) {
var component = Qt.createComponent("../Browser.qml");
var newWindow = component.createObject(desktop);
request.openIn(newWindow.webView);
// desktop is not defined for web-entities or tablet
if (typeof desktop !== "undefined") {
desktop.openBrowserWindow(request, profile);
} else {
console.log("onNewViewRequested: desktop not defined");
}
}
}

View file

@ -490,6 +490,13 @@ FocusScope {
desktop.forceActiveFocus();
}
function openBrowserWindow(request, profile) {
var component = Qt.createComponent("../Browser.qml");
var newWindow = component.createObject(desktop);
newWindow.webView.profile = profile;
request.openIn(newWindow.webView);
}
FocusHack { id: focusHack; }
Rectangle {

View file

@ -16,8 +16,8 @@ import QtQuick.Controls 1.4
import QtGraphicalEffects 1.0
import Qt.labs.settings 1.0
import "../styles-uit"
import "../controls-uit" as HifiControls
import HFWebEngineProfile 1.0
import "../controls-uit" as HifiControlsUit
import "../controls" as HifiControls
// references HMD, Users, UserActivityLogger from root context
@ -161,7 +161,7 @@ Rectangle {
horizontalAlignment: Text.AlignHCenter;
verticalAlignment: Text.AlignTop;
}
HifiControls.TabletComboBox {
HifiControlsUit.TabletComboBox {
id: availabilityComboBox;
// Anchors
anchors.top: parent.top;
@ -240,7 +240,7 @@ Rectangle {
verticalAlignment: Text.AlignVCenter;
}
// "In View" Checkbox
HifiControls.CheckBox {
HifiControlsUit.CheckBox {
id: inViewCheckbox;
visible: activeTab == "nearbyTab";
anchors.right: reloadNearbyContainer.left;
@ -260,7 +260,7 @@ Rectangle {
anchors.rightMargin: 6;
height: reloadNearby.height;
width: height;
HifiControls.GlyphButton {
HifiControlsUit.GlyphButton {
id: reloadNearby;
width: reloadNearby.height;
glyph: hifi.glyphs.reload;
@ -305,7 +305,7 @@ Rectangle {
anchors.rightMargin: 6;
height: reloadConnections.height;
width: height;
HifiControls.GlyphButton {
HifiControlsUit.GlyphButton {
id: reloadConnections;
width: reloadConnections.height;
glyph: hifi.glyphs.reload;
@ -494,7 +494,7 @@ Rectangle {
}
}
// This TableView refers to the Nearby Table (on the "Nearby" tab below the current user's NameCard)
HifiControls.Table {
HifiControlsUit.Table {
id: nearbyTable;
// Anchors
anchors.fill: parent;
@ -592,7 +592,7 @@ Rectangle {
// Anchors
anchors.left: parent.left;
}
HifiControls.GlyphButton {
HifiControlsUit.GlyphButton {
function getGlyph() {
var fileName = "vol_";
if (model && model.personalMute) {
@ -626,7 +626,7 @@ Rectangle {
// Clicking on the sides of the sorting header doesn't cause this problem.
// I'm guessing this is a QT bug and not anything I can fix. I spent too long trying to work around it...
// I'm just going to leave the minor visual bug in.
HifiControls.CheckBox {
HifiControlsUit.CheckBox {
id: actionCheckBox;
visible: isCheckBox;
anchors.centerIn: parent;
@ -658,7 +658,7 @@ Rectangle {
}
// This Button belongs in the columns that contain the stateless action buttons ("Silence" & "Ban" for now)
HifiControls.Button {
HifiControlsUit.Button {
id: actionButton;
color: 2; // Red
visible: isButton;
@ -831,7 +831,7 @@ Rectangle {
}
// This TableView refers to the Connections Table (on the "Connections" tab below the current user's NameCard)
HifiControls.Table {
HifiControlsUit.Table {
id: connectionsTable;
visible: !connectionsLoading.visible;
// Anchors
@ -935,7 +935,7 @@ Rectangle {
}
// "Friends" checkbox
HifiControls.CheckBox {
HifiControlsUit.CheckBox {
id: friendsCheckBox;
visible: styleData.role === "friends";
anchors.centerIn: parent;
@ -960,7 +960,7 @@ Rectangle {
} // "Connections" Tab
} // palTabContainer
HifiControls.Keyboard {
HifiControlsUit.Keyboard {
id: keyboard;
raised: currentlyEditingDisplayName && HMD.mounted;
numeric: parent.punctuationMode;
@ -1096,9 +1096,6 @@ Rectangle {
HifiControls.WebView {
id: userInfoViewer;
profile: HFWebEngineProfile {
storageName: "qmlWebEngine"
}
anchors {
top: navigationContainer.bottom;
bottom: parent.bottom;

View file

@ -39,6 +39,7 @@
#include "scripting/HMDScriptingInterface.h"
#include <Preferences.h>
#include "FileDialogHelper.h"
#include <OffscreenUi.h>
static const float DPI = 30.47f;
static const float INCHES_TO_METERS = 1.0f / 39.3701f;
@ -177,6 +178,8 @@ void Web3DOverlay::loadSourceURL() {
}
}
_webSurface->getRootContext()->setContextProperty("globalPosition", vec3toVariant(getPosition()));
auto offscreenUi = DependencyManager::get<OffscreenUi>();
_webSurface->getRootContext()->setContextProperty("desktop", offscreenUi->getDesktop());
}
void Web3DOverlay::render(RenderArgs* args) {