[Qt-interest] Formatting text
David Villalobos Cambronero
david.villalobos.c at gmail.com
Wed Aug 18 22:11:12 CEST 2010
Atlant, thanks for you reply.
You hit my point. That is what I need, so, thanks for your help.
Regards
---
David
On Wed, Aug 18, 2010 at 14:07, Atlant Schmidt <aschmidt at dekaresearch.com>wrote:
> David:
>
>
>
> You need to define the problem more-precisely for us.
>
>
>
> Do you mean that you:
>
>
>
> 1. Might know the maximum possible widths of the various text fields
> but
>
>
>
> 2. You don’t want any given printout to use the maximum theoretical
> field
> widths but instead use the minimum field width required to display the
> longest actual text values and column headers that the current selection
> has produced?
>
>
>
> So, one printout might say:
>
>
>
> Word Definition
>
> --------------------
>
> Cat A small feline
>
>
>
> Whereas another printout might say:
>
>
>
> Word Definition
>
>
> ------------------------------------------------------------------------
>
> Antidisestablishmentarianism The policy opposing the dissolution
> of...
>
>
>
>
>
> Is that the effect you’re shooting for?
>
>
>
> In that case, you’ll probably need to either make two passes through your
> database query or cache the results of the database query so you can make
> two passes over the results. The first pass defines the required column
> widths
> and the second pass builds the output to conform to those widths,
> probably
> also word-wrapping as required.
>
>
>
> Me, being an old-timer, I’d probably do the formatting using some kind of
> high-tech like building a format string that specifies the required
> column
> widths and then passing that to “sprintf()” but there’s probably some
> magically-complex new-age way of accomplishing it as well. ;-)
>
>
>
> Atlant
>
>
>
>
>
>
> ------------------------------
>
> *From:* qt-interest-bounces at trolltech.com [mailto:
> qt-interest-bounces at trolltech.com] *On Behalf Of *David Villalobos
> Cambronero
> *Sent:* Wednesday, August 18, 2010 15:47 PM
> *To:* qt-interest at trolltech.com
> *Subject:* [Qt-interest] Formatting text
>
>
>
> Hi all,
>
> Here is my problem. I need to print in a QPlainTextEdit some lines of text,
> but I have to do it in some sort of order. From my database I get:
>
> Col1 Col2
> Value1 Value2
>
> I need this data to be printed in the QPlainTextEdit like this:
>
> Col1 Col2
> Value1 Value2
>
> Of course there are more rows and I do not know the length of the data.
>
> Any ideas?
>
> Thanks in advance.
>
> Best regards
> ---
> David
>
> Click here<https://www.mailcontrol.com/sr/DVEDjdFp2QbTndxI%21oX7UlnwUb8+3gKc%218dse+4wNC20n%21CxiL64rg3KneJ7tvm%21+6WyjV27LiIAI1jSF4rfTg==>to report this email as spam.
>
> ------------------------------
> This e-mail and the information, including any attachments, it contains are
> intended to be a confidential communication only to the person or entity to
> whom it is addressed and may contain information that is privileged. If the
> reader of this message is not the intended recipient, you are hereby
> notified that any dissemination, distribution or copying of this
> communication is strictly prohibited. If you have received this
> communication in error, please immediately notify the sender and destroy the
> original message.
>
> Thank you.
>
> Please consider the environment before printing this email.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100818/888fa4be/attachment.html
More information about the Qt-interest-old
mailing list