This is actually a 2 parter (but the first is quick, I promise!) In
looking at the TextBox code, I see in the constructors that adjustSize()
is called right after setText(). As setText() calls adjustSize(), this
makes the second call redundant.
The second, more subtle issue, is that even if there is no text it will
always have at least 1 row. I feel that this is not expected behavior
because if there is no text present for it to display, I would not think
that it should have any rows.
For example, if you create a default TextBox (or even a TextBox as:
TextBox box("")), then there are no characters in the string for the box
to display, yet a call to getNumberOfRows() will return a result of 1.
The problem lies in the setText() method itself and that it runs a do
while loop (so a first row is always generated). I've attached an altered
version that compensates for blank text strings.
As a final thought, could I throw out a suggestion to save code space and
create just one constructor for a TextBox with a default parameter of a
blank string (ex: TextBox(const std::string& text = "")) This would
remove the need for a second, default, constructor.
Original issue reported on code.google.com by holy.smo...@gmail.com on 22 Jan 2010 at 3:26
Original issue reported on code.google.com by
holy.smo...@gmail.com
on 22 Jan 2010 at 3:26Attachments: