This is the code in Qml
import Qt 4.7
Rectangle {
width:160; height:200
property int hr
property int min
property int ap
signal titleBarClicked(int hr,int min,int ap)
Row {
y: 0; x: 0; spacing: 5
Spinner {
id: spinner1
width: 50; height: 200
focus: true
model: 13
itemHeight: 30
delegate: Text { font.pixelSize:25;text: index; height: 30 }
}
// Text { text: "Current item index: " + spinner1.currentIndex }
}
Row {
y: 0; x:50; spacing: 20
Spinner {
id: spinner2
width: 60; height: 200
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: 110; spacing: 20
Spinner {
id: spinner3
width: 60; height: 200
focus: true
model: name,
name1
Text {
id: name
text:"PM"
font.pixelSize:25
}
Text {
id: name1
text:"AM"
font.pixelSize:25
}
itemHeight: 30
delegate: Text { font.pixelSize:25;text:name; height: 30 }
Text { font.pixelSize:25;text:name1 ; height: 30 }
MouseArea{ anchors.fill : parent ;
hoverEnabled: true
acceptedButtons: Qt.LeftButton
onReleased :
{
titleBarClicked(spinner1.currentIndex,spinner2.currentIndex,spinner3.currentIndex)
console.log("First currentIndex = "+ spinner1.currentIndex )
console.log("Second currentIndex = "+ spinner2.currentIndex )
console.log("currentIndex = "+ spinner3.currentIndex )
}
}
}
//Text { text: "Current item index: " + spinner3.currentIndex }
}
Keys.onEnterPressed:{
titleBarClicked(spinner1.currentIndex,spinner2.currentIndex,spinner3.currentIndex)
console.log("First currentIndex = "+ spinner1.currentIndex )
console.log("Second currentIndex = "+ spinner2.currentIndex )
console.log("currentIndex = "+ spinner3.currentIndex )
}
}
import Qt 4.7
Rectangle {
width:160; height:200
property int hr
property int min
property int ap
signal titleBarClicked(int hr,int min,int ap)
Row {
y: 0; x: 0; spacing: 5
Spinner {
id: spinner1
width: 50; height: 200
focus: true
model: 13
itemHeight: 30
delegate: Text { font.pixelSize:25;text: index; height: 30 }
}
// Text { text: "Current item index: " + spinner1.currentIndex }
}
Row {
y: 0; x:50; spacing: 20
Spinner {
id: spinner2
width: 60; height: 200
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: 110; spacing: 20
Spinner {
id: spinner3
width: 60; height: 200
focus: true
model: name,
name1
Text {
id: name
text:"PM"
font.pixelSize:25
}
Text {
id: name1
text:"AM"
font.pixelSize:25
}
itemHeight: 30
delegate: Text { font.pixelSize:25;text:name; height: 30 }
Text { font.pixelSize:25;text:name1 ; height: 30 }
MouseArea{ anchors.fill : parent ;
hoverEnabled: true
acceptedButtons: Qt.LeftButton
onReleased :
{
titleBarClicked(spinner1.currentIndex,spinner2.currentIndex,spinner3.currentIndex)
console.log("First currentIndex = "+ spinner1.currentIndex )
console.log("Second currentIndex = "+ spinner2.currentIndex )
console.log("currentIndex = "+ spinner3.currentIndex )
}
}
}
//Text { text: "Current item index: " + spinner3.currentIndex }
}
Keys.onEnterPressed:{
titleBarClicked(spinner1.currentIndex,spinner2.currentIndex,spinner3.currentIndex)
console.log("First currentIndex = "+ spinner1.currentIndex )
console.log("Second currentIndex = "+ spinner2.currentIndex )
console.log("currentIndex = "+ spinner3.currentIndex )
}
}
To copy to clipboard, switch view to plain text mode
This is the Function used In qT FOR qML INTEGRATION
QDeclarativeView *qView=new QDeclarativeView(ui->graphicsView);
qView
->setSource
(QString("main.qml"));
connect (obj,SIGNAL(titleBarClicked(int,int,int)), this, SLOT(timecal(int,int,int)));
QDeclarativeView *qView=new QDeclarativeView(ui->graphicsView);
qView->setSource(QString("main.qml"));
QObject *obj =qView->rootObject();
connect (obj,SIGNAL(titleBarClicked(int,int,int)), this, SLOT(timecal(int,int,int)));
To copy to clipboard, switch view to plain text mode
void AlarmSet::timecal(int hr1, int min1,int ap1)
{
hra=hr1;
mina=min1;
apa=ap1;
//HERE THE VALUE IS COMING
}
void AlarmSet::timecal(int hr1, int min1,int ap1)
{
hra=hr1;
mina=min1;
apa=ap1;
//HERE THE VALUE IS COMING
}
To copy to clipboard, switch view to plain text mode
the value is coming in Qt but when we scroll more than five times , the visual runtime error occurs
This Is the Error Displaying At the Qt Console
QGraphicsItem::ungrabMouse: not a mouse grabber
ASSERT: "!implicit" in file graphicsview\qgraphicsscene.cpp, line 906[/B][/B][/SIZE]
Bookmarks