From 789f681013cdb7749c8b3347937de813bb51d3d0 Mon Sep 17 00:00:00 2001 From: Marcus Eggenberger Date: Fri, 18 Apr 2008 10:37:25 +0000 Subject: [PATCH] fixed bufferswitches when using different buffer views --- src/client/buffermodel.cpp | 11 ++++++----- src/client/buffermodel.h | 1 - src/uisupport/bufferview.h | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/client/buffermodel.cpp b/src/client/buffermodel.cpp index 3dfdc6da..c487e0fb 100644 --- a/src/client/buffermodel.cpp +++ b/src/client/buffermodel.cpp @@ -30,6 +30,10 @@ BufferModel::BufferModel(NetworkModel *parent) _selectionModelSynchronizer(this) { setSourceModel(parent); + if(QCoreApplication::instance()->arguments().contains("--debugbufferswitches")) { + connect(_selectionModelSynchronizer.selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), + this, SLOT(debug_currentChanged(const QModelIndex &, const QModelIndex &))); + } } bool BufferModel::filterAcceptsRow(int sourceRow, const QModelIndex &parent) const { @@ -65,9 +69,6 @@ void BufferModel::setCurrentIndex(const QModelIndex &newCurrent) { } void BufferModel::debug_currentChanged(QModelIndex current, QModelIndex previous) { - qDebug() << "New current:" << current << "(previous:" << previous << ")"; -} - -void BufferModel::debug_selectionChanged(QItemSelection current , QItemSelection previous) { - qDebug() << "new selection:" << current << "(previoius:" << previous << ")"; + Q_UNUSED(previous); + qDebug() << "Switched current Buffer: " << current << current.data().toString() << "Buffer:" << current.data(NetworkModel::BufferIdRole).value(); } diff --git a/src/client/buffermodel.h b/src/client/buffermodel.h index 3126f737..7bd3fc9e 100644 --- a/src/client/buffermodel.h +++ b/src/client/buffermodel.h @@ -50,7 +50,6 @@ public: private slots: void debug_currentChanged(QModelIndex current, QModelIndex previous); - void debug_selectionChanged(QItemSelection current , QItemSelection previous); private: SelectionModelSynchronizer _selectionModelSynchronizer; diff --git a/src/uisupport/bufferview.h b/src/uisupport/bufferview.h index 0f1b502f..b766f99c 100644 --- a/src/uisupport/bufferview.h +++ b/src/uisupport/bufferview.h @@ -45,7 +45,7 @@ public: void setConfig(BufferViewConfig *config); inline BufferViewConfig *config() { return _config; } - + public slots: void setRootIndexForNetworkId(const NetworkId &networkId); @@ -58,6 +58,7 @@ protected: virtual void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); virtual void wheelEvent(QWheelEvent *); virtual QSize sizeHint() const; + virtual void focusInEvent(QFocusEvent *event) { QAbstractScrollArea::focusInEvent(event); } private slots: void joinChannel(const QModelIndex &index); -- 2.20.1