2014-11-13 01:04:59 +02:00
|
|
|
/*******************************************************************************
|
|
|
|
* Copyright (C) 2008 by Peter Penz <peter.penz@gmx.at> *
|
|
|
|
* *
|
|
|
|
* This library is free software; you can redistribute it and/or *
|
|
|
|
* modify it under the terms of the GNU Library General Public *
|
|
|
|
* License as published by the Free Software Foundation; either *
|
|
|
|
* version 2 of the License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This library is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
|
|
|
* Library General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU Library General Public License *
|
|
|
|
* along with this library; see the file COPYING.LIB. If not, write to *
|
|
|
|
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
|
|
|
|
* Boston, MA 02110-1301, USA. *
|
|
|
|
*******************************************************************************/
|
|
|
|
|
2023-06-12 16:31:45 +03:00
|
|
|
#include "kdefaultviewadapter_p.h"
|
2014-11-13 01:04:59 +02:00
|
|
|
|
|
|
|
#include <QAbstractItemView>
|
|
|
|
#include <QScrollBar>
|
|
|
|
|
2023-06-12 16:31:45 +03:00
|
|
|
KDefaultViewAdapter::KDefaultViewAdapter(QAbstractItemView* view, QObject* parent) :
|
2014-11-13 01:04:59 +02:00
|
|
|
KAbstractViewAdapter(parent),
|
|
|
|
m_view(view)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2023-06-12 16:31:45 +03:00
|
|
|
QAbstractItemModel *KDefaultViewAdapter::model() const
|
2014-11-13 01:04:59 +02:00
|
|
|
{
|
|
|
|
return m_view->model();
|
|
|
|
}
|
|
|
|
|
2023-06-12 16:31:45 +03:00
|
|
|
QSize KDefaultViewAdapter::iconSize() const
|
2014-11-13 01:04:59 +02:00
|
|
|
{
|
|
|
|
return m_view->iconSize();
|
|
|
|
}
|
|
|
|
|
2023-06-12 16:31:45 +03:00
|
|
|
QPalette KDefaultViewAdapter::palette() const
|
2014-11-13 01:04:59 +02:00
|
|
|
{
|
|
|
|
return m_view->palette();
|
|
|
|
}
|
|
|
|
|
2023-06-12 16:31:45 +03:00
|
|
|
QRect KDefaultViewAdapter::visibleArea() const
|
2014-11-13 01:04:59 +02:00
|
|
|
{
|
|
|
|
return m_view->viewport()->rect();
|
|
|
|
}
|
|
|
|
|
2023-06-12 16:31:45 +03:00
|
|
|
QRect KDefaultViewAdapter::visualRect(const QModelIndex& index) const
|
2014-11-13 01:04:59 +02:00
|
|
|
{
|
|
|
|
return m_view->visualRect(index);
|
|
|
|
}
|
|
|
|
|
2023-06-12 16:31:45 +03:00
|
|
|
void KDefaultViewAdapter::connectScrollBar(QObject* receiver, const char* slot)
|
2014-11-13 01:04:59 +02:00
|
|
|
{
|
2023-06-12 16:31:45 +03:00
|
|
|
QObject::connect(m_view->horizontalScrollBar(), SIGNAL(valueChanged(int)), receiver, slot);
|
|
|
|
QObject::connect(m_view->verticalScrollBar(), SIGNAL(valueChanged(int)), receiver, slot);
|
2014-11-13 01:04:59 +02:00
|
|
|
}
|