[PATCH 3/3]: wpa_gui-qt4: scroll with events when added to event list view box

Kel Modderman kel at otaku42.de
Thu Feb 7 02:23:27 EST 2008


If the event history list view box vertical scrollbar is currently at its
maximum position, then scroll to the bottom of the list view box as each
new event is added. As soon as the scroll bar handle is no longer at its
maximum position this behavior is disabled.

Signed-off-by: Kel Modderman <kel at otaku42.de>
---
--- a/wpa_supplicant/wpa_gui-qt4/eventhistory.cpp
+++ b/wpa_supplicant/wpa_gui-qt4/eventhistory.cpp
@@ -13,6 +13,7 @@
  */
 
 #include <QHeaderView>
+#include <QScrollBar>
 
 #include "eventhistory.h"
 
@@ -115,6 +116,15 @@
 
 void EventHistory::addEvent(WpaMsg msg)
 {
+	bool scroll = true;
+
+	if (eventListView->verticalScrollBar()->value() <
+	    eventListView->verticalScrollBar()->maximum())
+	    	scroll = false;
+
 	elm->addEvent(msg.getTimestamp().toString("yyyy-MM-dd hh:mm:ss.zzz"),
 		      msg.getMsg());
+
+	if (scroll)
+		eventListView->scrollToBottom();
 }
---


More information about the HostAP mailing list