//How to test:
// 1) Start application
// 2) select all cells
// 3) sort by any column
// The column will shortly reach 9 (or 0) and stay sorted, then it is time to sort descending or choose another column
// White unselected cells should appear as soon as the sorting starts to move cells around.
ZTEST
::ZTEST(const char *server,
QWidget* parent
): counter(0)
{
setupUi(this);
tbl->setRowCount(0);
tbl->setColumnCount(6);
//fill with some numbers
for(int i = 0; i < 4; i++)
{
tbl->insertRow(i);
for(int j = 0; j < 6; j++)
{
}
}
tbl->setSortingEnabled(true);
QTimer::singleShot(4000,
this,
SLOT(timerReturn
()));
}
void ZTEST::timerReturn()
{
// keep first column as "id"
// Modify the values on the first row only
for( int i = 1; i < 6; i++)
{
// item->setText(QString::number(counter) + item->text());
item
->setText
(QString::number(rand()%10
));
}
QTimer::singleShot(2000,
this,
SLOT(timerReturn
()));
}
//How to test:
// 1) Start application
// 2) select all cells
// 3) sort by any column
// The column will shortly reach 9 (or 0) and stay sorted, then it is time to sort descending or choose another column
// White unselected cells should appear as soon as the sorting starts to move cells around.
ZTEST::ZTEST(const char *server, QWidget* parent):
QMainWindow(parent),
counter(0)
{
setupUi(this);
tbl->setRowCount(0);
tbl->setColumnCount(6);
//fill with some numbers
for(int i = 0; i < 4; i++)
{
tbl->insertRow(i);
for(int j = 0; j < 6; j++)
{
tbl->setItem(i, j, new QTableWidgetItem(QString::number(i+10*j)));
}
}
tbl->setSortingEnabled(true);
QTimer::singleShot(4000, this, SLOT(timerReturn()));
}
void ZTEST::timerReturn()
{
// keep first column as "id"
// Modify the values on the first row only
for( int i = 1; i < 6; i++)
{
QTableWidgetItem* item = tbl->item(0,i);
// item->setText(QString::number(counter) + item->text());
item->setText(QString::number(rand()%10));
}
QTimer::singleShot(2000, this, SLOT(timerReturn()));
}
To copy to clipboard, switch view to plain text mode
Bookmarks