void ArrayCtrl::onKeyDown(const Event &event) { if(!active) { Parent::onKeyDown(event); return; } Point2I delta(0,0); switch(event.diKeyCode) { case DIK_LEFT: delta.set(-1, 0); break; case DIK_RIGHT: delta.set(1, 0); break; case DIK_UP: delta.set(0, -1); break; case DIK_DOWN: delta.set(0, 1); break; default: Parent::onKeyDown(event); return; } if(size.x < 1 || size.y < 1) return; if(selectedCell.x == -1 || selectedCell.y == -1) { cellSelected(Point2I(0,0)); return; } Point2I cell = selectedCell; cell += delta; while(cell.x >= 0 && cell.x < size.x && cell.y >= 0 && cell.y < size.y) { if(cellSelected(cell)) { onAction(); break; } cell += delta; } }
void StandardListCtrl::selectNext(void) { if (selectedCell.y < entryPtrs.size() - 1) { if (selectedCell.y >= 0) { cellSelected(Point2I(0, selectedCell.y + 1)); } else { cellSelected(Point2I(0, 0)); } } else { cellSelected(Point2I(0, 0)); } }
void StandardListCtrl::selectPrev(void) { if (selectedCell.y >= 1) { if (selectedCell.y < entryPtrs.size()) { cellSelected(Point2I(0, selectedCell.y - 1)); } else { cellSelected(Point2I(0, 0)); } } else { cellSelected(Point2I(0, entryPtrs.size() - 1)); } }
void TableGroupBox::setModel(QAbstractTableModel *model) { m_table->setModel(model); m_table->resizeRowsToContents(); m_table->resizeColumnsToContents(); connect(m_table->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(cellSelected())); connect(m_table->selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)), this, SIGNAL(currentChanged(QModelIndex, QModelIndex))); }
void ArrayCtrl::onMouseDown(const Event &event) { if(!active) { Parent::onMouseDown(event); return; } Point2I pt = globalToLocalCoord(event.ptMouse); pt.x -= headerDim.x; pt.y -= headerDim.y; Point2I cell((pt.x < 0 ? -1 : pt.x / cellSize.x), (pt.y < 0 ? -1 : pt.y / cellSize.y)); if(cell.x >= 0 && cell.x < size.x && cell.y >= 0 && cell.y < size.y) cellSelected(cell); Parent::onMouseDown(event); }
void ClipListViewController::addClip( Clip* clip ) { MediaCellView* cell = new MediaCellView( clip->uuid() ); cell->containsClip(); connect( cell, SIGNAL( cellSelected( QUuid ) ), this, SLOT( cellSelection( const QUuid& ) ) ); connect( cell, SIGNAL( cellDeleted( const QUuid& ) ), this, SLOT( clipDeletion( const QUuid& ) ) ); cell->setThumbnail( clip->getParent()->snapshot() ); QString number; number.setNum( m_cells.size() + 1 ); cell->setTitle( clip->getParent()->fileName() + number ); cell->setLength( clip->lengthSecond(), false ); addCell( cell ); m_cells.insert( clip->uuid(), cell ); cell->enableCell(); }
void MapWidget::selectAll() { QPoint b(0,0); QPoint e(mCols - 1, mRows - 1); if (mSelectionBegin && mSelectionEnd && *mSelectionBegin == b && *mSelectionEnd == e) { delete mSelectionBegin; delete mSelectionEnd; mSelectionBegin = mSelectionEnd = NULL; emit cellDeselected(); } else { if (mSelectionBegin) delete mSelectionBegin; if (mSelectionEnd) delete mSelectionEnd; mSelectionBegin = new QPoint(b); mSelectionEnd = new QPoint(e); emit cellSelected(); } update(); }
void MapWidget::mouseReleaseEvent(QMouseEvent *event) { switch(event->button()) { case Qt::MidButton: mViewportPos += mDragOffset; mDragOffset.rx() = 0; mDragOffset.ry() = 0; break; case Qt::RightButton: { finishSpecialMode(false); QPoint tmp = getCellUnderMouse(event->localPos()); if (mSelectionEnd) { delete mSelectionEnd; mSelectionEnd = NULL; } if (mSelectionBegin) { if (!isValidCell(tmp) && tmp == *mSelectionBegin) { delete mSelectionBegin; mSelectionBegin = NULL; emit cellDeselected(); } else { mSelectionEnd = new QPoint; *mSelectionEnd = tmp; clipCellCoord(*mSelectionBegin); clipCellCoord(*mSelectionEnd); emit cellSelected(); } update(); } break; } case Qt::LeftButton: finishSpecialMode(true); break; default: break; } }
void KviTextIconWindow::keyPressEvent(QKeyEvent * e) { switch(e->key()) { case Qt::Key_Space: case Qt::Key_Return: { cellSelected(m_pTable->currentRow(), m_pTable->currentColumn()); } break; case Qt::Key_Tab: //avoid the text edit field to move to the icon cells using tab break; break; case Qt::Key_Escape: doHide(); break; break; default: QWidget::keyPressEvent(e); break; } }
void ImportMediaCellView::mousePressEvent( QMouseEvent* ) { emit cellSelected( uuid() ); this->focusWidget(); }
void ArrayCtrl::setSelectedCell(Point2I cell) { cellSelected(cell); }