[Qt-interest] QRubberBand and set selection in qlistwidget
Malyushytsky, Alex
alex at wai.com
Tue Aug 11 22:41:15 CEST 2009
This code will not even compile (e->pos()) - e does not exist).
So I am not sure how it can work fine.
Other than that, check selection mode set.
Regards,
Alex
-----Original Message-----
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Puneet Bisht
Sent: Tuesday, August 11, 2009 12:11 AM
To: Qt-interest at trolltech.com
Subject: [Qt-interest] QRubberBand and set selection in qlistwidget
hi all,
I am facing a problem in selecting the items in a qlistwidget.
Actually i have a class which inherit qlistwidget and i am showing the items
in icon mode .
here in this custom widget i am showing a rubberband like this :
void MyWidget::mousePressEvent(QMouseEvent *event)
{
origin = event->pos();
if (!rubberBand)
rubberBand = new QRubberBand(QRubberBand::Rectangle, this);
rubberBand->setGeometry(QRect(origin, QSize()));
rubberBand->show();
}
void MyWidget::mouseMoveEvent(QMouseEvent *event)
{
rubberBand->setGeometry(QRect(origin, event->pos()).normalized());
setSelection(QRect(origin,e->pos()).normalized(),QItemSelectionModel::Select);
//setSelection(rubberBand->rect(),QItemSelectionModel::Select );
}
void MyWidget::mouseReleaseEvent(QMouseEvent *event)
{
rubberBand->hide();
}
here all things goes fine but no item is selected .
I am unable to understand why this is happening .
Please help me on this issue .
Thanks in Advance.
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest
---------------------------------------------------------------------------------------------------
Weidlinger Associates, Inc. made the following annotations.
"This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you."
"Please consider our environment before printing this email."
More information about the Qt-interest-old
mailing list