fix crash on import from JS

This commit is contained in:
ZappoMan 2014-02-19 17:57:28 -08:00
parent 3a8a880a8b
commit 91d79f65f2
3 changed files with 6 additions and 4 deletions

View file

@ -25,14 +25,14 @@ function printKeyEvent(eventName, event) {
function keyPressEvent(event) { function keyPressEvent(event) {
var debug = true; var debug = false;
if (debug) { if (debug) {
printKeyEvent("keyPressEvent", event); printKeyEvent("keyPressEvent", event);
} }
} }
function keyReleaseEvent(event) { function keyReleaseEvent(event) {
var debug = true; var debug = false;
if (debug) { if (debug) {
printKeyEvent("keyReleaseEvent", event); printKeyEvent("keyReleaseEvent", event);
} }

View file

@ -50,10 +50,12 @@ void ClipboardScriptingInterface::exportVoxels(float x, float y, float z, float
z / (float)TREE_SCALE, z / (float)TREE_SCALE,
s / (float)TREE_SCALE }; s / (float)TREE_SCALE };
// TODO: should we be calling invokeMethod() in all these cases?
Application::getInstance()->exportVoxels(sourceVoxel); Application::getInstance()->exportVoxels(sourceVoxel);
} }
void ClipboardScriptingInterface::importVoxels() { void ClipboardScriptingInterface::importVoxels() {
Application::getInstance()->importVoxels(); QMetaObject::invokeMethod(Application::getInstance(), "importVoxels");
} }

View file

@ -105,7 +105,7 @@ KeyEvent::KeyEvent(const QKeyEvent& event) {
} else if (key == Qt::Key_CapsLock) { } else if (key == Qt::Key_CapsLock) {
text = "CAPS LOCK"; text = "CAPS LOCK";
} else if (key >= Qt::Key_A && key <= Qt::Key_Z && (isMeta || isControl || isAlt)) { } else if (key >= Qt::Key_A && key <= Qt::Key_Z && (isMeta || isControl || isAlt)) {
// this little bit of hacker will fix the text character keys like a-z in cases of control/alt/meta where // this little bit of hackery will fix the text character keys like a-z in cases of control/alt/meta where
// qt doesn't always give you the key characters and will sometimes give you crazy non-printable characters // qt doesn't always give you the key characters and will sometimes give you crazy non-printable characters
const int lowerCaseAdjust = 0x20; const int lowerCaseAdjust = 0x20;
QString unicode; QString unicode;