class QModelIndex;
class KDirModel;
-/* Grants "auto expand"/ "spring-loaded folders" to
- the provided view. Qt has its own auto-expand
- mechanism, but this works only for QTreeView and
- does not play well with our auto-scrolling in
- the Folders pane. Auto-expansion is enabled by default.
-
- If the provided view is a QTreeView, the expanded state
- is automatically toggled on hover. Otherwise, the enterDir()
- signal is emitted, and the caller needs to ensure that
- the requested directory is entered.
-
- The FolderExpander becomes a child of the provided view */
-
/**
* Grants auto expanding functionality to the provided item view.
* Qt has its own auto expand mechanism, but this works only
* per default.
*
* If the provided view is an instance of the class QTreeView, the
- * expanded of the directory is automatically done on hover. Otherwise
+ * expansion of the directory is automatically done on hover. Otherwise
* the enterDir() signal is emitted and the caller needs to ensure that
* the requested directory is entered.
*
class LIBDOLPHINPRIVATE_EXPORT FolderExpander : public QObject
{
Q_OBJECT
-
+
public:
FolderExpander(QAbstractItemView* view, QSortFilterProxyModel* proxyModel);
virtual ~FolderExpander();
-
+
void setEnabled(bool enabled);
bool enabled() const;
-
+
signals:
/**
* Is emitted if the directory \a dirModelIndex should be entered. The
* signal is not emitted when a QTreeView is used, as the entering of
* the directory is already provided by expanding the tree node.
*/
- void enterDir(const QModelIndex& dirModelIndex);
-
+ void enterDir(const QModelIndex& dirModelIndex, QAbstractItemView* view);
+
+
private slots:
void viewScrolled();
void autoExpandTimeout();
-private:
+private:
bool m_enabled;
-
+
QAbstractItemView* m_view;
QSortFilterProxyModel* m_proxyModel;