firstColHandle->sceneRectChanged(rect);
secondColHandle->sceneRectChanged(rect);
}
-
-void ChatScene::mousePressEvent ( QGraphicsSceneMouseEvent * mouseEvent ) {
- /*
- qDebug() << "recv" << mouseEvent->scenePos();
- ChatLine *line = static_cast<ChatLine*>(itemAt(mouseEvent->scenePos()));
- ChatItem *item = static_cast<ChatItem*>(itemAt(mouseEvent->scenePos()));
- qDebug() << (void*)line << (void*)item;
- if(line) {
- line->myMousePressEvent(mouseEvent);
- } else QGraphicsScene::mousePressEvent(mouseEvent);
- */
-}
protected slots:
void rowsInserted(const QModelIndex &, int, int);
- void mousePressEvent(QGraphicsSceneMouseEvent * mouseEvent);
private:
qreal _width, _height;
ChatView::ChatView(Buffer *buf, QWidget *parent) : QGraphicsView(parent), AbstractChatView() {
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- setOptimizationFlags(QGraphicsView::DontClipPainter
- |QGraphicsView::DontSavePainterState
- |QGraphicsView::DontAdjustForAntialiasing);
setAlignment(Qt::AlignBottom);
setInteractive(true);
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
+#include <QCursor>
#include <QGraphicsScene>
#include <QPainter>
+#include <QDebug>
+
#include "columnhandleitem.h"
ColumnHandleItem::ColumnHandleItem(qreal w, QGraphicsItem *parent) : QGraphicsItem(parent) {
_width = w;
-
+ setZValue(10);
+ setCursor(QCursor(Qt::OpenHandCursor));
+ setFlag(ItemIsMovable);
}
void ColumnHandleItem::setXPos(qreal xpos) {
prepareGeometryChange();
}
+void ColumnHandleItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
+
+ QGraphicsItem::mouseMoveEvent(event);
+}
+
+void ColumnHandleItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { qDebug() << "pressed!";
+ setCursor(QCursor(Qt::ClosedHandCursor));
+ QGraphicsItem::mousePressEvent(event);
+}
+
+void ColumnHandleItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
+ setCursor(QCursor(Qt::OpenHandCursor));
+ QGraphicsItem::mouseReleaseEvent(event);
+}
+
void ColumnHandleItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
Q_UNUSED(option);
Q_UNUSED(widget);
inline QRectF boundingRect() const;
void setXPos(qreal xpos);
- virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+ void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
+ void mousePressEvent(QGraphicsSceneMouseEvent *event);
+ void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
void sceneRectChanged(const QRectF &);