this is javascript qml
/*
* This function fills with dummy info (zeros) the contents of a table.
*Params:
* idTable, the table to be filled with dummy data,
* numRows, the number of rows to be filled with dummy data
* numColumns, the number of columns to be filled with dummy data
*/
function vFillTableWithDummyData(idTable, numRows, numColumns)
{
var i=0,j=0;
for( i=0 ; i < numRows ; i++)
{
for( j= 0 ; j < numColumns ; j++)
{
idTable.vAppendItemText(i, j, "00000000");
}
}
}
this qt c++
void TableQt
::vAppendItemText(int intRow,
int intColumn,
QString sText
) {
//check that indexes exist
if (( intRow <= m_intRows) && ( intColumn <= m_intColumns))
{
poWidget->setTextAlignment(Qt::AlignVCenter); // V center aligment
poWidget->setTextAlignment(Qt::AlignHCenter); // H center aligment
m_poTable->setItem(intRow,intColumn,poWidget); // <row, col, item>
if (!m_poTable->isVisible())
{
m_poTable->setVisible(true);
}
}
}
TableQt.h
class TableQt : public QGraphicsProxyWidget {
Q_OBJECT
....
// base clase pointer member
TableWidget* m_poTable;
};
class TableWidget :
{
Q_OBJECT
}
TableWidget
::TableWidget(QWidget *parent
){
m_verticalScrollBar = new ScrollBar(this);
this->setVerticalScrollBar(m_verticalScrollBar);
}
this is javascript qml
/*
* This function fills with dummy info (zeros) the contents of a table.
*Params:
* idTable, the table to be filled with dummy data,
* numRows, the number of rows to be filled with dummy data
* numColumns, the number of columns to be filled with dummy data
*/
function vFillTableWithDummyData(idTable, numRows, numColumns)
{
var i=0,j=0;
for( i=0 ; i < numRows ; i++)
{
for( j= 0 ; j < numColumns ; j++)
{
idTable.vAppendItemText(i, j, "00000000");
}
}
}
this qt c++
void TableQt::vAppendItemText(int intRow, int intColumn, QString sText)
{
//check that indexes exist
if (( intRow <= m_intRows) && ( intColumn <= m_intColumns))
{
QTableWidgetItem *poWidget = new QTableWidgetItem(sText);
poWidget->setTextAlignment(Qt::AlignVCenter); // V center aligment
poWidget->setTextAlignment(Qt::AlignHCenter); // H center aligment
m_poTable->setItem(intRow,intColumn,poWidget); // <row, col, item>
if (!m_poTable->isVisible())
{
m_poTable->setVisible(true);
}
}
}
TableQt.h
class TableQt : public QGraphicsProxyWidget {
Q_OBJECT
....
// base clase pointer member
TableWidget* m_poTable;
};
class TableWidget :
public QTableWidget
{
Q_OBJECT
}
TableWidget::TableWidget(QWidget *parent)
: QTableWidget(parent)
{
m_verticalScrollBar = new ScrollBar(this);
this->setVerticalScrollBar(m_verticalScrollBar);
}
To copy to clipboard, switch view to plain text mode
Bookmarks