Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/itemviews/qabstractitemview_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    6262#include "QtGui/qpainter.h"
    6363#include "QtCore/qpair.h"
    64 #include "QtCore/qtimer.h"
    65 #include "QtCore/qtimeline.h"
    6664#include "QtGui/qregion.h"
    6765#include "QtCore/qdebug.h"
    6866#include "QtGui/qpainter.h"
     67#include "QtCore/qbasictimer.h"
    6968
    7069#ifndef QT_NO_ITEMVIEWS
     
    8786
    8887};
     88
     89typedef QPair<QRect, QModelIndex> QItemViewPaintPair;
     90typedef QList<QItemViewPaintPair> QItemViewPaintPairs;
    8991
    9092class QEmptyModel : public QAbstractItemModel
     
    100102};
    101103
    102 class Q_GUI_EXPORT QAbstractItemViewPrivate : public QAbstractScrollAreaPrivate
     104class Q_AUTOTEST_EXPORT QAbstractItemViewPrivate : public QAbstractScrollAreaPrivate
    103105{
    104106    Q_DECLARE_PUBLIC(QAbstractItemView)
     
    110112    void init();
    111113
    112     void _q_rowsRemoved(const QModelIndex &parent, int start, int end);
    113     void _q_columnsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
    114     void _q_columnsRemoved(const QModelIndex &parent, int start, int end);
    115     void _q_columnsInserted(const QModelIndex &parent, int start, int end);
    116     void _q_modelDestroyed();
    117     void _q_layoutChanged();
    118     void _q_fetchMore();
     114    virtual void _q_rowsRemoved(const QModelIndex &parent, int start, int end);
     115    virtual void _q_columnsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
     116    virtual void _q_columnsRemoved(const QModelIndex &parent, int start, int end);
     117    virtual void _q_columnsInserted(const QModelIndex &parent, int start, int end);
     118    virtual void _q_modelDestroyed();
     119    virtual void _q_layoutChanged();
     120    void _q_headerDataChanged() { doDelayedItemsLayout(); }
     121
     122    void fetchMore();
    119123
    120124    bool shouldEdit(QAbstractItemView::EditTrigger trigger, const QModelIndex &index) const;
     
    123127    void doDelayedItemsLayout(int delay = 0);
    124128    void interruptDelayedItemsLayout() const;
     129
     130    void startAutoScroll()
     131    {   // ### it would be nice to make this into a style hint one day
     132        int scrollInterval = (verticalScrollMode == QAbstractItemView::ScrollPerItem) ? 150 : 50;
     133        autoScrollTimer.start(scrollInterval, q_func());
     134        autoScrollCount = 0;
     135    }
     136    void stopAutoScroll() { autoScrollTimer.stop(); autoScrollCount = 0;}
     137
    125138
    126139    bool dropOn(QDropEvent *event, int *row, int *col, QModelIndex *index);
     
    140153    virtual void selectAll(QItemSelectionModel::SelectionFlags command);
    141154
     155    void setHoverIndex(const QPersistentModelIndex &index);
     156
     157    void checkMouseMove(const QPersistentModelIndex &index);
     158    inline void checkMouseMove(const QPoint &pos) { checkMouseMove(q_func()->indexAt(pos)); }
     159
    142160    inline QItemSelectionModel::SelectionFlags selectionBehaviorFlags() const
    143161    {
     
    150168
    151169#ifndef QT_NO_DRAGANDDROP
    152     QAbstractItemView::DropIndicatorPosition position(const QPoint &pos, const QRect &rect, const QModelIndex &idx) const;
     170    virtual QAbstractItemView::DropIndicatorPosition position(const QPoint &pos, const QRect &rect, const QModelIndex &idx) const;
     171
    153172    inline bool canDecode(QDropEvent *e) const {
    154173        QStringList modelTypes = model->mimeTypes();
     
    174193        }
    175194    }
     195
    176196#endif
     197    virtual QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const;
    177198
    178199    inline void releaseEditor(QWidget *editor) const {
     
    219240    void checkPersistentEditorFocus();
    220241
    221     QPixmap renderToPixmap(const QModelIndexList &indexes, QRect *r = 0) const;
     242    QPixmap renderToPixmap(const QModelIndexList &indexes, QRect *r) const;
    222243
    223244    inline QPoint offset() const {
     
    299320        return ref;
    300321    }
    301    
     322
    302323    /**
    303324     * return true if the index is registered as a QPersistentModelIndex
     
    305326    inline bool isPersistent(const QModelIndex &index) const
    306327    {
    307         return static_cast<QAbstractItemModelPrivate *>(model->d_ptr)->persistent.indexes.contains(index);
     328        return static_cast<QAbstractItemModelPrivate *>(model->d_ptr.data())->persistent.indexes.contains(index);
    308329    }
    309330
     
    311332
    312333    QStyleOptionViewItemV4 viewOptionsV4() const;
     334
     335    void doDelayedReset()
     336    {
     337        //we delay the reset of the timer because some views (QTableView)
     338        //with headers can't handle the fact that the model has been destroyed
     339        //all _q_modelDestroyed slots must have been called
     340        if (!delayedReset.isActive())
     341            delayedReset.start(0, q_func());
     342    }
    313343
    314344    QAbstractItemModel *model;
     
    317347    QMap<int, QPointer<QAbstractItemDelegate> > columnDelegates;
    318348    QPointer<QItemSelectionModel> selectionModel;
     349    QItemSelectionModel::SelectionFlag ctrlDragSelectionFlag;
     350    bool noSelectionOnMousePress;
    319351
    320352    QAbstractItemView::SelectionMode selectionMode;
     
    330362    QPoint pressedPosition;
    331363    bool pressedAlreadySelected;
    332    
    333     //forces the next mouseMoveEvent to send the viewportEntered signal 
     364
     365    //forces the next mouseMoveEvent to send the viewportEntered signal
    334366    //if the mouse is over the viewport and not over an item
    335367    bool viewportEnteredNeeded;
     
    351383    bool overwrite;
    352384    QAbstractItemView::DropIndicatorPosition dropIndicatorPosition;
     385    Qt::DropAction defaultDropAction;
     386#endif
     387
     388#ifdef QT_SOFTKEYS_ENABLED
     389    QAction *doneSoftKey;
    353390#endif
    354391
     
    360397    int autoScrollMargin;
    361398    int autoScrollCount;
     399    bool shouldScrollToCurrentOnShow; //used to know if we should scroll to current on show event
     400    bool shouldClearStatusTip; //if there is a statustip currently shown that need to be cleared when leaving.
    362401
    363402    bool alternatingColors;
     
    372411    QBasicTimer delayedEditing;
    373412    QBasicTimer delayedAutoScroll; //used when an item is clicked
    374     QTimeLine timeline;
     413    QBasicTimer delayedReset;
    375414
    376415    QAbstractItemView::ScrollMode verticalScrollMode;
     
    384423private:
    385424    mutable QBasicTimer delayedLayout;
     425    mutable QBasicTimer fetchMoreTimer;
    386426};
    387427
Note: See TracChangeset for help on using the changeset viewer.