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


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

本文整理汇总了C++中QTableWidgetItem::column方法的典型用法代码示例。如果您正苦于以下问题:C++ QTableWidgetItem::column方法的具体用法?C++ QTableWidgetItem::column怎么用?C++ QTableWidgetItem::column使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QTableWidgetItem的用法示例。


在下文中一共展示了QTableWidgetItem::column方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: on_tableWidget_customContextMenuRequested

void DialogUsers::on_tableWidget_customContextMenuRequested(const QPoint &pos)
{
    QTableWidgetItem *q = ui->tableWidget->itemAt(pos);
    if ( q == NULL ) return;
    ui->tableWidget->selectRow(q->row()); // fix bug with quick right click

    contextTableMenu->actions().at(2)->setEnabled( ( QVariant(ui->tableWidget->item(q->row(),0)->data(DataRole::deleted)).toInt() == 0 )
                                                   and Act::userPermission(Act::editDirection,currentUserRights));
    contextTableMenu->actions().at(4)->setEnabled( ( QVariant(ui->tableWidget->item(q->row(),0)->data(DataRole::deleted)).toInt() == 1 )
                                                   and Act::userPermission(Act::editDirection,currentUserRights));

    QAction* selectedItem = contextTableMenu->exec(QCursor::pos());
    if ( !selectedItem ) return;
    if ( selectedItem->text() == "Добавить")
    {
        addNewUser();
    } else if ( selectedItem->text() == "Править")
    {
        ui->tableWidget->setCurrentCell(q->row(),q->column());
        editUser();
    } else if ( selectedItem->text() == "Удалить")
    {
        ui->tableWidget->setCurrentCell(q->row(),q->column());
        deleteUser();
    } else if ( selectedItem->text() == "Восстановить")
    {
        ui->tableWidget->setCurrentCell(q->row(),q->column());
        restoreUser();
    }
}
开发者ID:OrbMind,项目名称:daybook,代码行数:30,代码来源:dialogusers.cpp

示例2:

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();
}
开发者ID:alex-min,项目名称:rtype-2014-minetta,代码行数:25,代码来源:GamesList.cpp

示例3: loadClicked

void VolumeListingDialog::loadClicked() {
    std::vector<VolumeOrigin> selectedOrigins;

    // map selected rows to origins by comparing url column to origin url
    QList<QTableWidgetItem*> selectedItems = table_->selectedItems();
    int urlColumn = table_->columnCount()-1; // last columns contains URL
    for (int i=0; i<selectedItems.size(); i++) {
        QTableWidgetItem* item = selectedItems.at(i);
        if (item->column() == urlColumn) {
            std::string url = item->text().toStdString();
            for (size_t j=0; j<filteredOrigins_.size(); j++) {
                VolumeOrigin& origin = filteredOrigins_.at(j);
                if (origin.getURL() == url) {
                    selectedOrigins.push_back(origin);
                    break;
                }
            }
        }
    }

    if (!selectedOrigins.empty()) {
        close();
        emit(originsSelected(selectedOrigins, reader_));
    }
    else {
        LWARNINGC("voreen.qt.VolumeListingDialog", "no origins selected");
    }
}
开发者ID:bsmr-opengl,项目名称:voreen,代码行数:28,代码来源:volumelistingdialog.cpp

示例4: slotAdjustKeyframeInfo

void KeyframeEdit::slotAdjustKeyframeInfo(bool seek)
{
    QTableWidgetItem *item = keyframe_list->currentItem();
    if (!item)
        return;
    int min = m_min;
    int max = m_max;
    QTableWidgetItem *above = keyframe_list->item(item->row() - 1, item->column());
    QTableWidgetItem *below = keyframe_list->item(item->row() + 1, item->column());
    if (above)
        min = getPos(above->row()) + 1;
    if (below)
        max = getPos(below->row()) - 1;

    m_position->blockSignals(true);
    m_position->setRange(min, max, true);
    m_position->setPosition(getPos(item->row()));
    m_position->blockSignals(false);
    QLocale locale;

    for (int col = 0; col < keyframe_list->columnCount(); ++col) {
        DoubleParameterWidget *doubleparam = static_cast <DoubleParameterWidget*>(m_slidersLayout->itemAtPosition(col, 0)->widget());
        if (!doubleparam)
            continue;
        doubleparam->blockSignals(true);
        if (keyframe_list->item(item->row(), col)) {
            doubleparam->setValue(locale.toDouble(keyframe_list->item(item->row(), col)->text()));
        } else {
            //qDebug() << "Null pointer exception caught: http://www.kdenlive.org/mantis/view.php?id=1771";
        }
        doubleparam->blockSignals(false);
    }
    if (KdenliveSettings::keyframeseek() && seek)
        emit seekToPos(m_position->getPosition() - m_min);
}
开发者ID:alstef,项目名称:kdenlive,代码行数:35,代码来源:keyframeedit.cpp

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

示例6: 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());
  }
}
开发者ID:gqueiroz,项目名称:terrama2,代码行数:29,代码来源:ArchivingRulesDialog.cpp

示例7: OnReturnPressed

