[Qt-interest] Implementation help for a chat widget

Xo Wang xo at geekshavefeelings.com
Fri Apr 23 04:54:35 CEST 2010


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.

I was wondering how to implement such a widget in Qt. Using <TABLE> or DIVs in HTML-capable widgets (QTextBrowser, WebKit, etc.) would give me the proper display, but I'm not sure how to get it to resize the border.

Using two separate widgets seems rather messy because of needing to synchronize rows between the two columns; plus, having a layout divider in between is rather ugly compared to the X-Chat one.

Drawing the widget myself (which is what X-Chat does) is definitely something I would avoid, since I've tried it with Cairo before, and it's a terrible pain to get the details right: copy & paste, system-consistent context menus, even the selection background color. A "native" looking text widget would be ideal.

So, any suggestions on how to go about this?

Thanks in advance!

--
Xo Wang
http://www.geekshavefeelings.com/



More information about the Qt-interest-old mailing list