mirror of
https://github.com/lubosz/overte.git
synced 2025-04-29 19:03:10 +02:00
Fix native text rendering by forcing positions to integer values
This commit is contained in:
parent
817245accc
commit
ebf0bf394a
4 changed files with 55 additions and 14 deletions
|
@ -3,9 +3,9 @@ import QtQuick.Controls 1.4
|
||||||
import QtQuick.Dialogs 1.2 as OriginalDialogs
|
import QtQuick.Dialogs 1.2 as OriginalDialogs
|
||||||
import Qt.labs.settings 1.0
|
import Qt.labs.settings 1.0
|
||||||
|
|
||||||
import "../styles" as Hifi
|
import "../../styles" as Hifi
|
||||||
import "../controls" as HifiControls
|
import "../../controls" as HifiControls
|
||||||
import "../windows"
|
import "../../windows"
|
||||||
|
|
||||||
Window {
|
Window {
|
||||||
id: root
|
id: root
|
||||||
|
@ -19,12 +19,6 @@ Window {
|
||||||
property var scripts: ScriptDiscoveryService;
|
property var scripts: ScriptDiscoveryService;
|
||||||
property var scriptsModel: scripts.scriptsModelFilter
|
property var scriptsModel: scripts.scriptsModelFilter
|
||||||
property var runningScriptsModel: ListModel { }
|
property var runningScriptsModel: ListModel { }
|
||||||
property var fileFilters: ListModel {
|
|
||||||
id: jsFilters
|
|
||||||
ListElement { text: "Javascript Files (*.js)"; filter: "*.js" }
|
|
||||||
ListElement { text: "All Files (*.*)"; filter: "*.*" }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Settings {
|
Settings {
|
||||||
category: "Overlay.RunningScripts"
|
category: "Overlay.RunningScripts"
|
||||||
|
@ -249,7 +243,30 @@ Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
model: scriptsModel
|
model: scriptsModel
|
||||||
TableViewColumn { title: "Name"; role: "display"; }
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
acceptedButtons: Qt.RightButton
|
||||||
|
onClicked: treeView.foo();
|
||||||
|
}
|
||||||
|
|
||||||
|
function foo() {
|
||||||
|
var localRect = Qt.rect(0, 0, width, height);
|
||||||
|
var rect = desktop.mapFromItem(treeView, 0, 0, width, height)
|
||||||
|
console.log("Local Rect " + localRect)
|
||||||
|
console.log("Rect " + rect)
|
||||||
|
console.log("Desktop size " + Qt.size(desktop.width, desktop.height));
|
||||||
|
}
|
||||||
|
|
||||||
|
TableViewColumn {
|
||||||
|
title: "Name";
|
||||||
|
role: "display";
|
||||||
|
// delegate: Text {
|
||||||
|
// text: styleData.value
|
||||||
|
// renderType: Text.QtRendering
|
||||||
|
// elite: styleData.elideMode
|
||||||
|
// }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HifiControls.TextField {
|
HifiControls.TextField {
|
|
@ -45,6 +45,30 @@ Fadable {
|
||||||
// The content to place inside the window, determined by the client
|
// The content to place inside the window, determined by the client
|
||||||
default property var content
|
default property var content
|
||||||
|
|
||||||
|
property var rectifier: Timer {
|
||||||
|
property bool executing: false;
|
||||||
|
interval: 100
|
||||||
|
repeat: false
|
||||||
|
running: false
|
||||||
|
|
||||||
|
onTriggered: {
|
||||||
|
executing = true;
|
||||||
|
x = Math.floor(x);
|
||||||
|
y = Math.floor(y);
|
||||||
|
executing = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function begin() {
|
||||||
|
if (!executing) {
|
||||||
|
restart();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
onXChanged: rectifier.begin();
|
||||||
|
onYChanged: rectifier.begin();
|
||||||
|
|
||||||
// This mouse area serves to raise the window. To function, it must live
|
// This mouse area serves to raise the window. To function, it must live
|
||||||
// in the window and have a higher Z-order than the content, but follow
|
// in the window and have a higher Z-order than the content, but follow
|
||||||
// the position and size of frame decoration
|
// the position and size of frame decoration
|
||||||
|
|
|
@ -1260,7 +1260,7 @@ void Application::initializeUi() {
|
||||||
auto resultVec = _compositor.screenToOverlay(toGlm(pt));
|
auto resultVec = _compositor.screenToOverlay(toGlm(pt));
|
||||||
result = QPointF(resultVec.x, resultVec.y);
|
result = QPointF(resultVec.x, resultVec.y);
|
||||||
}
|
}
|
||||||
return result;
|
return result.toPoint();
|
||||||
});
|
});
|
||||||
offscreenUi->resume();
|
offscreenUi->resume();
|
||||||
connect(_window, &MainWindow::windowGeometryChanged, [this](const QRect& r){
|
connect(_window, &MainWindow::windowGeometryChanged, [this](const QRect& r){
|
||||||
|
@ -4418,7 +4418,7 @@ bool Application::displayAvatarAttachmentConfirmationDialog(const QString& name)
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::toggleRunningScriptsWidget() {
|
void Application::toggleRunningScriptsWidget() {
|
||||||
static const QUrl url("dialogs/RunningScripts.qml");
|
static const QUrl url("hifi/dialogs/RunningScripts.qml");
|
||||||
DependencyManager::get<OffscreenUi>()->show(url, "RunningScripts");
|
DependencyManager::get<OffscreenUi>()->show(url, "RunningScripts");
|
||||||
//if (_runningScriptsWidget->isVisible()) {
|
//if (_runningScriptsWidget->isVisible()) {
|
||||||
// if (_runningScriptsWidget->hasFocus()) {
|
// if (_runningScriptsWidget->hasFocus()) {
|
||||||
|
|
|
@ -35,7 +35,7 @@ public:
|
||||||
OffscreenQmlSurface();
|
OffscreenQmlSurface();
|
||||||
virtual ~OffscreenQmlSurface();
|
virtual ~OffscreenQmlSurface();
|
||||||
|
|
||||||
using MouseTranslator = std::function<QPointF(const QPointF&)>;
|
using MouseTranslator = std::function<QPoint(const QPointF&)>;
|
||||||
|
|
||||||
virtual void create(QOpenGLContext* context);
|
virtual void create(QOpenGLContext* context);
|
||||||
void resize(const QSize& size);
|
void resize(const QSize& size);
|
||||||
|
@ -94,7 +94,7 @@ private:
|
||||||
bool _polish{ true };
|
bool _polish{ true };
|
||||||
bool _paused{ true };
|
bool _paused{ true };
|
||||||
uint8_t _maxFps{ 60 };
|
uint8_t _maxFps{ 60 };
|
||||||
MouseTranslator _mouseTranslator{ [](const QPointF& p) { return p; } };
|
MouseTranslator _mouseTranslator{ [](const QPointF& p) { return p.toPoint(); } };
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue