Hi Jaco, here i am not using QTableView ... i have the TableWidget class which is derived from "QTableWidget"... and i have implemented the eventFilter in TableWidget class...?
let me know,what i is wrong with the eventFilter which i have implemented?? Thanks & Regards, Muthu On Tue, Feb 7, 2012 at 3:53 PM, Jaco Naude <[email protected]> wrote: > I think you must install the eventFilter on the viewport() of the table > view. > Did not test, it just a quick quess. > > On Tue, Feb 7, 2012 at 11:59 AM, Muthulingam Ammaiappan < > [email protected]> wrote: > >> Hi Friends, >> >> I have QTableWidget... it has "QComboBox" as a cellWidget in one of it >> column... >> >> I wanted to disable the ScrollEvent of QComboBox... so when cursor is on >> top of the QComboBox ,if user try to do the Mouse Scroll,then it should not >> change the index.... >> >> To achieve this, I just implemented the "eventFilter" in TableWidget >> class.... but still ScrollEvent is working... >> >> can anyone please help me to fix this problem...? >> >> >> Thanks & Regards, >> Muthu >> >> code snippet: >> >> TableWidget::TableWidget(QWidget *parent, MainWindow *mainwindow) >> >> : QTableWidget(parent) >> >> { >> >> versioncombo->setFocusPolicy( Qt::StrongFocus); >> >> versioncombo->installEventFilter( this ); >> >> } >> >> >> >> bool TableWidget::eventFilter(QObject *obj, QEvent *event) >> >> { >> >> if(event->type() == QEvent::Wheel && >> >> qobject_cast<CustomComboBox*>(obj)) >> >> { >> >> if(qobject_cast<CustomComboBox*>(obj)->focusPolicy() == >> Qt::WheelFocus) >> >> { >> >> event->accept(); >> >> return false; >> >> } >> >> else >> >> { >> >> event->ignore(); >> >> return true; >> >> } >> >> } >> >> return QWidget::eventFilter(obj, event); >> >> } >> >> >> >> >> CustomComboBox::CustomComboBox(QWidget *parent) >> >> : QComboBox(parent) >> >> { >> >> setEditable (false); >> >> setFocusPolicy(Qt::StrongFocus); >> >> } >> >> >> >> void CustomComboBox::focusInEvent(QFocusEvent*) >> >> { >> >> setFocusPolicy(Qt::WheelFocus); >> >> } >> >> void CustomComboBox::focusOutEvent(QFocusEvent*) >> >> { >> >> setFocusPolicy(Qt::StrongFocus); >> >> } >> >> >> >> >> >> _______________________________________________ >> Interest mailing list >> [email protected] >> http://lists.qt-project.org/mailman/listinfo/interest >> >> > > > -- > Jaco Naude' > > Qtilities: Building blocks for Qt applications. > http://www.qtilities.org > >
_______________________________________________ Interest mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/interest
