Qt5.1 behaves randomly erroneous while creating a table.
Hello,
I'm creating a table with a qt widget. My widget displays the table only if it has been filled with information. in qt 4.8 it displays without error the table, however in qt5.1.0 sometimes it displays the table and sometimes it doesn't.
The inheritance relation in my widget is
Note: There is no change in code nor in the qml code, nor in the qtWidget code, only the lbraries of qt change from 4.8 to 5.1
Can someone help to shed some light into the behavior of my widget in Qt5.1.?
Thank you in advance for your help.
Ulises Vega
Re: Qt5.1 behaves randomly erroneous while creating a table.
Quote:
Can someone help to shed some light into the behavior of my widget in Qt5.1.?
How? You tell us absolutely nothing about your widget code, how your widget fits into a larger UI, what "sometimes it displays the table and sometimes it doesn't" means, what you are actually seeing, what you expected to see, what QML has to do with any of this etc.
2 Attachment(s)
Re: Qt5.1 behaves randomly erroneous while creating a table.
Let me describe you a bit more of my application. I have a tabbed application, in one tab of this one i have to display a pair of tables. This table come from QTableWidget as a base class. This tables display 5 columns and 3 rows. In qt 4.8 this tables are displayed correctly all the times I run my application, however when I moved to qt5.1.0 this tables and its contents are not displayed all the time (every time i run my application) sometimes they display the data correctly and someother time they don't display the data correctly. The displaying of the data is during initialization of my tabbed application In the following picture you have a pictorial description of my application whent it does not display the data correctly.Attachment 9490 In the following picture you can see how the data is correctly displayed in the tables during initialization Attachment 9491
This tabbed application is done in qml and qt c++. The tabs are done in qml, and the widget in qt c++. I want to emphasize that my tables work perfectly in qt 4.8 but they don't work perfectly in qt5.1.0
This function is the one I use to fill dummy data in the table during initialization.
Code:
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);
}
I hope this makes things clear, and thanks for your help and the time provided in my question.
Ulises Vega