私はSymbianプラットフォーム用のQtモバイルアプリケーションを開発中です。私は表示されている現在の画面を変更する関数を持っています。この関数はスロットなので、C++側とQMLから呼び出すことができます。だけで正常に動作++ Cからこの関数を呼び出すQt:QMLからの呼び出しスロットがクラッシュするアプリケーション[データアボート例外]
public slots:
void ChangeView(const QString & viewPath);
void Controller::ChangeView(const QString & viewPath) {
if(this->view->status() == QDeclarativeView::Ready) {
QDeclarativeProperty * property = new QDeclarativeProperty(this->view,"source", this->context);
if(property->isValid()) {
property->write(QVariant(viewPath));
property->~QDeclarativeProperty();
}
}
else if(this->view->status() == QDeclarativeView::Error) {
QList<QDeclarativeError> errors = this->view->errors();
for(int i = 0; i < errors.size(); ++i) {
qDebug() << "Error: " << errors.at(i);
}
errors.~QList();
}
}
は、
void Controller::Show() {
this->window->setCentralWidget(this->view);
this->menu->MainMenu();
this->ChangeView("qml/Streemio/Login.qml");
this->window->show();
}
は、しかし、それは私がQMLからそれを呼び出すアプリケーションがクラッシュします。
Button {
id: channels
anchors.top: nowPlaying.bottom
anchors.topMargin: -1
label: "Channels"
subLabel: "listen to default playlists"
imgSource: "qrc:Streemio/img/channel_menu.png"
fontSize: 14
subFontSize: 7
buttonWidth: container.width
Keys.onSelectPressed: {controller.ChangeView("qml/Streemio/Channels.qml")}
Keys.onDownPressed: {search.focus = true; flickArea.contentY = 75}
Keys.onUpPressed: {nowPlaying.focus = true; flickArea.contentY = 0}
}
ここにアプリケーション出力があります。
Starting application...
Application running with pid 770.
CAknSignalDataObserver::HandleUpdateL: UMA
CAknSignalPane::ShowUmaIconL: begin
CAknSignalPane::LoadSignalIconL: uma-off
CAknSignalPane::ShowUmaIconL: end
[Qt Message] QNetworkReplyImpl::_q_startOperation was called more than once
Process 770, thread 771 stopped at 0x71547a2a: A data abort exception has occurred.
Finished.
私はここで間違っていますか?ありがとうございました。
ありがとう、MartinJ、それは今素晴らしいです。 QMLファイルごとにLoader要素を使用することで、この問題の解決策を見つけることができました。これはまもなくメモリー豚になるでしょう。再度、感謝します。 – Findrzkeeprz