Public Slots | Public Member Functions | Public Attributes

QxtFlowViewPrivate Class Reference

#include <qxtflowview_p.h>

Collaboration diagram for QxtFlowViewPrivate:
Collaboration graph
[legend]

List of all members.

Public Slots

void columnsAboutToBeInserted (const QModelIndex &parent, int start, int end)
void columnsAboutToBeRemoved (const QModelIndex &parent, int start, int end)
void columnsInserted (const QModelIndex &parent, int start, int end)
void columnsRemoved (const QModelIndex &parent, int start, int end)
void dataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight)
void headerDataChanged (Qt::Orientation orientation, int first, int last)
void layoutAboutToBeChanged ()
void layoutChanged ()
void modelAboutToBeReset ()
void modelReset ()
void rowsAboutToBeInserted (const QModelIndex &parent, int start, int end)
void rowsAboutToBeRemoved (const QModelIndex &parent, int start, int end)
void rowsInserted (const QModelIndex &parent, int start, int end)
void rowsRemoved (const QModelIndex &parent, int start, int end)

Public Member Functions

void setModel (QAbstractItemModel *model)
void clear ()
void triggerRender ()
void insertSlide (int index, const QImage &image)
void replaceSlide (int index, const QImage &image)
void removeSlide (int index)
void setCurrentIndex (QModelIndex index)
void showSlide (int index)
void reset ()

Public Attributes

QxtFlowViewStatestate
QxtFlowViewAnimatoranimator
QxtFlowViewAbstractRendererrenderer
QTimer triggerTimer
QAbstractItemModel * model
int picrole
int textrole
int piccolumn
int textcolumn
QList< QPersistentModelIndex > modelmap
QPersistentModelIndex currentcenter
QPoint lastgrabpos
QModelIndex rootindex

Detailed Description

Definition at line 249 of file qxtflowview_p.h.


Member Function Documentation

void QxtFlowViewPrivate::clear (  )

Definition at line 618 of file qxtflowview.cpp.

References modelmap, QxtFlowViewState::reset(), QxtFlowViewState::slideImages, state, and triggerRender().

Referenced by reset().

{
    int c = state->slideImages.count();
    for (int i = 0; i < c; i++)
        delete state->slideImages[i];
    state->slideImages.resize(0);

    state->reset();
    modelmap.clear();
    triggerRender();
}
void QxtFlowViewPrivate::columnsAboutToBeInserted ( const QModelIndex &  parent,
int  start,
int  end 
) [slot]

Definition at line 423 of file qxtflowview.cpp.

Referenced by setModel().

{
    Q_UNUSED(parent);
    Q_UNUSED(start);
    Q_UNUSED(end);

}
void QxtFlowViewPrivate::columnsAboutToBeRemoved ( const QModelIndex &  parent,
int  start,
int  end 
) [slot]

Definition at line 431 of file qxtflowview.cpp.

Referenced by setModel().

{
    Q_UNUSED(parent);
    Q_UNUSED(start);
    Q_UNUSED(end);

}
void QxtFlowViewPrivate::columnsInserted ( const QModelIndex &  parent,
int  start,
int  end 
) [slot]

Definition at line 439 of file qxtflowview.cpp.

Referenced by setModel().

{
    Q_UNUSED(parent);
    Q_UNUSED(start);
    Q_UNUSED(end);

}
void QxtFlowViewPrivate::columnsRemoved ( const QModelIndex &  parent,
int  start,
int  end 
) [slot]

Definition at line 447 of file qxtflowview.cpp.

Referenced by setModel().

{
    Q_UNUSED(parent);
    Q_UNUSED(start);
    Q_UNUSED(end);
}
void QxtFlowViewPrivate::dataChanged ( const QModelIndex &  topLeft,
const QModelIndex &  bottomRight 
) [slot]

Definition at line 454 of file qxtflowview.cpp.

References model, piccolumn, picrole, replaceSlide(), and rootindex.

Referenced by setModel().