void qtDLGAttach::OnReturnPressed()
{
	if(tblProcList->selectedItems().count() <= 0) return;

	QTableWidgetItem *pItem = tblProcList->selectedItems()[0];

	OnProcessDoubleClick(pItem->row(),pItem->column());
}
开发者ID:SamirMahmudzade,项目名称:Nanomite,代码行数:8,代码来源:qtDLGAttach.cpp

示例8: 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());
    }
}
开发者ID:dtamayo,项目名称:OGRE,代码行数:15,代码来源:Queue.cpp

示例9: timerEvent

void QuizGroupView::timerEvent (QTimerEvent *)
{
	ui->tbtMoveUp->setEnabled(ui->table->rowCount()>0 && !ui->table->item(0, 0)->isSelected() && ui->table->selectedItems().count()>0);
	ui->tbtMoveDown->setEnabled(ui->table->rowCount()>0 && !ui->table->item(ui->table->rowCount()-1, 0)->isSelected() && ui->table->selectedItems().count()>0);
	ui->tbtUpLevel->setEnabled(node()->parent()!=NULL);
    if (ui->table->selectedItems().count()>0)
    {
        QTableWidgetItem *item = ui->table->selectedItems()[0];
        QuizCell *cell = (QuizCell *)(ui->table->cellWidget(item->row(), item->column()));
        QuizNode *node = cell->node();
        ui->tbtProperties->setEnabled(node->hasProperties());
    }
	ui->tbtRemove->setEnabled(ui->table->selectedItems().count()>0);
}
开发者ID:gumbert,项目名称:mentor2,代码行数:14,代码来源:quizgroup_quiznodeview.cpp

示例10: selectionChanged

void MainWindow::selectionChanged() {
    QList<NetNode*> selectedNodes;
    QList<QTableWidgetItem*> items = ui->tableWidget->selectedItems();

    for(int i=0; i<items.size(); i++) {
        QTableWidgetItem* item = items[i];

        if(item->column() == 0) {
            NetNode* node = network->getNode(item->text());
            selectedNodes.push_back(node);
        }
    }

    netgraphics->updateSelection(selectedNodes);
}
开发者ID:sevenbitbyte,项目名称:fctdev,代码行数:15,代码来源:mainwindow.cpp

示例11:

std::vector<QString>
UnusedAudioSelectionDialog::getSelectedAudioFileNames() const
{
    std::vector<QString> selectedNames;

    QList<QTableWidgetItem *> sItems = m_listView->selectedItems();
    QTableWidgetItem *item;
    
    for (int i = 0; i < sItems.size(); i++) {
            item = sItems.at(i);
            // Only reutrn items from column 0, which contains the filename
            // we're after:
            if (item->column() == 0) selectedNames.push_back(item->text());
    }

    return selectedNames;
};
开发者ID:EQ4,项目名称:RosegardenW,代码行数:17,代码来源:UnusedAudioSelectionDialog.cpp

示例12: accepted

// Accept button:  set up to return editID pre-filter information
void US_SelectEdits::accepted()
{
   editIDs.clear();

   QList< QTableWidgetItem* > selitems = tw_data->selectedItems();

   if ( selitems.size() == 0 )
   {
      QMessageBox::information( this,
            tr( "No Data Selected" ),
            tr( "You have not selected any data.\nSelect or Cancel" ) );
      return;
   }

   // Get and return editIDs from selected runID items
   elabels                   = editmap.keys();

   for ( int ii = 0; ii < selitems.size(); ii++ )
   {  // Loop thru selected runIDs
      QTableWidgetItem* twi  = selitems.at( ii );
      if ( twi->column() != 0 )
      {
         int row  = twi->row();
         twi      = tw_data->item( row, 0 );
      }
      QString     rlabel = twi->text() + " :";

      // Get a list of edit items whose label contains runID label
      QStringList elabs  = elabels.filter( rlabel );

      for ( int jj = 0; jj < elabs.size(); jj++ )
      {  // Return editIDs from each edit in a run
         QString editID = editmap[ elabs[ jj ] ].editID;

         if ( ! editIDs.contains( editID ) )
            editIDs << editID;
      }
   }
qDebug() << "Acpt: editIDs size" << editIDs.size();
qDebug() << "Acpt: editIDs" << editIDs;

   accept();        // Signal that selection was accepted
   close();
}
开发者ID:svn2github,项目名称:UltraScan3,代码行数:45,代码来源:us_select_edits.cpp

示例13: eventFilter


