PDA

View Full Version : Design of spreadsheet



incartasa
25th November 2009, 05:21
Hi,

I am an absolute Newbie to Qt just trying to understand the best approach to a problem I am working on:

I need to build a "spreadsheet" style of application that has a very specific presentation and as such it is not possible to use a pre-built spreadsheet widget. I decided to start my work by sub classing QLineEdit as a "Cell" class, add appropriate functionality and then combine cells into rows.

The first issue I discovered was that although I could set the text of a QLineEdit object in the Cell class constructor, the only way I could change the text later on was to use a signal: setText() - using, this->setText("Hello") seems to load the text (as it can be read back) but it does not display.

Also, I have noted after looking at other spreadsheet code that another approach may be to use a label widget as the cell basis and then create a QLineEdit widget whenever the cell is edited - not sure of the advantage of this?

I guess that these are fairly basis questions - nevertheless andy assiastance would be appreciated...

Mark

JD2000
25th November 2009, 11:06
I believe that you need to use the displayText() function to actually see the text.

Incidentally have you seen the official book C++ GUI Programming with Qt 4?

There is an online version of it on the Nokia website http://qt.nokia.com/developer/getting-started

You may be interested in chapters 3 & 4 where QT features are demonstrated by building a spreadsheet.