{
    Q_UNUSED(topLeft);
    Q_UNUSED(bottomRight);

    if (topLeft.parent() != rootindex)
        return;

    if (bottomRight.parent() != rootindex)
        return;


    int start = topLeft.row();
    int end = bottomRight.row();

    for (int i = start;i <= end;i++)
        replaceSlide(i, qvariant_cast<QImage>(model->data(model->index(i, piccolumn, rootindex), picrole)));
}
void QxtFlowViewPrivate::headerDataChanged ( Qt::Orientation  orientation,
int  first,
int  last 
) [slot]

Definition at line 473 of file qxtflowview.cpp.

Referenced by setModel().

{
    Q_UNUSED(orientation);
    Q_UNUSED(first);
    Q_UNUSED(last);





}
void QxtFlowViewPrivate::insertSlide ( int  index,
const QImage &  image 
)

Definition at line 639 of file qxtflowview.cpp.

References QxtFlowViewState::slideImages, state, and triggerRender().

Referenced by reset(), and rowsInserted().

{
    state->slideImages.insert(index, new QImage(image));
    triggerRender();
}
void QxtFlowViewPrivate::layoutAboutToBeChanged (  ) [slot]

Definition at line 485 of file qxtflowview.cpp.

Referenced by setModel().

{

}
void QxtFlowViewPrivate::layoutChanged (  ) [slot]

Definition at line 490 of file qxtflowview.cpp.

References currentcenter, reset(), and setCurrentIndex().

Referenced by setModel().

void QxtFlowViewPrivate::modelAboutToBeReset (  ) [slot]

Definition at line 496 of file qxtflowview.cpp.

Referenced by setModel().

{
}
void QxtFlowViewPrivate::modelReset (  ) [slot]

Definition at line 500 of file qxtflowview.cpp.

References reset().

Referenced by setModel().

{
    reset();
}
void QxtFlowViewPrivate::removeSlide ( int  index )

Definition at line 655 of file qxtflowview.cpp.

References QxtFlowViewState::slideImages, state, and triggerRender().

Referenced by rowsRemoved().

{
    delete state->slideImages[index];
    state->slideImages.remove(index);
    triggerRender();
}
void QxtFlowViewPrivate::replaceSlide ( int  index,
const QImage &  image 
)

Definition at line 645 of file qxtflowview.cpp.

References QxtFlowViewState::slideImages, state, and triggerRender().

Referenced by dataChanged().

{
    Q_ASSERT((index >= 0) && (index < state->slideImages.count()));

    QImage* i = image.isNull() ? 0 : new QImage(image);
    delete state->slideImages[index];
    state->slideImages[index] = i;
    triggerRender();
}
void QxtFlowViewPrivate::reset (  )

Definition at line 672 of file qxtflowview.cpp.

References clear(), insertSlide(), model, modelmap, piccolumn, picrole, rootindex, and triggerRender().

Referenced by layoutChanged(), modelReset(), setModel(), QxtFlowView::setPictureColumn(), QxtFlowView::setPictureRole(), and QxtFlowView::setReflectionEffect().

{
    clear();
    if (model)
    {
        for (int i = 0;i < model->rowCount(rootindex);i++)
        {
            QModelIndex idx = model->index(i, piccolumn, rootindex);
            insertSlide(i, qvariant_cast<QImage>(model->data(idx, picrole)));
            modelmap.insert(i, idx);
        }
    }
    triggerRender();
}
void QxtFlowViewPrivate::rowsAboutToBeInserted ( const QModelIndex &  parent,
int  start,
int  end 
) [slot]

Definition at line 505 of file qxtflowview.cpp.

Referenced by setModel().

{
    Q_UNUSED(parent);
    Q_UNUSED(start);
    Q_UNUSED(end);
}
void QxtFlowViewPrivate::rowsAboutToBeRemoved ( const QModelIndex &  parent,
int  start,
int  end 
) [slot]

Definition at line 512 of file qxtflowview.cpp.

Referenced by setModel().

{
    Q_UNUSED(parent);
    Q_UNUSED(start);
    Q_UNUSED(end);
}
void QxtFlowViewPrivate::rowsInserted ( const QModelIndex &  parent,
int  start,
int  end 
) [slot]

Definition at line 519 of file qxtflowview.cpp.

