File indexing completed on 2024-07-21 03:41:13

0001 /*
0002     SPDX-FileCopyrightText: 2008 Peter Penz <peter.penz@gmx.at>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "defaultviewadapter_p.h"
0008 
0009 #include <QAbstractItemView>
0010 #include <QScrollBar>
0011 
0012 namespace KIO
0013 {
0014 DefaultViewAdapter::DefaultViewAdapter(QAbstractItemView *view, QObject *parent)
0015     : KAbstractViewAdapter(parent)
0016     , m_view(view)
0017 {
0018 }
0019 
0020 QAbstractItemModel *DefaultViewAdapter::model() const
0021 {
0022     return m_view->model();
0023 }
0024 
0025 QSize DefaultViewAdapter::iconSize() const
0026 {
0027     return m_view->iconSize();
0028 }
0029 
0030 QPalette DefaultViewAdapter::palette() const
0031 {
0032     return m_view->palette();
0033 }
0034 
0035 QRect DefaultViewAdapter::visibleArea() const
0036 {
0037     return m_view->viewport()->rect();
0038 }
0039 
0040 QRect DefaultViewAdapter::visualRect(const QModelIndex &index) const
0041 {
0042     return m_view->visualRect(index);
0043 }
0044 
0045 void DefaultViewAdapter::connect(Signal signal, QObject *receiver, const char *slot)
0046 {
0047     if (signal == ScrollBarValueChanged) {
0048         QObject::connect(m_view->horizontalScrollBar(), SIGNAL(valueChanged(int)), receiver, slot);
0049         QObject::connect(m_view->verticalScrollBar(), SIGNAL(valueChanged(int)), receiver, slot);
0050     }
0051 }
0052 
0053 }
0054 
0055 #include "moc_defaultviewadapter_p.cpp"