bool TREE_ARAMA_KERNEL::eventFilter ( QObject *obj, QEvent *event ) { //--------------------- USER VE RESIZE EVENTS if ( event->type() EQ QEvent::User OR event->type() EQ QEvent::Resize ) { return BASE_KERNEL::eventFilter ( obj,event ); } // ---------------------------- KEY PRESS if ( event->type() EQ QEvent::KeyPress ) { QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event); if ( keyEvent->key() EQ Qt::Key_Escape ) { ADAK_CLOSE(); return true; } if ( obj->metaObject()->className() EQ QComboBox::staticMetaObject.className() ) { if ( event->type() EQ QEvent::Wheel ) { return true; } } if ( ( keyEvent->key() EQ Qt::Key_Enter OR keyEvent->key() EQ Qt::Key_Return) AND p_run_search_on_enter ) { SLOT_SEARCH_BUTTON(); return true; } } // ---------------------------- CLOSE EVENT if ( event->type() EQ QEvent::Close ) { return BASE_KERNEL::eventFilter(obj,event); } if ( close_event_started EQ true) { return false; } // ---------------------------- FOCUS IN EVENT if ( event->type() EQ QEvent::FocusIn ) { return CHECK_VAR_CONTROL ( obj ); } return false; }
bool BATCH_KERNEL::eventFilter ( QObject *obj, QEvent *event ) { //FIXME FORM DADA VAR AYNISI if ( event->type() EQ QEvent::MouseButtonPress ) { QMouseEvent * mouse_event = static_cast <QMouseEvent *>(event); if ( obj->metaObject()->className() EQ QLineEdit::staticMetaObject.className() AND mouse_event->button() EQ Qt::LeftButton ) { QLineEdit * line_edit = static_cast<QLineEdit *> (obj); if ( line_edit->hasFocus() EQ true AND line_edit->selectedText() NE line_edit->text() ) { if (line_edit->cursorPosition() EQ 0 ) { line_edit->selectAll(); return true; } } } } //--------------------- USER VE RESIZE EVENTS if ( event->type() EQ QEvent::User OR event->type() EQ QEvent::Resize ) { return BASE_KERNEL::eventFilter ( obj,event ); } // ---------------------------- KEY PRESS if ( event->type() EQ QEvent::KeyPress ) { QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event); if ( obj->metaObject()->className() EQ QTextEdit::staticMetaObject.className() OR obj->metaObject()->className() EQ QPlainTextEdit::staticMetaObject.className() OR obj->metaObject()->className() EQ QLimitedTextEdit::staticMetaObject.className() ) { if ( keyEvent->key() EQ Qt::Key_Tab ) { focusNextChild(); return true; } return false; } if ( keyEvent->key() EQ Qt::Key_Escape ) { ADAK_CLOSE(); return true; } if ( obj->metaObject()->className() EQ QComboBox::staticMetaObject.className() ) { if ( event->type() EQ QEvent::Wheel ) { return true; } } // run_bacth_button focus eklendi cunku run_batch cagrilmadan once focuslanmasi gerekiyor // boylece adakdate yapilan degisikligi daha once yapmis oluyor.. if ( ( keyEvent->key() EQ Qt::Key_Enter OR keyEvent->key() EQ Qt::Key_Return) AND p_run_batch_on_enter ) { run_batch_button->setFocus(); SLOT_RUN_BATCH_BUTTON(); return true; } } // ---------------------------- CLOSE EVENT if ( event->type() EQ QEvent::Close ) { return BASE_KERNEL::eventFilter(obj,event); } if ( close_event_started EQ true) { return false; } // ---------------------------- FOCUS IN EVENT if ( event->type() EQ QEvent::FocusIn ) { QFocusEvent * focus_event = static_cast<QFocusEvent *>(event); bool return_value = CHECK_VAR_CONTROL ( obj ); //FIXME FORM DADA VAR AYNISI if (focus_event->reason() EQ Qt::MouseFocusReason ) { if ( obj->metaObject()->className() EQ QLineEdit::staticMetaObject.className()) { QLineEdit * line_edit = static_cast<QLineEdit *> (obj); line_edit->setCursorPosition(0); } } return return_value; } return BASE_EVENT_KERNEL::eventFilter(obj,event); }