[Qt Message] of the QListWidget
-
Hello, everyone.
I met some Qt Messages when I using list widget inherit from QListWidget.
I want to add the gesture recognizer on QListWidget so I inherit the QListWidget. and I adds some functions as the Qt Qt assistant describes.
@bool ImageWidget::event(QEvent event)
{
if (event->type() == QEvent::Gesture)
return gestureEvent(static_cast<QGestureEvent>(event));
return QWidget::event(event);
}@@
bool ImageWidget::gestureEvent(QGestureEvent *event)
{
if (QGesture *swipe = event->gesture(Qt::SwipeGesture))
swipeTriggered(static_cast<QSwipeGesture *>(swipe));
//else if (QGesture *pan = event->gesture(Qt::PanGesture))
// panTriggered(static_cast<QPanGesture *>(pan));
// if (QGesture pinch = event->gesture(Qt::PinchGesture))
// pinchTriggered(static_cast<QPinchGesture >(pinch));
/ I just use the swipe gesture/
return true;
}
@@
void ImageWidget::swipeTriggered(QSwipeGesture *gesture)
{
if (gesture->state() == Qt::GestureFinished) {
if (gesture->horizontalDirection() == QSwipeGesture::Left
|| gesture->verticalDirection() == QSwipeGesture::Up)
goPrevImage();
else
goNextImage();
update();
}
}
@now I run the app with the QtCreator, the app at fist didn't show the widget,
Application Output Window of the Creator show the message:
@[Qt Message] QPainter::begin: Paint device returned engine == 0, type: 1@
then I touched the screen, the list widget appeared
and The Application Output Window of the Creator show the others:
@
[Qt Message] QPainter::begin: Paint device returned engine == 0, type: 1
[Qt Message] QPainter::save: Painter not active
[Qt Message] QPainter::setClipRect: Painter not active
[Qt Message] QPainter::setPen: Painter not active
[Qt Message] QPainter::pen: Painter not active
[Qt Message] QPainter::pen: Painter not active
[Qt Message] QPainter::restore: Unbalanced save/restore
[Qt Message] QPainter::setPen: Painter not active
[Qt Message] QPainter::pen: Painter not active
[Qt Message] QPainter::restore: Unbalanced save/restore
[Qt Message] QPainter::save: Painter not active
[Qt Message] QPainter::setClipRect: Painter not active
[Qt Message] QPainter::setPen: Painter not active
[Qt Message] QPainter::pen: Painter not active
[Qt Message] QPainter::restore: Unbalanced save/restore
[Qt Message] QPainter::save: Painter not active
[Qt Message] QPainter::setClipRect: Painter not active
[Qt Message] QPainter::restore: Unbalanced save/restore
[Qt Message] QPainter::save: Painter not active
[Qt Message] QPainter::setClipRect: Painter not active
[Qt Message] QPainter::setPen: Painter not active
[Qt Message] QPainter::save: Painter not active
.......
@I don't know why the list widget can't appeared as the app run(I had set the list widget show in the constructor)?
and the [Qt Message] is a normal phenomenon?
Thanks for the replies
best regards
hisong -
anyone could help me? Is that s60v5 doesn't support Gesture Recognizer of Qt?
I search much for the issue, It seems that the Gesture example didn't run well in s60v5,too.
-
I think it is available and work for desktop platform.
http://qt.developpez.com/doc/4.6/qgestureevent/But for mobile and embedded it is in the development mode.
otherwise it should be included in the mobility API,
You can ask the same question in Forum Nokia.(If you need more detail). -
Hey, Merry Christmas to all people in this forum.
-
[quote author="hisong1988" date="1293242389"]Hey, Merry Christmas to all people in this forum.[/quote]
Merry Christmas!