当前位置: 首页>>代码示例>>C++>>正文


C++ QTableWidgetItem::isSelected方法代码示例

本文整理汇总了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());
    }
}
开发者ID:atchandj,项目名称:LO21,代码行数:27,代码来源:DossierEditeur.cpp

示例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();
}
开发者ID:Exadios,项目名称:Cumulus,代码行数:59,代码来源:SettingsPagePointDataLoading.cpp

示例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));
        }
    }
}
开发者ID:nanox,项目名称:tupi,代码行数:14,代码来源:tuplayerindex.cpp

示例4: isSelected

 int TableWidgetItem::isSelected ( lua_State * L )// const bool
 {
	 QTableWidgetItem* lhs = ValueInstaller2<QTableWidgetItem>::check( L, 1 );
	 Util::push( L, lhs->isSelected() );
	 return 1;
 }
开发者ID:Wushaowei001,项目名称:NAF,代码行数:6,代码来源:QtlTableWidgetItem.cpp


注:本文中的QTableWidgetItem::isSelected方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。