本文整理汇总了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;
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
}