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


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

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


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

示例1: setSelected

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

示例2: decoration

void tst_QItemDelegate::decoration()
{
    if (QByteArray(QTest::currentDataTag()) == QByteArray("pixmap 30x30 big"))
        QSKIP("Skipping this as it demands too much memory and potential hangs", SkipSingle);
    Q_CHECK_PAINTEVENTS

    QFETCH(int, type);
    QFETCH(QSize, size);
    QFETCH(QSize, expected);

    QTableWidget table(1, 1);
    TestItemDelegate delegate;
    table.setItemDelegate(&delegate);
    table.show();
#ifdef Q_WS_X11
    qt_x11_wait_for_window_manager(&table);
#endif
    QApplication::setActiveWindow(&table);
    QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&table));

    QVariant value;
    switch ((QVariant::Type)type) {
    case QVariant::Pixmap: {
        QPixmap pm(size);
        pm.fill(Qt::black);
        value = pm;
        break;
    }
    case QVariant::Image: {
        QImage img(size, QImage::Format_Mono);
        qMemSet(img.bits(), 0, img.byteCount());
        value = img;
        break;
    }
    case QVariant::Icon: {
        QPixmap pm(size);
        pm.fill(Qt::black);
        value = QIcon(pm);
        break;
    }
    case QVariant::Color:
        value = QColor(Qt::green);
        break;
    default:
        break;
    }

    QTableWidgetItem *item = new QTableWidgetItem;
    item->setData(Qt::DecorationRole, value);
    table.setItem(0, 0, item);
    item->setSelected(true);

    QApplication::processEvents();

    QTRY_COMPARE(delegate.decorationRect.size(), expected);
}
开发者ID:redanium,项目名称:qt,代码行数:56,代码来源:tst_qitemdelegate.cpp

示例3: ShowPoint

/**
 * @brief ShowPoint show selected point
 */
void DialogHistory::ShowPoint()
{
    QVector<VToolRecord> *history = doc->getHistory();
    if (history->size()>0)
    {
        QTableWidgetItem *item = ui->tableWidget->item(0, 1);
        item->setSelected(true);
        cursorToolRecordRow = 0;
        item = ui->tableWidget->item(0, 0);
        quint32 id = qvariant_cast<quint32>(item->data(Qt::UserRole));
        emit ShowHistoryTool(id, Qt::green, true);
    }
}
开发者ID:jessikbarret,项目名称:Valentina,代码行数:16,代码来源:dialoghistory.cpp

示例4: decoration

void tst_QItemDelegate::decoration()
{
    Q_CHECK_PAINTEVENTS

    QFETCH(int, type);
    QFETCH(QSize, size);
    QFETCH(QSize, expected);

    QTableWidget table(1, 1);
    TestItemDelegate delegate;
    table.setItemDelegate(&delegate);
    table.show();
    QApplication::setActiveWindow(&table);
    QVERIFY(QTest::qWaitForWindowActive(&table));

    QVariant value;
    switch ((QVariant::Type)type) {
    case QVariant::Pixmap: {
        QPixmap pm(size);
        pm.fill(Qt::black);
        value = pm;
        break;
    }
    case QVariant::Image: {
        QImage img(size, QImage::Format_Mono);
        memset(img.bits(), 0, img.byteCount());
        value = img;
        break;
    }
    case QVariant::Icon: {
        QPixmap pm(size);
        pm.fill(Qt::black);
        value = QIcon(pm);
        break;
    }
    case QVariant::Color:
        value = QColor(Qt::green);
        break;
    default:
        break;
    }

    QTableWidgetItem *item = new QTableWidgetItem;
    item->setData(Qt::DecorationRole, value);
    table.setItem(0, 0, item);
    item->setSelected(true);

    QApplication::processEvents();

    QTRY_COMPARE(delegate.decorationRect.size(), expected);
}
开发者ID:crobertd,项目名称:qtbase,代码行数:51,代码来源:tst_qitemdelegate.cpp

示例5: on_deletebtn_clicked

void globalScriptDlg::on_deletebtn_clicked()//删除
{
    int irow = ui->table->currentRow();
    if(irow < 0)
        return;
    ui->table->removeRow(irow);
    pwnd->m_pSamSysParame->m_qvcGlobalMaroProp.remove(irow);
    irow--;
    if( irow >= 0 )
    {
        ui->table->setCurrentCell(irow,0);
        QTableWidgetItem *item = ui->table->item(irow,0);
        item->setSelected(true);
    }
}
开发者ID:maqiangddb,项目名称:pc_code,代码行数:15,代码来源:globalScriptDlg.cpp


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