Programming question QTable

Programming question QTable

Post by Lars Willemsen » Tue, 26 Mar 2002 00:26:25



Hi,

Does anyone know how I can set the name of column in a QTable ? Right
now they are labeled "1", "2", ...

Thanks in advance,
Lars

 
 
 

Programming question QTable

Post by Andre Somer » Tue, 26 Mar 2002 02:26:01



> Hi,

> Does anyone know how I can set the name of column in a QTable ? Right
> now they are labeled "1", "2", ...

> Thanks in advance,
> Lars

You can access the row- and columnheaders using the
QTable::horizontalHeader and QTable::verticalHeader members. They each
return a QHeader object, that gives you access to the label using the
memberfunction QHeader::setLabel.

It's all in the documentation....

HTH

Andr

 
 
 

1. Qtable displaying bug in my program and also in QtDesigner.

Hi,

- System : RedHat Linux 7.1 /, 6.1
- Compiler : gcc-2.96 / egcs-2.91.66
- QTVersion: Qt 2.3.1 binaries/devel from KDE.2.2 site.(try with others qt
2.3.1 version and also with a version compiled by myself).
- Tested Computers : Intel Pentium II 350, Pentium III 800 & 650, Bi PII 400
- Graphic card tested : Matrox G200/G400 8/16mo with hardware accelration
and
without, ati rage mobility 8mo.

  I think that I have found a bug in QTable or parents classes. The bug is :
When you fix the number of rows of a QTable to a limit, the table still
working well but you cannot see the cells values. What it is strange is that
you can edit it, the value is shown during the operation but after it
disappears.

  I'm using qt since a long time for the Tulip project and this bug seems
to
be new. In older version before 2.3.0 I haven't got this problem.

  If you want to see the bug, try to build a table with 10000 rows with
qtDesigner you will see that the grid is not drawed, You can also  try the
following sample. On my computer, with this program I can see cells until
the
170th(I can only see the half of the last row) rows after there is nothing
but I can edit it.

  I searched a lot to correct this bug myself but I didn't find from where
it
comes. Can you mail me if you already now this bug and/or if it will be
corrected soon ?

Regards

Source code :

#include <qapplication.h>
#include <qtable.h>

#define NUM_ROWS        10000
#define NUM_COLS        5

int main(int argc, char **argv)
{
  QString str;
  int r, c;
  QApplication app(argc, argv);
  QTable table(NUM_ROWS, NUM_COLS);
  app.setMainWidget(&table);
  for (r = 0; r < table.numRows(); r++)
    {
      for (c = 0; c < table.numCols(); c++)
         {
          str.sprintf("item %ld, %ld", r+1, c+1);
          table.setText(r, c, str);
         }
    }
  table.resize(640, 480);
  table.show();
  return app.exec();

2. Stupid error message

3. HOW to change the color of cell in QTable (Qt)?

4. 3com 3c509b etherlink problem -- I have tried for a LONG time!

5. Unix Programming & Linux Programming Question

6. Disk space usage. HELP!

7. Parallel Port programming question, was "Serial Port Programming"

8. what is a good e-mail program?

9. Linux programming question / Network Programming

10. Programming question: Can I get filesystem info in a C program?

11. "Mary had a neat program...neat program...neat program...

12. ** Programming question.. **

13. socket programming question.