//.........这里部分代码省略.........
        mainLayout->addLayout(tableLayout);
        setLayout(mainLayout);
    }

    //****************************************************************************/
    QtLayerWidget::~QtLayerWidget(void)
    {
        QVector<QtLayer*>::iterator it;
        for (it = mLayerVec.begin(); it != mLayerVec.end(); ++it)
            delete *it;

        mLayerVec.clear(); // The table is automatically deleted when this widget is deleted
    }

    //****************************************************************************/
    bool QtLayerWidget::eventFilter(QObject* object, QEvent* event)
    {
        QMouseEvent* mouseEvent = (QMouseEvent*) event;
        switch ((int) event->type())
        {
            case QEvent::MouseButtonPress:
                mouseClickHandler(mouseEvent);
            break;

            case QEvent::MouseButtonDblClick:
                mouseDblClickHandler(mouseEvent);
            break;

            case QEvent::Drop:
                dropHandler(object, event);
            break;
        }
        return QObject::eventFilter(object, event);
    }

    //****************************************************************************/
    void QtLayerWidget::tableClicked(QModelIndex index)
    {
        // Toggle visibility
        int row = index.row();
        int col = index.column();
        QtLayer* layer = mLayerVec.at(row);
        if (col == TOOL_LAYER_COLUMN_VISIBILITY)
        {
            if (layer->visible == true)
                updateVisibilityIcon(row, false);
            else
                updateVisibilityIcon(row, true);
        }

        // Set associated sceneview to visible (if mSceneView available)
        if (mSceneViewWidget)
            mSceneViewWidget->setSceneViewVisible(layer->layerId);

        // Signal that layer is selected
        emit layerSelected(layer->layerId, layer->name);
}

    //****************************************************************************/
    void QtLayerWidget::mouseClickHandler(QMouseEvent* event)
    {
        switch ((int) event->button())
        {
            case Qt::LeftButton:
            {
                // TODO
            }
            break;

            case Qt::RightButton:
            {
                QPoint pos;
                pos.setX(event->screenPos().x());
                pos.setY(event->screenPos().y());
                mContextMenu->popup(pos);
            }
            break;
        }
    }

    //****************************************************************************/
    void QtLayerWidget::mouseDblClickHandler(QMouseEvent* event)
    {
        switch ((int) event->button())
        {
            case Qt::LeftButton:
            {
                if (mTable->currentColumn() == TOOL_LAYER_COLUMN_NAME)
                {
                    QTableWidgetItem* item = mTable->currentItem();
                    if (item->column() == TOOL_LAYER_COLUMN_NAME)
                    {
                        // Its the name; edit it
                        mTable->editItem(item);
                    }
                }
            }
            break;
        }
    }
开发者ID:galek,项目名称:Magus,代码行数:101,代码来源:tool_layerwidget.cpp

示例14: eventFilter


//.........这里部分代码省略.........
PaintLayerWidget::~PaintLayerWidget(void)
{
    QVector<QtLayer*>::iterator it;
    for (it = mLayerVec.begin(); it != mLayerVec.end(); ++it)
        delete *it;

    mLayerVec.clear(); // The table is automatically deleted when this widget is deleted
}

//****************************************************************************/
bool PaintLayerWidget::eventFilter(QObject* object, QEvent* event)
{
    QMouseEvent* mouseEvent = (QMouseEvent*) event;
    switch ((int) event->type())
    {
        case QEvent::MouseButtonPress:
            mouseClickHandler(mouseEvent);
        break;

        case QEvent::MouseButtonDblClick:
            mouseDblClickHandler(mouseEvent);
        break;

        break;
    }
    return QObject::eventFilter(object, event);
}

//****************************************************************************/
void PaintLayerWidget::tableClicked(QModelIndex index)
{
    // Toggle visibility
    int row = index.row();
    int col = index.column();
    QtLayer* layer = mLayerVec.at(row);
    if (col == TOOL_LAYER_COLUMN_VISIBILITY)
    {
        if (layer->visible)
            updateVisibilityIcon(row, false);
        else
            updateVisibilityIcon(row, true);
    }

    // Signal that layer is selected
    emit layerSelected(layer->layerId, layer->name);
}

//****************************************************************************/
QVector<int> PaintLayerWidget::getSelectedLayerIds(void)
{
    helperIntVector.clear();
    QList<QTableWidgetItem*> itemList = mTable->selectedItems();
    foreach(QTableWidgetItem* item, itemList)
    {
        // Do not append all items, but only the rows; so only mark in case of a distinct column
        if (item->column() == TOOL_LAYER_COLUMN_ICON)
            helperIntVector.append(item->data(Qt::UserRole).toInt());
    }

    return helperIntVector;
}

//****************************************************************************/
void PaintLayerWidget::mouseClickHandler(QMouseEvent* event)
{
    switch ((int) event->button())
开发者ID:spookyboo,项目名称:HLMSEditor,代码行数:67,代码来源:paintlayer_widget.cpp

示例15: showContextMenu

// context menu for table
void PublicTalks::showContextMenu(const QPoint &pos)
{
    qDebug() << "context menu" << pos.x() << pos.y();
    QMenu myMenu;
    myMenu.addAction(tr("Show Details..."));

    QTableWidgetItem *item = etable->itemAt(pos);
    if (!item) {
        qDebug() << "empty area";
        return;
    }
    if (item->column() != 1 || item->row() == 0) return;
    if (item->text() == "") return;
    bool speaker = (item->row() == 1);

    QAction* selectedItem = myMenu.exec(QCursor::pos());
    if (selectedItem) {
        if (item) {
            emit contextMenuShowPerson(item->text(),speaker);
        }
    }
}
开发者ID:fabianomarechal,项目名称:teocbase,代码行数:23,代码来源:publictalks.cpp


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