[Qt-interest] Implementation help for a chat widget
Andre Somers
andre at familiesomers.nl
Fri Apr 23 09:17:07 CEST 2010
On 23-4-2010 4:54, Xo Wang wrote:
> Hi,
>
> I'm looking to write a chat display widget for a chat client that is similar to the chat window in X-Chat, which is a GTK IRC client. For those unfamiliar with X-Chat, this is what it looks like: http://xchat.org/files/screenshots/xchat_screen_33.png
>
> Basically, I would like to have two columns of rich text aligned against each other (left column is right-aligned and right column is left-aligned), separated by a thin divider that can be dragged left& right. The left would contain the user names which are each top-aligned to the adjacent row of text containing their messages. Both columns would include text that have on-hover underlining and can show context menus on right-click.
>
> So, any suggestions on how to go about this?
>
Sounds like you basically need a table. Column one will have the names,
column two the content. I'd simply use a QTableView. Note that by
default, it's not the prettiest of views, but you can easily change that
by hiding or resizing the headers, making the cells fit the contents
better and perhaps hide the grid lines. That's all pretty simple to achieve.
The rich text can be achieved by using a suitable delegate. Qxt has one,
and I have written a GPL licenced one too that also supports hyperlinks.
André
More information about the Qt-interest-old
mailing list