References insertSlide(), model, modelmap, piccolumn, picrole, and rootindex.

Referenced by setModel().

{
    if (rootindex != parent)
        return;
    for (int i = start;i <= end;i++)
    {
        QModelIndex idx = model->index(i, piccolumn, rootindex);
        insertSlide(i, qvariant_cast<QImage>(model->data(idx, picrole)));
        modelmap.insert(i, idx);
    }
}
void QxtFlowViewPrivate::rowsRemoved ( const QModelIndex &  parent,
int  start,
int  end 
) [slot]

Definition at line 531 of file qxtflowview.cpp.

References modelmap, removeSlide(), and rootindex.

Referenced by setModel().

{
    if (rootindex != parent)
        return;
    for (int i = start;i <= end;i++)
    {
        removeSlide(i);
        modelmap.removeAt(i);
    }

}
void QxtFlowViewPrivate::setCurrentIndex ( QModelIndex  index )

Definition at line 689 of file qxtflowview.cpp.

References animator, QxtFlowViewState::centerIndex, model, modelmap, QxtFlowViewState::reset(), rootindex, state, QxtFlowViewAnimator::stop(), and triggerRender().

Referenced by layoutChanged(), and QxtFlowView::setCurrentIndex().

{
    if (model->parent(index) != rootindex)
        return;

    int r = modelmap.indexOf(index);
    if (r < 0)
        return;

    state->centerIndex = r;
    state->reset();
    animator->stop(r);
    triggerRender();
}
void QxtFlowViewPrivate::setModel ( QAbstractItemModel *  model )

Definition at line 543 of file qxtflowview.cpp.

References columnsAboutToBeInserted(), columnsAboutToBeRemoved(), columnsInserted(), columnsRemoved(), dataChanged(), headerDataChanged(), layoutAboutToBeChanged(), layoutChanged(), model, modelAboutToBeReset(), modelReset(), reset(), rootindex, rowsAboutToBeInserted(), rowsAboutToBeRemoved(), rowsInserted(), and rowsRemoved().

Referenced by QxtFlowView::setModel().

