CCMAIL: frank78ac@googlemail.com
svn path=/trunk/KDE/kdebase/apps/; revision=896362
selModel->select(deselected, QItemSelectionModel::Deselect);
}
selModel->select(deselected, QItemSelectionModel::Deselect);
}
+void DolphinColumnWidget::currentChanged(const QModelIndex& current, const QModelIndex& previous)
+{
+ QListView::currentChanged(current, previous);
+ if (current.isValid()) {
+ scrollTo(current);
+ }
+}
+
void DolphinColumnWidget::slotEntered(const QModelIndex& index)
{
m_view->m_controller->setItemView(this);
void DolphinColumnWidget::slotEntered(const QModelIndex& index)
{
m_view->m_controller->setItemView(this);
virtual void wheelEvent(QWheelEvent* event);
virtual void leaveEvent(QEvent* event);
virtual void selectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
virtual void wheelEvent(QWheelEvent* event);
virtual void leaveEvent(QEvent* event);
virtual void selectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
+ virtual void currentChanged(const QModelIndex& current, const QModelIndex& previous);
private slots:
void slotEntered(const QModelIndex& index);
private slots:
void slotEntered(const QModelIndex& index);
void DolphinDetailsView::currentChanged(const QModelIndex& current, const QModelIndex& previous)
{
QTreeView::currentChanged(current, previous);
void DolphinDetailsView::currentChanged(const QModelIndex& current, const QModelIndex& previous)
{
QTreeView::currentChanged(current, previous);
+ if (current.isValid()) {
+ scrollTo(current);
+ }
// Stay consistent with QListView: When changing the current index by key presses,
// also change the selection.
// Stay consistent with QListView: When changing the current index by key presses,
// also change the selection.
m_controller->emitViewportEntered();
}
m_controller->emitViewportEntered();
}
+void DolphinIconsView::currentChanged(const QModelIndex& current, const QModelIndex& previous)
+{
+ KCategorizedView::currentChanged(current, previous);
+ if (current.isValid()) {
+ scrollTo(current);
+ }
+}
+
void DolphinIconsView::slotShowPreviewChanged()
{
const DolphinView* view = m_controller->dolphinView();
void DolphinIconsView::slotShowPreviewChanged()
{
const DolphinView* view = m_controller->dolphinView();
virtual void wheelEvent(QWheelEvent* event);
virtual void showEvent(QShowEvent* event);
virtual void leaveEvent(QEvent* event);
virtual void wheelEvent(QWheelEvent* event);
virtual void showEvent(QShowEvent* event);
virtual void leaveEvent(QEvent* event);
+ virtual void currentChanged(const QModelIndex& current, const QModelIndex& previous);
private slots:
void slotShowPreviewChanged();
private slots:
void slotShowPreviewChanged();
{
m_itemView->setAutoScroll(false);
m_itemView->viewport()->installEventFilter(this);
{
m_itemView->setAutoScroll(false);
m_itemView->viewport()->installEventFilter(this);
- m_itemView->installEventFilter(this);
m_timer = new QTimer(this);
m_timer->setSingleShot(false);
m_timer = new QTimer(this);
m_timer->setSingleShot(false);
- } else if ((watched == m_itemView) && (event->type() == QEvent::KeyPress)) {
- switch (static_cast<QKeyEvent*>(event)->key()) {
- case Qt::Key_Up:
- case Qt::Key_Down:
- case Qt::Key_Left:
- case Qt::Key_Right:
- case Qt::Key_PageUp:
- case Qt::Key_PageDown:
- case Qt::Key_Home:
- case Qt::Key_End:
- QMetaObject::invokeMethod(this, "scrollToCurrentIndex", Qt::QueuedConnection);
- break;
- default:
- break;
- }
return QObject::eventFilter(watched, event);
}
return QObject::eventFilter(watched, event);
}
-void DolphinViewAutoScroller::scrollToCurrentIndex()
-{
- const QModelIndex index = m_itemView->currentIndex();
- m_itemView->scrollTo(index);
-}
-
void DolphinViewAutoScroller::triggerAutoScroll()
{
const bool verticalScrolling = (m_itemView->verticalScrollBar() != 0) &&
void DolphinViewAutoScroller::triggerAutoScroll()
{
const bool verticalScrolling = (m_itemView->verticalScrollBar() != 0) &&
private slots:
void scrollViewport();
private slots:
void scrollViewport();
- void scrollToCurrentIndex();
private:
void triggerAutoScroll();
private:
void triggerAutoScroll();