我有关于QML 2(Qt 5.2.1)的项目。看起来不错。
但是,当我在1-2秒后关闭Qt Creator的“应用程序输出”(底部的东西)中正在运行的项目(ALT+ F4或其他)时,我得到以下消息:
The program has unexpectedly finished.
bla-bla-bla.exe crashed
Run Code Online (Sandbox Code Playgroud)
这在发行和调试模式下发生。我在调试下启动,但是没有任何错误。从我的最后一个析构函数开始,循序渐进,直到return app.exec();返回1。
我的意思是除此之外-我看不到任何错误。我应该为此担心吗?我可以知道此消息的原因吗?有没有办法获取更具体的消息?
我尝试从启动应用程序cmd,但未收到任何错误。我的main.cpp:
#include <QtGui/QGuiApplication>
#include "qtquick2applicationviewer.h"
#include "painter.h"
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
qmlRegisterType<Painter>("MyCanvas", 1, 0, "MyCanvas");
QtQuick2ApplicationViewer viewer;
viewer.setMainQmlFile(QStringLiteral("qml/test_painteditem/main.qml"));
viewer.showExpanded();
return app.exec();
}
Run Code Online (Sandbox Code Playgroud)
Main.qml:
import QtQuick 2.0
import MyCanvas 1.0
Rectangle {
width: 360
height: 360
color: "white";
focus: true;
Keys.onLeftPressed: {
mc.frame--;
mc.update();
}
Keys.onRightPressed: {
mc.frame++;
mc.update();
}
Keys.onPressed: {
if (event.key === Qt.Key_C){
mc.switchCurve();
}else if (event.key === Qt.Key_O){
mc.switchCurveOffset();
}
}
MouseArea {
anchors.fill: parent
onClicked: {
// mc.x += 10;
//mc.update();
if (!tim.running){
tim.start();
} else {
tim.stop();
}
}
onWheel: {
if (wheel.angleDelta.y > 0)
mc.zoomIn();
else
mc.zoomOut();
}
onPressed: {
}
}
Timer {
id:tim
interval: 1; running: false; repeat: true
onTriggered: {
mc.frame++;
mc.update();
}
}
MyCanvas {
id:mc;
x:0;
y:0;
width:1000; /** 2000x2000 not supported in Android */
height:1000;
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3054 次 |
| 最近记录: |