{


    if (model)
    {

        disconnect(this->model, SIGNAL(columnsAboutToBeInserted(const QModelIndex & , int , int)),
                   this, SLOT(columnsAboutToBeInserted(const QModelIndex & , int , int)));
        disconnect(this->model, SIGNAL(columnsAboutToBeRemoved(const QModelIndex & , int , int)),
                   this, SLOT(columnsAboutToBeRemoved(const QModelIndex & , int , int)));
        disconnect(this->model, SIGNAL(columnsInserted(const QModelIndex & , int , int)),
                   this, SLOT(columnsInserted(const QModelIndex & , int , int)));
        disconnect(this->model, SIGNAL(columnsRemoved(const QModelIndex & , int , int)),
                   this, SLOT(columnsRemoved(const QModelIndex & , int , int)));
        disconnect(this->model, SIGNAL(dataChanged(const QModelIndex & , const QModelIndex &)),
                   this, SLOT(dataChanged(const QModelIndex & , const QModelIndex &)));
        disconnect(this->model, SIGNAL(headerDataChanged(Qt::Orientation , int , int)),
                   this, SLOT(headerDataChanged(Qt::Orientation , int , int)));
        disconnect(this->model, SIGNAL(layoutAboutToBeChanged()),
                   this, SLOT(layoutAboutToBeChanged()));
        disconnect(this->model, SIGNAL(layoutChanged()),
                   this, SLOT(layoutChanged()));
        disconnect(this->model, SIGNAL(modelAboutToBeReset()),
                   this, SLOT(modelAboutToBeReset()));
        disconnect(this->model, SIGNAL(modelReset()),
                   this, SLOT(modelReset()));
        disconnect(this->model, SIGNAL(rowsAboutToBeInserted(const QModelIndex & , int , int)),
                   this, SLOT(rowsAboutToBeInserted(const QModelIndex & , int , int)));
        disconnect(this->model, SIGNAL(rowsAboutToBeRemoved(const QModelIndex & , int , int)),
                   this, SLOT(rowsAboutToBeRemoved(const QModelIndex & , int , int)));
        disconnect(this->model, SIGNAL(rowsInserted(const QModelIndex & , int , int)),
                   this, SLOT(rowsInserted(const QModelIndex & , int , int)));
        disconnect(this->model, SIGNAL(rowsRemoved(const QModelIndex & , int , int)),
                   this, SLOT(rowsRemoved(const QModelIndex & , int , int)));
    }
    model = m;
    if (model)
    {
        rootindex = model->parent(QModelIndex());

        connect(this->model, SIGNAL(columnsAboutToBeInserted(const QModelIndex & , int , int)),
                this, SLOT(columnsAboutToBeInserted(const QModelIndex & , int , int)));
        connect(this->model, SIGNAL(columnsAboutToBeRemoved(const QModelIndex & , int , int)),
                this, SLOT(columnsAboutToBeRemoved(const QModelIndex & , int , int)));
        connect(this->model, SIGNAL(columnsInserted(const QModelIndex & , int , int)),
                this, SLOT(columnsInserted(const QModelIndex & , int , int)));
        connect(this->model, SIGNAL(columnsRemoved(const QModelIndex & , int , int)),
                this, SLOT(columnsRemoved(const QModelIndex & , int , int)));
        connect(this->model, SIGNAL(dataChanged(const QModelIndex & , const QModelIndex &)),
                this, SLOT(dataChanged(const QModelIndex & , const QModelIndex &)));
        connect(this->model, SIGNAL(headerDataChanged(Qt::Orientation , int , int)),
                this, SLOT(headerDataChanged(Qt::Orientation , int , int)));
        connect(this->model, SIGNAL(layoutAboutToBeChanged()),
                this, SLOT(layoutAboutToBeChanged()));
        connect(this->model, SIGNAL(layoutChanged()),
                this, SLOT(layoutChanged()));
        connect(this->model, SIGNAL(modelAboutToBeReset()),
                this, SLOT(modelAboutToBeReset()));
        connect(this->model, SIGNAL(modelReset()),
                this, SLOT(modelReset()));
        connect(this->model, SIGNAL(rowsAboutToBeInserted(const QModelIndex & , int , int)),
                this, SLOT(rowsAboutToBeInserted(const QModelIndex & , int , int)));
        connect(this->model, SIGNAL(rowsAboutToBeRemoved(const QModelIndex & , int , int)),
                this, SLOT(rowsAboutToBeRemoved(const QModelIndex & , int , int)));
        connect(this->model, SIGNAL(rowsInserted(const QModelIndex & , int , int)),
                this, SLOT(rowsInserted(const QModelIndex & , int , int)));
        connect(this->model, SIGNAL(rowsRemoved(const QModelIndex & , int , int)),
                this, SLOT(rowsRemoved(const QModelIndex & , int , int)));
    }

    reset();
}
void QxtFlowViewPrivate::showSlide ( int  index )
void QxtFlowViewPrivate::triggerRender (  )

Definition at line 631 of file qxtflowview.cpp.

References triggerTimer.

Referenced by clear(), insertSlide(), removeSlide(), replaceSlide(), reset(), setCurrentIndex(), and QxtFlowView::triggerRender().

{
    triggerTimer.setSingleShot(true);
    triggerTimer.start(0);
}

Member Data Documentation

QPersistentModelIndex QxtFlowViewPrivate::currentcenter

Definition at line 275 of file qxtflowview_p.h.

Referenced by layoutChanged().

Definition at line 277 of file qxtflowview_p.h.

Referenced by QxtFlowView::mouseMoveEvent(), and QxtFlowView::mousePressEvent().

QAbstractItemModel* QxtFlowViewPrivate::model
QList<QPersistentModelIndex> QxtFlowViewPrivate::modelmap

Definition at line 270 of file qxtflowview_p.h.

Referenced by QxtFlowView::QxtFlowView().

Definition at line 268 of file qxtflowview_p.h.

Referenced by QxtFlowView::QxtFlowView().

Definition at line 256 of file qxtflowview_p.h.

Referenced by QxtFlowView::QxtFlowView(), and triggerRender().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines