void SearchListView::listKeyPressed(QKeyEvent* event) { char ch = event->text().toUtf8().constData()[0]; if(isprint(ch)) //add a char to the search box mSearchBox->setText(mSearchBox->text().insert(mSearchBox->cursorPosition(), QString(QChar(ch)))); else if(event->key() == Qt::Key_Backspace) //remove a char from the search box { QString newText; if(event->modifiers() == Qt::ControlModifier) //clear the search box newText = ""; else { newText = mSearchBox->text(); newText.chop(1); } mSearchBox->setText(newText); } else if((event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter)) //user pressed enter emit enterPressedSignal(); }
void CallStackView::setupContextMenu() { mMenuBuilder = new MenuBuilder(this, [](QMenu*) { return DbgIsDebugging(); }); QIcon icon = DIcon(ArchValue("processor32.png", "processor64.png")); mMenuBuilder->addAction(makeAction(icon, tr("Follow &Address"), SLOT(followAddress()))); QAction* mFollowTo = mMenuBuilder->addAction(makeAction(icon, tr("Follow &To"), SLOT(followTo()))); mFollowTo->setShortcutContext(Qt::WidgetShortcut); mFollowTo->setShortcut(QKeySequence("enter")); connect(this, SIGNAL(enterPressedSignal()), this, SLOT(followTo())); mMenuBuilder->addAction(makeAction(icon, tr("Follow &From"), SLOT(followFrom())), [this](QMenu*) { return !getCellContent(getInitialSelection(), 2).isEmpty(); }); MenuBuilder* mCopyMenu = new MenuBuilder(this); setupCopyMenu(mCopyMenu); // Column count cannot be zero mMenuBuilder->addSeparator(); mMenuBuilder->addMenu(makeMenu(DIcon("copy.png"), tr("&Copy")), mCopyMenu); mMenuBuilder->loadFromConfig(); }
/** * @brief This method has been reimplemented. It manages the following actions: * - Pressed keys * * @param[in] event Key event * * @return Nothing. */ void AbstractTableView::keyPressEvent(QKeyEvent* event) { int wKey = event->key(); if(wKey == Qt::Key_Up) { verticalScrollBar()->triggerAction(QAbstractSlider::SliderSingleStepSub); } else if(wKey == Qt::Key_Down) { verticalScrollBar()->triggerAction(QAbstractSlider::SliderSingleStepAdd); } else if(wKey == Qt::Key_PageUp) { verticalScrollBar()->triggerAction(QAbstractSlider::SliderPageStepSub); } else if(wKey == Qt::Key_PageDown) { verticalScrollBar()->triggerAction(QAbstractSlider::SliderPageStepAdd); } else if(wKey == Qt::Key_Return || wKey == Qt::Key_Enter) //user pressed enter emit enterPressedSignal(); }
void SearchListView::doubleClickedSlot() { emit enterPressedSignal(); }