Revamping ChatView/ChatScene's mouse handling
authorManuel Nickschas <sputnick@quassel-irc.org>
Fri, 14 Nov 2008 11:24:13 +0000 (12:24 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Thu, 20 Nov 2008 14:35:36 +0000 (15:35 +0100)
* Introduce proper single/double/triple click detection. This will make it possible to add
  some standard selection modes, allows partial selection of links and some more stuff
* ChatItem->handleClick() is now called appropriately, in addition to the standard mouse events
* Enable drag/drop for selections in ChatView, i.e. you can now drag text somewhere else
* Some cleanups

src/qtui/chatitem.h
src/qtui/chatscene.cpp

index 98056ef..3cb9c3d 100644 (file)
@@ -80,8 +80,6 @@ protected:
   virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
   virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
 
-  //virtual bool handleClick(ClickMode mode);
-
   inline QTextLayout *layout() const;
 
   virtual QTextLayout::FormatRange selectionFormat() const;
index 393058b..dc38854 100644 (file)
@@ -107,6 +107,10 @@ ChatScene::ChatScene(QAbstractItemModel *model, const QString &idString, qreal w
   _clickTimer.setSingleShot(true);
   connect(&_clickTimer, SIGNAL(timeout()), SLOT(clickTimeout()));
 
+  _clickTimer.setInterval(QApplication::doubleClickInterval());
+  _clickTimer.setSingleShot(true);
+  connect(&_clickTimer, SIGNAL(timeout()), SLOT(clickTimeout()));
+
   setItemIndexMethod(QGraphicsScene::NoIndex);
 }