Hi,
I'd like to make a table (2D array) to store floating point numbers without using GUI (I have a console application). QTableWidget is not possible without GUI. What class or function should I use to make this table in console.
Thanks!
Hi,
I'd like to make a table (2D array) to store floating point numbers without using GUI (I have a console application). QTableWidget is not possible without GUI. What class or function should I use to make this table in console.
Thanks!
What You want to do :
1. Create a table
2. Show a table on screen
Hi,
I'd like to make a table for storing numbers for later calculations (not for screen). My current C code is like this:
Qt Code:
float **myTable = (float**) malloc((cols+2) * sizeof(float*)); if(myTable == NULL) {exit(1);} for(i = 0; i < cols+1; i++) {myTable[i] = (float*)malloc((rows+1) * sizeof(float)); if(myTable[i] == NULL) {exit(1);}} for(i=0; i<cols+1; i++){for(j=0; j<rows+1; j++){myTable[i][j]=0.0;}}To copy to clipboard, switch view to plain text mode
But generally it has nothing to do with Qt.
In C++ You can :
1. use Yours code
2. create table using new/delete operators (basics of C++)
3. use some container from Qt ie. QVector
I don't know what you are aiming for but if you intend to do matrix operations on such an array then have a look at QGenericMatrix.
Of course ...u can create a QTableWidget, displaying in GUi is secondary....
U can create and use it for storing numbers....
U can refer following code......its not compiled...
Qt Code:
int row = filesTable->rowCount(); filesTable->insertRow(row); for(int i=0;i<colcount;i++) { filesTable->setItem(row,i,newItem); }To copy to clipboard, switch view to plain text mode
... and by doing so you make your console only program dependent on the GUI library, add a bunch of unneeded overhead, and generally confuse the next person that has to maintain it a year from now.
else wat can be done Cris?
Lesiok and Wysota have provided other options.
Bookmarks