TEST(qpsContainerModel, vectorPtrData) { using Ints = qps::ContainerModel< QVector, int >; Ints ints; ints.append( 42 ); ints.append( 43 ); ints.append( 44 ); QVariant v = ints.data( ints.index( 0 ) ); EXPECT_EQ( v.toString(), "42" ); using QObjects = qps::ContainerModel< QVector, QObject* >; QObjects objects; QObject* o = new QObject(); objects.append( o ); EXPECT_EQ( objects.data( objects.index( 0 ), QObjects::ItemRole ), QVariant::fromValue<QObject*>( o ) ); //EXPECT_EQ( objects.data( objects.index( 0 ) ), QVariant( "Item #0" ) ); }
TEST(qpsContainerModel, vectorPodItemCount) { using Ints = qps::ContainerModel< QVector, int >; Ints ints; EXPECT_EQ( ints.rowCount(), 0 ); EXPECT_EQ( ints.getItemCount(), 0 ); ints.append( 42 ); ints.append( 43 ); EXPECT_EQ( ints.rowCount(), 2 ); EXPECT_EQ( ints.getItemCount(), 2 ); }
void NeuNetUI::selectedNets(Ints & netIds) const { netIds.clear(); for (QTableWidgetItem *item : ui->nets->selectedItems()) if (item && tuteNow.contains(item->row())) throw AlreadyTute(); for (QTableWidgetItem *item : ui->nets->selectedItems()) { if (item && item->column() == 0) { int index = item->row(); netIds.append(index); } item->setSelected(false); } }