QTfrontend/chatwidget.cpp
changeset 4876 813ef4e8e385
parent 4560 5d6c7f88db73
child 4877 746ddd590dee
--- a/QTfrontend/chatwidget.cpp	Fri Jan 28 03:30:14 2011 +0100
+++ b/QTfrontend/chatwidget.cpp	Sat Jan 29 01:08:39 2011 +0100
@@ -32,6 +32,14 @@
 #include "gameuiconfig.h"
 #include "chatwidget.h"
 
+ListWidgetNickItem::ListWidgetNickItem(const QString& nick) : QListWidgetItem(nick) {}
+
+bool ListWidgetNickItem::operator< (const QListWidgetItem & other) const
+{
+    // case in-sensitive comparison of the associated strings
+    return (text().compare(other.text(), Qt::CaseInsensitive) < 0);
+}
+
 HWChatWidget::HWChatWidget(QWidget* parent, QSettings * gameSettings, SDLInteraction * sdli, bool notify) :
   QWidget(parent),
   mainLayout(this)
@@ -241,7 +249,7 @@
 
 void HWChatWidget::nickAdded(const QString& nick, bool notifyNick)
 {
-    QListWidgetItem * item = new QListWidgetItem(nick);
+    QListWidgetItem * item = new ListWidgetNickItem(nick);
     updateIcon(item);
     chatNicks->addItem(item);