本文整理汇总了C++中QTableWidgetItem::row方法的典型用法代码示例。如果您正苦于以下问题:C++ QTableWidgetItem::row方法的具体用法?C++ QTableWidgetItem::row怎么用?C++ QTableWidgetItem::row使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTableWidgetItem
的用法示例。
在下文中一共展示了QTableWidgetItem::row方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setBookmarkToRow
void EditBookmarksDialog::setBookmarkToRow(int ARow, const IBookmark &ABookmark)
{
QTableWidgetItem *nameItem = new QTableWidgetItem;
nameItem->setText(ABookmark.name);
if (ABookmark.type==IBookmark::TypeRoom && ABookmark.room.autojoin)
{
QFont font = nameItem->font();
font.setBold(true);
nameItem->setFont(font);
}
nameItem->setData(TDR_TYPE,ABookmark.type);
nameItem->setData(TDR_NAME,ABookmark.name);
nameItem->setData(TDR_ROOMJID,ABookmark.room.roomJid.bare());
nameItem->setData(TDR_AUTO,ABookmark.room.autojoin);
nameItem->setData(TDR_NICK,ABookmark.room.nick);
nameItem->setData(TDR_PASSWORD,ABookmark.room.password);
nameItem->setData(TDR_URL,ABookmark.url.url.toString());
ui.tbwBookmarks->setItem(ARow,COL_NAME,nameItem);
QTableWidgetItem *valueItem = new QTableWidgetItem;
valueItem->setText(ABookmark.type==IBookmark::TypeUrl ? ABookmark.url.url.toString() : ABookmark.room.roomJid.uBare());
ui.tbwBookmarks->setItem(nameItem->row(),COL_VALUE,valueItem);
QTableWidgetItem *nickItem = new QTableWidgetItem;
nickItem->setText(ABookmark.room.nick);
ui.tbwBookmarks->setItem(nameItem->row(),COL_NICK,nickItem);
QTableWidgetItem *sortItem = new QTableWidgetItem;
sortItem->setText(nameItem->text());
ui.tbwBookmarks->setItem(nameItem->row(),COL_SORT,sortItem);
}
示例2: provideContextMenu
void LogViewerForm::provideContextMenu(const QPoint& p)
{
QTableWidgetItem* item = ui->tableWidget->itemAt(p);
if (item != NULL && item->backgroundColor() == HighlightColor) {
QAction* const action = mMenu->exec(mapToGlobal(p));
if (action != NULL) {
bool ok = false;
const int selected = ui->tableWidget->item(item->row(), 1)->text().toInt(&ok);
Q_ASSERT(ok);
const int generation = ui->tableWidget->item(item->row(), 2)->text().toInt(&ok);
Q_ASSERT(ok);
switch (action->data().toInt())
{
case ShowPicture:
emit showPicture(generation, selected);
break;
case CopyToClipboard:
emit copyPicture(generation, selected);
break;
case GoToFolder:
emit gotoPicture(generation, selected);
break;
default:
#ifndef QT_NO_DEBUG
qWarning() << "unknown command:" << action->data().toInt();
#endif
break;
}
}
}
}
示例3:
void GamesList::eraseAll()
{
std::map< int, std::list< QTableWidgetItem* > >::const_iterator it = _rowList.begin();
for (; it != _rowList.end(); ++it)
{
std::list< QTableWidgetItem* > list = (*it).second;
QTableWidgetItem *frontItem = list.front();
QTableWidgetItem *backItem = list.back();
_gameList->removeCellWidget(frontItem->row(), frontItem->column());
_gameList->removeCellWidget(backItem->row(), frontItem->column());
list.remove(frontItem);
list.remove(backItem);
delete frontItem;
delete backItem;
}
_gameList->setRowCount(0);
_rowList.clear();
}
示例4: slotAdjustKeyframePos
void KeyframeEdit::slotAdjustKeyframePos(int value)
{
QTableWidgetItem *item = keyframe_list->currentItem();
keyframe_list->verticalHeaderItem(item->row())->setText(getPosString(value));
slotGenerateParams(item->row(), -1);
if (KdenliveSettings::keyframeseek())
emit seekToPos(value - m_min);
}
示例5: onPackageReportItemSelectionChanged
void ClassSpaceChecker::onPackageReportItemSelectionChanged()
{
QList<QTableWidgetItem *> items = ui.tableWidgetPackageReport->selectedItems();
if(items.size() <= 0)
{
ui.lineEdit_Result->setText(prevTotalResultStr_);
return;
}
QSet<int> set;
int classCount = 0;
int uniqueClassCount = 0;
int diffClassCount = 0;
int totalSize = 0;
for(int i = 0; i < items.size(); i++)
{
QTableWidgetItem *item = items.at(i);
int row = item->row();
if(set.find(row) != set.end())
continue;
QTableWidgetItem *itemClassCount = ui.tableWidgetPackageReport->item(item->row(), 1);
if(itemClassCount == NULL)
continue;
classCount += itemClassCount->data(Qt::DisplayRole).toInt();
QTableWidgetItem *itemUniqueClassCount = ui.tableWidgetPackageReport->item(item->row(), 2);
if(itemUniqueClassCount == NULL)
continue;
uniqueClassCount += itemUniqueClassCount->data(Qt::DisplayRole).toInt();
QTableWidgetItem *itemDiffClassCount = ui.tableWidgetPackageReport->item(item->row(), 3);
if(itemDiffClassCount == NULL)
continue;
diffClassCount += itemDiffClassCount->data(Qt::DisplayRole).toInt();
QTableWidgetItem *itemFileSize = ui.tableWidgetPackageReport->item(item->row(), 5);
if(itemFileSize == NULL)
continue;
totalSize += itemFileSize->data(Qt::DisplayRole).toInt();
set.insert(row);
}
QString resultStr;
resultStr += "All Class Count : ";
resultStr += QString::number(classCount);
resultStr += ", Unique Class Count : ";
resultStr += QString::number(uniqueClassCount);
resultStr += ", Diff Class Count : ";
resultStr += QString::number(diffClassCount);
resultStr += ", File Size : ";
resultStr += numberDot(QString::number(totalSize));
resultStr += " bytes";
ui.lineEdit_Result->setText(resultStr);
}
示例6: onEditButtonClicked
void EditBookmarksDialog::onEditButtonClicked()
{
QPushButton *button = qobject_cast<QPushButton *>(sender());
if (button == ui.pbtAdd)
{
IBookmark bookmark;
if (FBookmarks->showEditBookmarkDialog(&bookmark,this)->exec() == QDialog::Accepted)
{
ui.tbwBookmarks->setRowCount(ui.tbwBookmarks->rowCount()+1);
setBookmarkToRow(ui.tbwBookmarks->rowCount()-1,bookmark);
}
}
else if (button == ui.pbtEdit)
{
int row = ui.tbwBookmarks->currentRow();
if (row >= 0)
{
IBookmark bookmark = getBookmarkFromRow(row);
if (FBookmarks->showEditBookmarkDialog(&bookmark,this)->exec() == QDialog::Accepted)
setBookmarkToRow(row,bookmark);
}
}
else if (button == ui.pbtDelete)
{
QTableWidgetItem *tableItem = ui.tbwBookmarks->currentItem();
if (tableItem)
ui.tbwBookmarks->removeRow(tableItem->row());
}
else if (button == ui.pbtMoveUp)
{
QTableWidgetItem *tableItem = ui.tbwBookmarks->currentItem();
if (tableItem && tableItem->row()>0)
{
int row = tableItem->row();
IBookmark bookmark1 = getBookmarkFromRow(row);
IBookmark bookmark2 = getBookmarkFromRow(row-1);
setBookmarkToRow(row,bookmark2);
setBookmarkToRow(row-1,bookmark1);
ui.tbwBookmarks->setCurrentCell(row-1,COL_NAME);
}
}
else if (button == ui.pbtMoveDown)
{
QTableWidgetItem *tableItem = ui.tbwBookmarks->currentItem();
if (tableItem && tableItem->row()<ui.tbwBookmarks->rowCount()-1)
{
int row = tableItem->row();
IBookmark bookmark1 = getBookmarkFromRow(row);
IBookmark bookmark2 = getBookmarkFromRow(row+1);
setBookmarkToRow(row,bookmark2);
setBookmarkToRow(row+1,bookmark1);
ui.tbwBookmarks->setCurrentCell(row+1,COL_NAME);
}
}
}
示例7: provideContextMenu
/*! @brief Called when the queue is right clicked.
Connected to the customContextMenuRequested signal from the queue. It creates and displays a menu.
*/
void Queue::provideContextMenu(QPoint p) {
QTableWidgetItem* item = itemAt(p);
if (item->column() == 0 && item->row() != 0) {
rowToRemove = item->row();
QMenu menu;
QAction* remove = new QAction("Remove", this);
connect(remove, SIGNAL(triggered()), this, SLOT(removeAction()));
menu.addAction(remove);
menu.exec(QCursor::pos());
}
}
示例8: apply
void ArchiveAccountOptionsWidget::apply()
{
if (FSaveRequests.isEmpty())
{
IArchiveStreamPrefs prefs = FArchiver->archivePrefs(FStreamJid);
prefs.methodLocal = ui.cmbMethodLocal->itemData(ui.cmbMethodLocal->currentIndex()).toString();
prefs.methodAuto = ui.cmbMethodAuto->itemData(ui.cmbMethodAuto->currentIndex()).toString();
prefs.methodManual = ui.cmbMethodManual->itemData(ui.cmbMethodManual->currentIndex()).toString();
prefs.defaultPrefs.otr = ui.cmbModeOTR->itemData(ui.cmbModeOTR->currentIndex()).toString();
prefs.defaultPrefs.save = ui.cmbModeSave->itemData(ui.cmbModeSave->currentIndex()).toString();
prefs.defaultPrefs.expire = ui.cmbExpireTime->itemData(ui.cmbExpireTime->currentIndex()).toInt();
foreach(const Jid &itemJid, FTableItems.keys())
{
QTableWidgetItem *jidItem = FTableItems.value(itemJid);
prefs.itemPrefs[itemJid].save = ui.tbwItemPrefs->item(jidItem->row(),COL_SAVE)->data(Qt::UserRole).toString();
prefs.itemPrefs[itemJid].otr = ui.tbwItemPrefs->item(jidItem->row(),COL_OTR)->data(Qt::UserRole).toString();
prefs.itemPrefs[itemJid].expire = ui.tbwItemPrefs->item(jidItem->row(),COL_EXPIRE)->data(Qt::UserRole).toInt();
prefs.itemPrefs[itemJid].exactmatch = ui.tbwItemPrefs->item(jidItem->row(),COL_EXACT)->data(Qt::UserRole).toBool();
}
foreach(const Jid &itemJid, prefs.itemPrefs.keys())
{
if (!FTableItems.contains(itemJid))
{
if (FArchiver->isSupported(FStreamJid,NS_ARCHIVE_PREF))
{
QString requestId = FArchiver->removeArchiveItemPrefs(FStreamJid,itemJid);
if (!requestId.isEmpty())
FSaveRequests.append(requestId);
prefs.itemPrefs.remove(itemJid);
}
else
{
prefs.itemPrefs[itemJid].otr = QString::null;
prefs.itemPrefs[itemJid].save = QString::null;
}
}
}
QString requestId = FArchiver->setArchivePrefs(FStreamJid,prefs);
if (!requestId.isEmpty())
FSaveRequests.append(requestId);
if (prefs.autoSave != ui.chbAutoSave->isChecked())
{
requestId = FArchiver->setArchiveAutoSave(FStreamJid,ui.chbAutoSave->isChecked());
if (!requestId.isEmpty())
FSaveRequests.append(requestId);
}
FLastError = XmppError::null;
updateWidget();
}
示例9: qDebug
void
MainWindow::removeSelectedSegment()
{
QList<QTableWidgetItem *> sel = ui->segmentsTable->selectedItems();
if (sel.isEmpty())
return;
QTableWidgetItem * item = sel.front();
qDebug() << "Removing segment" << item->row() << "with label" << item->text();
model->removeSegment(item->row());
ui->segmentsTable->removeRow(item->row());
}
示例10: deleteItem
void ArchivingRulesDialog::deleteItem()
{
_changed = true;
saveBtn->setDisabled(false);
QList<QTableWidgetItem*> selectedItems = archivingItemsTbl->selectedItems();
QList<int> itemsToRemove;
QTableWidgetItem* item;
if (selectedItems.size() > 0)
{
itemsToRemove.clear();
for(int i=0; i<selectedItems.size(); i++)
{
item = selectedItems.at(i);
if(item->column() != 0)
continue;
itemsToRemove.push_front(item->row());
}
qSort(itemsToRemove.begin(), itemsToRemove.end());
for(int i = 0; i < itemsToRemove.size();)
archivingItemsTbl->removeRow(itemsToRemove.takeLast());
}
}
示例11: convertToTsaiCamera
void PhotoTexturingWidget::convertToTsaiCamera(){
QString dir;
if (lastDirectory == ""){
dir=".";
}else{
dir = lastDirectory;
}
QString filename = QFileDialog::getSaveFileName(this,tr("Select Tsai Calibration File"),".", "*.cam");
if(!filename.isNull()){
QFileInfo finfo(filename);
lastDirectory = finfo.absolutePath();
QList <QTableWidgetItem*>list = ui.cameraTableWidget->selectedItems();
bool optimize;
QMessageBox messageBox(QMessageBox::Question, "Convert to Tsai Camera", "Use optimization mode for Tsai calibration?",
QMessageBox::Yes|QMessageBox::No , this);
messageBox.setWindowModality(Qt::WindowModal);
int returnValue = messageBox.exec();
if(returnValue == QMessageBox::No)
{
optimize = false;
} else{
optimize = true;
}
if (list.size()>0){
QTableWidgetItem* item = list.at(0);
int row = item->row();
photoTexturer->convertToTsaiCamera(row,optimize,filename,mesh);
}
}
}
示例12: updatePlugins
void SetupPluginsDialog::updatePlugins()
{
FItemElement.clear();
ui.twtPlugins->clearContents();
ui.twtPlugins->setRowCount(0);
QDomElement pluginElem = FPluginsSetup.documentElement().firstChildElement();
while (!pluginElem.isNull())
{
QString name = pluginElem.firstChildElement("name").text().isEmpty() ? pluginElem.tagName() : pluginElem.firstChildElement("name").text();
QTableWidgetItem *nameItem = new QTableWidgetItem(name);
if (pluginElem.attribute("enabled","true")=="true")
{
if (FPluginManager->pluginInstance(pluginElem.attribute("uuid"))==NULL)
nameItem->setForeground(Qt::red);
nameItem->setCheckState(Qt::Checked);
}
else
{
nameItem->setForeground(Qt::gray);
nameItem->setCheckState(Qt::Unchecked);
}
nameItem->setCheckState(pluginElem.attribute("enabled","true")=="true" ? Qt::Checked : Qt::Unchecked);
QTableWidgetItem *fileItem = new QTableWidgetItem(pluginElem.tagName());
ui.twtPlugins->setRowCount(ui.twtPlugins->rowCount()+1);
ui.twtPlugins->setItem(ui.twtPlugins->rowCount()-1, COL_NAME, nameItem);
ui.twtPlugins->setItem(nameItem->row(), COL_FILE, fileItem);
FItemElement.insert(nameItem,pluginElem);
pluginElem = pluginElem.nextSiblingElement();
}
ui.twtPlugins->sortItems(COL_NAME,Qt::AscendingOrder);
}
示例13: on_tbtProperties_clicked
void QuizGroupView::on_tbtProperties_clicked()
{
QTableWidgetItem *item = ui->table->selectedItems()[0];
QuizCell *cell = (QuizCell *)(ui->table->cellWidget(item->row(), item->column()));
QuizNode *node = cell->node();
node->editProperties();
}
示例14:
void
TransitionEditorWindow::on_equationsTree_itemClicked(QTreeWidgetItem* item, int /*column*/)
{
qDebug("on_equationsTree_itemClicked");
if (model_ == nullptr) return;
if (transition_ == nullptr) return;
if (item == nullptr) return;
QTreeWidgetItem* parent = item->parent();
if (parent == nullptr) { // root item
ui_->formulaTextEdit->clear();
return;
}
int parentIndex = ui_->equationsTree->indexOfTopLevelItem(parent);
int index = parent->indexOfChild(item);
const auto& equation = model_->equationGroupList()[parentIndex].equationList[index];
// Set timeExpression for the current point.
QTableWidgetItem* currentItem = ui_->pointsTable->currentItem();
if (currentItem == nullptr) return;
int row = currentItem->row();
if (pointList_[row].timeExpression.lock() != equation) {
pointList_[row].timeExpression = equation;
updateTransition();
}
}
示例15: OnReturnPressed
void qtDLGAttach::OnReturnPressed()
{
if(tblProcList->selectedItems().count() <= 0) return;
QTableWidgetItem *pItem = tblProcList->selectedItems()[0];
OnProcessDoubleClick(pItem->row(),pItem->column());
}