本文整理汇总了C++中QTableWidgetItem::isSelected方法的典型用法代码示例。如果您正苦于以下问题:C++ QTableWidgetItem::isSelected方法的具体用法?C++ QTableWidgetItem::isSelected怎么用?C++ QTableWidgetItem::isSelected使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTableWidgetItem
的用法示例。
在下文中一共展示了QTableWidgetItem::isSelected方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: supprimerInscription
void DossierEditeur::supprimerInscription()
{
try
{
QTableWidgetItem* ItemSupp = dossier->item(dossier->currentRow(),0);
if(ItemSupp==NULL || !ItemSupp->isSelected())
throw UTProfilerException("Sélectionner une inscription !");
QString c = ItemSupp->text();
//Demande à l'utilisateur s'il es sûr de son choix
int reponse = QMessageBox::question(this,"Suppression de " + c, "Voulez vous vraiment supprimer cette inscription ?", QMessageBox::Yes | QMessageBox::No);
if(reponse == QMessageBox::Yes) //Vérifie si l'utilisateur a choisi oui
{
Inscription i = Dossier::getInstance().getInscription(c);
Dossier::getInstance().supprimerInscription(i);
dossier->clearContents();
dossier->setRowCount(Dossier::getInstance().getTaille());
initialiserDossier();
//InitialisationCat();
QMessageBox::information(this,"Suppression d'inscription","Inscription supprimée");
}
}
catch(UTProfilerException& e)
{
QMessageBox::warning(this,"Suppression d'inscription",e.getInfo());
}
}
示例2: slot_DeleteRows
void SettingsPagePointDataLoading::slot_DeleteRows()
{
if( m_fileTable->rowCount() == 0 || m_fileTable->columnCount() != 1 )
{
return;
}
QList<QTableWidgetItem *> items = m_fileTable->selectedItems();
if( items.size() == 0 )
{
// no selection is active
return;
}
QMessageBox mb( QMessageBox::Question,
tr( "Delete?" ),
tr( "Delete selected entries?" ),
QMessageBox::Yes | QMessageBox::No,
this );
mb.setDefaultButton( QMessageBox::No );
#ifdef ANDROID
mb.show();
QPoint pos = mapToGlobal(QPoint( width()/2 - mb.width()/2, height()/2 - mb.height()/2 ));
mb.move( pos );
#endif
if( mb.exec() == QMessageBox::No )
{
return;
}
for( int i = m_fileTable->rowCount() - 1; i >= 0; i-- )
{
QTableWidgetItem *item = m_fileTable->item( i, 0 );
if( item->isSelected() )
{
QString fn = item->data( Qt::UserRole ).toString();
// Remove source file from disk
QFile::remove( fn );
// Remove compiled file from disk
fn = fn.replace( fn.size() - 1, 1 , QChar('c') );
QFile::remove( fn );
// Remove row from table
m_fileTable->removeRow( i );
}
}
m_fileTable->resizeColumnsToContents();
m_fileTable->resizeRowsToContents();
}
示例3: paint
void TupLayerIndexItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem & option, const QModelIndex & index) const
{
QItemDelegate::paint(painter, option, index);
TupLayerIndex *table = qobject_cast<TupLayerIndex *>(index.model()->parent());
QTableWidgetItem *item = table->itemFromIndex(index);
if (item) {
if (item->isSelected()) {
painter->setPen(QPen(QColor(255, 190, 31, 255), 1));
painter->drawRect(option.rect.normalized().adjusted(1,1,-2, -2));
}
}
}
示例4: isSelected
int TableWidgetItem::isSelected ( lua_State * L )// const bool
{
QTableWidgetItem* lhs = ValueInstaller2<QTableWidgetItem>::check( L, 1 );
Util::push( L, lhs->isSelected() );
return 1;
}