PDA

View Full Version : visual studio runtime error on qml-qt interaction



vinayaka
2nd June 2011, 14:06
//main.qml



import Qt 4.7
import "content"

Rectangle {

width: 480; height: 480
property int hr
property int min
property int am

signal titleBarClicked(int hr,int min,int am)


Row {
y: 0; x: 0; spacing: 20

Spinner {
id: spinner

width: 60; height: 240
focus: false

model: 13
itemHeight: 30

delegate: Text { font.pixelSize: 25; text: index; height: 30 }


}


//Text { text: "Current item index: " + spinner.currentIndex }

}
Row {
y: 0; x: 80; spacing: 20

Spinner {
id: spinner2
width: 60; height: 240
focus: true
model: 60
itemHeight: 30
delegate: Text { font.pixelSize: 25; text: index; height: 30 }
}


// Text { text: "Current item index: " + spinner2.currentIndex }

}
Row {
y: 0; x: 160; spacing: 20

Spinner {
id: spinner3
width: 60; height: 240
focus: true
model: name1
itemHeight: 30

delegate: Text {font.pixelSize: 25; text: "PM"; height: 30 }


Text {
id: name1
text: ""
}






}




// Text { text: "Current item index: " + spinner3.currentIndex }

}







Column {
y: 150; x: 220; spacing: 20
Image {
id: image1
source: "content/forward.png"

MouseArea {
id:mousearea
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton|Qt.MiddleButton
onReleased: {

titleBarClicked(spinner.currentIndex,spinner2.curr entIndex,spinner3.currentIndex)
console.log("First currentIndex = "+ spinner.currentIndex )
console.log("Second currentIndex = "+ spinner2.currentIndex )
console.log("currentIndex = "+ spinner3.currentIndex )

}

}

}









}






}






.cpp file integration qt with qml



QDeclarativeView *qView=new QDeclarativeView(ui->graphicsView);
qView->setSource(QString("main.qml"));
QGraphicsObject *obj =qView->rootObject();
connect ( obj,SIGNAL(titleBarClicked(int,int,int)), this, SLOT(timecal(int,int,int)));




error:

visual studio runtime error

error displayed on qt console

QGraphicsItem::ungrabMouse: not a mouse grabber
ASSERT: "!implicit" in file graphicsview\qgraphicsscene.cpp, line 906

when click and drag on the sides of spinners no error is displayed . but when clicked and dragged exactly on the spinner the above errors are displayed.
what should I do?