void ProgressListDelegate::slotPauseResumeClicked() { const QModelIndex index = focusedIndex(); JobView *jobView = index.model()->data(index, JobView::JobViewRole).value<JobView*>(); JobView::JobState state = (JobView::JobState) index.model()->data(index, JobView::State).toInt(); if (jobView) { switch (state) { case JobView::Running: jobView->requestSuspend(); break; case JobView::Suspended: jobView->requestResume(); break; default: Q_ASSERT(0); // this point should have never been reached break; } } }
LRESULT WebPopupMenuProxyWin::onKeyDown(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool& handled) { handled = true; LRESULT lResult = 0; switch (LOWORD(wParam)) { case VK_DOWN: case VK_RIGHT: down(); break; case VK_UP: case VK_LEFT: up(); break; case VK_HOME: focusFirst(); break; case VK_END: focusLast(); break; case VK_PRIOR: if (focusedIndex() != scrollOffset()) { // Set the selection to the first visible item int firstVisibleItem = scrollOffset(); up(focusedIndex() - firstVisibleItem); } else { // The first visible item is selected, so move the selection back one page up(visibleItems()); } break; case VK_NEXT: { int lastVisibleItem = scrollOffset() + visibleItems() - 1; if (focusedIndex() != lastVisibleItem) { // Set the selection to the last visible item down(lastVisibleItem - focusedIndex()); } else { // The last visible item is selected, so move the selection forward one page down(visibleItems()); } break; } case VK_TAB: ::SendMessage(m_webView->window(), message, wParam, lParam); hide(); break; case VK_ESCAPE: hide(); break; default: if (isASCIIPrintable(wParam)) { // Send the keydown to the WebView so it can be used for type-to-select. // Since we know that the virtual key is ASCII printable, it's OK to convert this to // a WM_CHAR message. (We don't want to call TranslateMessage because that will post a // WM_CHAR message that will be stolen and redirected to the popup HWND. ::PostMessage(m_popup, WM_HOST_WINDOW_CHAR, wParam, lParam); } else lResult = 1; break; } return lResult; }
void AccountsListDelegate::onCheckBoxToggled(bool checked) { QModelIndex index = focusedIndex(); Q_EMIT itemChecked(index, checked); }
void ServiceItemDelegate::slotConfigureButtonClicked() { emit requestServiceConfiguration(focusedIndex()); }
void ServiceItemDelegate::slotCheckBoxClicked(bool checked) { QAbstractItemModel* model = const_cast<QAbstractItemModel*>(focusedIndex().model()); model->setData(focusedIndex(), checked, Qt::CheckStateRole); }
void ScriptDelegate::toggled(bool on) { QModelIndex index = focusedIndex(); QAbstractItemModel* model = (QAbstractItemModel*)index.model(); model->setData(index, on, Qt::CheckStateRole); }
void ScriptDelegate::settingsClicked() { QModelIndex index = focusedIndex(); QAbstractItemModel* model = (QAbstractItemModel*)index.model(); model->setData(index, 0, ScriptModel::ConfigureRole); }
void ScriptDelegate::aboutClicked() { QModelIndex index = focusedIndex(); QAbstractItemModel* model = (QAbstractItemModel*)index.model(); model->setData(index, 0, ScriptModel::AboutRole); }