void MusicSongsListWidget::musicFileInformation() { if(rowCount() == 0 || currentRow() < 0 ) { return; } MusicFileInformationWidget file(this); QString path = !m_musicSongs->isEmpty() ? m_musicSongs->at(currentRow()).getMusicPath() : QString(); file.setFileInformation(path); file.exec(); }
void QListWidgetWithDrop::dropEvent(QDropEvent *e) { int fromRow = currentRow(); QListWidget::dropEvent(e); int toRow = currentRow(); for (int i = 0; i < count(); i++){ FilterButton *fb = (FilterButton*) itemWidget(this->item(i)); fb->setName(QString::number(i+1)); } emit listItemMoved(fromRow, toRow); }
void MusicSongsListWidget::musicOpenFileDir() { if(rowCount() == 0 || currentRow() < 0) { return; } QString path = !m_musicSongs->isEmpty() ?m_musicSongs->at(currentRow()).getMusicPath() : QString(); if(!QDesktopServices::openUrl(QUrl(QFileInfo(path).absolutePath(), QUrl::TolerantMode))) { MusicMessageBox message; message.setText(tr("The origin one does not exsit!")); message.exec(); } }
void MusicMyDownloadRecordWidget::musicOpenFileDir() { if(rowCount() == 0 || currentRow() < 0) { return; } if(!QDesktopServices::openUrl(QUrl(QFileInfo(m_musicRecord.m_paths[currentRow()]).absolutePath(), QUrl::TolerantMode))) { MusicMessageBox message; message.setText(tr("The origin one does not exsit!")); message.exec(); } }
void MusicQueryTableWidget::createContextMenu(QMenu &menu) { menu.setStyleSheet(MusicUIObject::MMenuStyle02); m_actionGroup->addAction(menu.addAction(tr("musicDownload"))); menu.addSeparator(); QString songName = currentRow() != -1 && rowCount() > 0 ? item(currentRow(), 1)->text() : QString(); QString artistName = currentRow() != -1 && rowCount() > 0 ? item(currentRow(), 2)->text() : QString(); m_actionGroup->addAction(menu.addAction(tr("search '%1'").arg(songName))); m_actionGroup->addAction(menu.addAction(tr("search '%1'").arg(artistName))); m_actionGroup->addAction(menu.addAction(tr("search '%1 - %2'").arg(songName).arg(artistName))); }
void UISpreadsheet::somethingChanged() { /* if (autoRecalc) recalculate(); */ // emit modified(); UICell *c = cell(currentRow(),currentColumn()); c->setCell(spreadSheet->getCell(currentRow(),currentColumn())); c->setWidget(this); c->update(); cout<<"something changeeeeeeeeeeeeeeeeeeeeeeeeeeee"<<endl; // this->setCurrentCell(currentRow()+1,currentColumn()); }
void MusicSongsListWidget::mousePressEvent(QMouseEvent *event) { QTableWidget::mousePressEvent(event); //just close the rename edittext; if(m_renameActived) { closePersistentEditor(m_renameItem); } //it may be a bug in closePersistentEditor,so we select //the two if function to deal with if(m_renameActived) { (*m_musicSongs)[m_renameItem->row()].setMusicName(m_renameItem->text()); m_renameItem->setText(QFontMetrics(font()).elidedText( m_renameItem->text(), Qt::ElideRight, 243)); m_renameActived = false; } if( event->button() == Qt::LeftButton )//Press the left key { m_leftButtonPressed = true; m_dragStartIndex = currentRow(); m_dragStartPoint = event->pos(); } }
bool ButtonDelegate::editorEvent(QEvent *event, QAbstractItemModel *, const QStyleOptionViewItem &option, const QModelIndex &index) { QRect rect = option.rect; QRect rectBu(rect.left() + rect.width()/2 - 15, rect.top() + rect.height()/2 - 5, 30, 15); if (event->type() == QEvent::MouseMove) { QMouseEvent* e =(QMouseEvent*)event; if (rectBu.contains(e->x(), e->y())) { } } if (event->type() == QEvent::MouseButtonRelease) { QMouseEvent* e =(QMouseEvent*)event; if (rectBu.contains(e->x(), e->y())) { int row = index.row(); emit currentRow(row); return true; } } return false; }
void favorites2::toggleAutoMount() { auto table = m_ui->tableWidget ; if( table->rowCount() > 0 ){ auto row = table->currentRow() ; auto e = this->getEntry( row ) ; if( !e.volumePath.isEmpty() ){ auto f = e ; if( f.autoMountVolume == "true" ){ f.autoMountVolume = "false" ; }else{ f.autoMountVolume = "true" ; } m_ui->textEditAutoMount->setText( f.autoMountVolume ) ; m_settings.replaceFavorite( e,f ) ; } } }
void PlaylistWindow::selectNext() { auto qdp = currentPlaylistWidget(); int index = qdp->currentRow(); if (index < qdp->count()) qdp->setCurrentRow(index + 1); }
void UTableNotes::clickActionHide() { QTableWidgetItem *curItem = item(currentRow(), indexColumnVisible); curItem->setData(pointerOnDataColumnVisible, false); curItem->setIcon(QIcon(IconHide)); emit clickActionHideItem(); }
bool wDBTable::searchColumn( const QString & text, bool FromCurrent, bool Forward ) { QString s; uint curr = currentRow(), curc=currentColumn(), row = 0, idx; bool found = FALSE; aSQLTable *t = ( aSQLTable *) sqlCursor(); if ( FromCurrent ) row = curr; if ( Forward ) row++; else row--; idx = indexOf( curc ); while ( t->seek( row ) ){ s = t->value( idx ).toString(); if ( s.left( text.length() ) == text ) { found = TRUE; break; } if ( Forward ) row++; else row--; } if ( found ) { setCurrentCell( row, curc ); }; return found; }
void ContactListWidget::del_contact() { QMessageBox mbx; mbx.setText(QString(tr("Are you sure you want to remove user \"%1\" from your contact list?")).arg(currentItem()->text())); mbx.setIcon(QMessageBox::Question); mbx.addButton(QMessageBox::Yes); mbx.addButton(QMessageBox::No); mbx.setDefaultButton(QMessageBox::No); if (QMessageBox::Yes==mbx.exec()) { QByteArray rm_id; QListWidgetItem *rm_ptr; storage->Delete(rm_id = wgitem_to_recs[currentItem()]->id); delete (rm_ptr=takeItem(currentRow())); for(int i=0;i<contact_records.size();i++) { if (contact_records[i].id==rm_id) { contact_records.removeAt(i); break; } } wgitem_to_recs.remove(rm_ptr); } }
void MainWindow::slotMount() { auto table = m_ui->tableWidget ; int row = table->currentRow() ; this->mount( volumeEntryProperties( tablewidget::tableRowEntries( table,row ) ) ) ; }
void MTable::stopEditing() { int cCol = currentColumn(); int cRow = currentRow(); endEdit( cRow, cCol, TRUE, TRUE ); }
void Spreadsheet::findPrevious(const QString &str, Qt::CaseSensitivity cs) { int row = currentRow(); int column = currentColumn() - 1; while(row >= 0) { while(column >= 0) { if(text(row, column).contains(str, cs)) { clearSelection(); setCurrentCell(row, column); activateWindow(); return; } --column; } column = ColumnCount - 1; --row; } QApplication::beep(); }
void NShortcutEditorWidget::keyPressEvent(QKeyEvent *e) { QTableWidgetItem *currentItem = item(currentRow(), currentColumn()); QString text = currentItem->text(); int keyInt = e->key(); bool modifiers = e->modifiers() & (Qt::ControlModifier | Qt::ShiftModifier | Qt::AltModifier | Qt::MetaModifier); if (!modifiers && (keyInt == Qt::Key_Delete || keyInt == Qt::Key_Backspace)) { currentItem->setText(""); return; } QString shortcut = keyEventToString(e); if (shortcut == "") { QTableWidget::keyPressEvent(e); return; } if (text.split(", ").size() >= 3) text = ""; if (!text.isEmpty()) text += ", "; currentItem->setText(text + shortcut); }
void PlaylistWindow::selectPrevious() { auto qdp = currentPlaylistWidget(); int index = qdp->currentRow(); if (index > 0) qdp->setCurrentRow(index - 1); }
void Spreadsheet::findNext(const QString &str, Qt::CaseSensitivity cs) { int row = currentRow(); int column = currentColumn() + 1; while(row < RowCount) { while(column < ColumnCount) { if(text(row,column).contains(str, cs)) { clearSelection(); setCurrentCell(row, column); activateWindow(); return; } ++column; } column = 0; ++row; } QApplication::beep(); }
void ViewTableListWidget::showRightMenu( const QPoint & pos) { //显示右键菜单 qDebug()<<tr("视图菜单")<<pos.x()<<" "<<pos.y(); QTableWidgetItem *curItem = this->itemAt(pos); if(curItem != NULL) { curindex = currentRow(); viewfilenames.clear(); QList<QTableWidgetSelectionRange> rangelist = this->selectedRanges(); QList<QTableWidgetSelectionRange>::iterator iter = rangelist.begin(); while(iter != rangelist.end()) { QTableWidgetSelectionRange range = *iter; for(int i =range.topRow(); i<=range.bottomRow(); i++ ) viewfilenames<<item(i,0)->text(); ++iter; } } qDebug()<<viewfilenames; this->createRightMenu((int *)curItem); }
void MailListView::keyPressEvent( QKeyEvent *e ) // sharp and phone { switch( e->key() ) { case Qt::Key_Space: case Qt::Key_Return: case Qt::Key_Select: case Qt::Key_Enter: { emit clicked(currentIndex()); } break; case Qt::Key_No: case Qt::Key_Back: case Qt::Key_Backspace: { //if (!Qtopia::mousePreferred()) emit backPressed(); //else // e->ignore(); } break; default: QTableWidget::keyPressEvent( e ); } if (e->key() == Qt::Key_Up || e->key() == Qt::Key_Down) { clearSelection(); selectRow( currentRow() ); } }
/* QWidget* KVocTrainTable::beginEdit(int row, int col, bool replace) { if (KApplication::dcopClient()->isApplicationRegistered("kxkb")) { if (m_doc) { QString id = (col == KV_COL_ORG) ? m_doc->getOriginalIdent() : m_doc->getIdent(col - KV_EXTRA_COLS); if (langs) { QString kbLayout(langs->keyboardLayout(langs->indexShortId(id))); kdDebug() << "Keyboard Layout: " << kbLayout << endl; if (!kbLayout.isEmpty()) { QByteArray data, replyData; QCString replyType; QDataStream arg(data, IO_WriteOnly); arg << kbLayout; if (!KApplication::dcopClient()->call("kxkb", "kxkb", "setLayout(QString)", data, replyType, replyData)) { kdDebug() << "kxkb dcop error: beginEdit()" << endl; } } } } } return QTable::beginEdit(row, col, replace); } void KVocTrainTable::endEdit(int row, int col, bool accept, bool replace) { QTable::endEdit(row, col, accept, replace); } */ void KVocTrainTable::sortByColumn(int header, bool alpha) { if (header == KV_COL_MARK) return; if (header >= numRows()) { kdError() << "header >= numRows()\n"; return; } if (m_doc && !m_doc->isAllowedSorting()) { KMessageBox::information(this, i18n("Sorting is currently turned off for this document.\n" "\nUse the document properties dialog to turn sorting on."), kapp->makeStdCaption("")); return; } QApplication::setOverrideCursor(waitCursor); clearSelection(); bool sortdir = false; if (m_doc) { if (header >= KV_COL_ORG) sortdir = m_doc->sort(header-KV_EXTRA_COLS); else if (alpha) sortdir = m_doc->sortByLesson_alpha(); else sortdir = m_doc->sortByLesson_index(); } horizontalHeader()->setSortIndicator(header, sortdir); repaintContents(); m_doc->setModified(); emit currentChanged(currentRow(), currentColumn()); QApplication::restoreOverrideCursor(); }
QString cCustomTitleModelTable::GetCurrentModel() { if (!ModelTable) return ""; CurrentSel=currentRow()*columnCount()+currentColumn(); if (CurrentSel>=ModelTable->List.count()) CurrentSel=ModelTable->List.count()-1; if ((CurrentSel>=0)&&(CurrentSel<ModelTable->List.count())) return ModelTable->List[CurrentSel]->Name; return ""; }
int uniquePathsWithObstacles(vector<vector<int>>& obstacleGrid) { int r = obstacleGrid.size(); int c = obstacleGrid.front().size(); if(obstacleGrid.front().front() == 1 || obstacleGrid.back().back() == 1) return 0; //The currentRow will be set 0 after meet obstacle (break) vector<int> currentRow(c, 0); for(int j=0; j<c; j++) { if (obstacleGrid[0][j] == 0) currentRow[j] = 1; else break; } for(int i=1; i<r; i++) { for(int j=1; j<c; j++) { //The current one is obstacle if(obstacleGrid[i][j] == 1) currentRow[j] = 0; //The left column element is obstacle. //We don't need to change the currentRow[j], because you can only come from up size which is currentRow[j] if(obstacleGrid[i][j-1] == 1) currentRow[j - 1] = 0; //The left and up is non-obstacle/ if(obstacleGrid[i][j] != 1 && obstacleGrid[i][j-1] != 1) currentRow[j] += currentRow[j-1]; } } return currentRow[c-1]; }
// ---------------------------------------------------------------------- // ---------------------------------------------------------------------- void QmvTable::activateNextCell() { int col = currentColumn() + 1; int row = currentRow(); bool eot = false; if ( col >= numCols() ) if ( row >= numRows() ) col--; else { col = 0; if ( row < (numRows() - 1) ) row++; else eot = true; } setCurrentCell( row, col ); // if we are in the last cell of table, the edit will not // automatically end the edit. if ( eot ) editCompleted(); ensureCellVisible( row, col ); }
void BaseFilterWidget::toggleFilter(bool checked) { setVisible(checked); if (checked) applyFilter(currentRow()); else applyFilter(0); }
void FileList::on_customContextMenuRequested(const QPoint&) { int row = currentRow(); if (row == -1 || (row == 0 && st->isMerge())) // header clicked return; emit contextMenu(currentText(), QGit::POPUP_FILE_EV); }
void GroupWidget::delItem() { int row = currentRow(); Group *grp = (Group *)groupListWidget->takeItem(row); groupList->takeAt(row); delete grp; // resetButtons(); }
// Keep the list of message headers scrolled hard to the left void MailListView::scrollToLeft(int) { // In right to left mode when the horizontal header is hidden a // phantom 70 pixel column appears. Scroll this out of the way. // It would be better to fix this elsewhere (in QTableWidget?) if (currentColumn() != 0) setCurrentCell( currentRow(), 0 ); horizontalScrollBar()->setValue( 0 ); }
void TableWidget::insertCutRows(){ if(cutRows_.size()==0 || currentRow()==-1){ return; } bool sortEnabled = this->isSortingEnabled(); setSortingEnabled(false); for(int i=0;i<cutRows_.size();i++){ this->insertRow(currentRow()); QList<TableWidgetItem*> row = cutRows_[i]; for(int j=0;j<row.size();j++){ TableWidgetItem* item_ = row[j]; this->setItem(currentRow(),j,item_); } } cutRows_.clear(); this->setSortingEnabled(sortEnabled); }