┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/private
diff options
context:
space:
mode:
authorarnav dhamija <[email protected]>2017-02-13 22:23:41 +0530
committerarnav dhamija <[email protected]>2017-02-13 22:23:41 +0530
commit41253c0c81bafb54a0b6c82e5282e3add85e8a50 (patch)
tree9a5ccfbade73ee481884ac53aa7e2fe724f25272 /src/kitemviews/private
parent67099640b90588af1c72c340756253400da3e95b (diff)
parent7fce8f0e9b1e0bb2deb6e32fe88d5411b9be2834 (diff)
Merge branch 'master' of git.kde.org:dolphin
Diffstat (limited to 'src/kitemviews/private')
-rw-r--r--src/kitemviews/private/kbaloorolesprovider.cpp3
-rw-r--r--src/kitemviews/private/kfileitemmodeldirlister.h2
-rw-r--r--src/kitemviews/private/kitemlistheaderwidget.h16
-rw-r--r--src/kitemviews/private/kitemlistroleeditor.h6
-rw-r--r--src/kitemviews/private/kitemlistselectiontoggle.h4
-rw-r--r--src/kitemviews/private/kitemlistsizehintresolver.cpp13
-rw-r--r--src/kitemviews/private/kitemlistsizehintresolver.h2
-rw-r--r--src/kitemviews/private/kitemlistsmoothscroller.h2
8 files changed, 32 insertions, 16 deletions
diff --git a/src/kitemviews/private/kbaloorolesprovider.cpp b/src/kitemviews/private/kbaloorolesprovider.cpp
index e0b889e6c..16e3935ca 100644
--- a/src/kitemviews/private/kbaloorolesprovider.cpp
+++ b/src/kitemviews/private/kbaloorolesprovider.cpp
@@ -138,6 +138,7 @@ KBalooRolesProvider::KBalooRolesProvider() :
{ "rating", "rating" },
{ "tag", "tags" },
{ "comment", "comment" },
+ { "title", "title" },
{ "wordCount", "wordCount" },
{ "lineCount", "lineCount" },
{ "width", "imageSize" },
@@ -181,7 +182,7 @@ QString KBalooRolesProvider::orientationFromValue(int value) const
QString KBalooRolesProvider::durationFromValue(int value) const
{
- QTime duration;
+ QTime duration(0, 0, 0);
duration = duration.addSecs(value);
return duration.toString(QStringLiteral("hh:mm:ss"));
}
diff --git a/src/kitemviews/private/kfileitemmodeldirlister.h b/src/kitemviews/private/kfileitemmodeldirlister.h
index c2c621aed..5aa2b6303 100644
--- a/src/kitemviews/private/kfileitemmodeldirlister.h
+++ b/src/kitemviews/private/kfileitemmodeldirlister.h
@@ -48,7 +48,7 @@ signals:
void urlIsFileError(const QUrl& url);
protected:
- virtual void handleError(KIO::Job* job);
+ void handleError(KIO::Job* job) Q_DECL_OVERRIDE;
};
#endif
diff --git a/src/kitemviews/private/kitemlistheaderwidget.h b/src/kitemviews/private/kitemlistheaderwidget.h
index 2a80c205d..2342b4907 100644
--- a/src/kitemviews/private/kitemlistheaderwidget.h
+++ b/src/kitemviews/private/kitemlistheaderwidget.h
@@ -64,7 +64,7 @@ public:
qreal minimumColumnWidth() const;
- virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
+ void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0) Q_DECL_OVERRIDE;
signals:
/**
@@ -104,13 +104,13 @@ signals:
void sortRoleChanged(const QByteArray& current, const QByteArray& previous);
protected:
- virtual void mousePressEvent(QGraphicsSceneMouseEvent* event);
- virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);
- virtual void mouseMoveEvent(QGraphicsSceneMouseEvent* event);
- virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event);
- virtual void hoverEnterEvent(QGraphicsSceneHoverEvent* event);
- virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent* event);
- virtual void hoverMoveEvent(QGraphicsSceneHoverEvent* event);
+ void mousePressEvent(QGraphicsSceneMouseEvent* event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QGraphicsSceneMouseEvent* event) Q_DECL_OVERRIDE;
+ void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event) Q_DECL_OVERRIDE;
+ void hoverEnterEvent(QGraphicsSceneHoverEvent* event) Q_DECL_OVERRIDE;
+ void hoverLeaveEvent(QGraphicsSceneHoverEvent* event) Q_DECL_OVERRIDE;
+ void hoverMoveEvent(QGraphicsSceneHoverEvent* event) Q_DECL_OVERRIDE;
private slots:
void slotSortRoleChanged(const QByteArray& current, const QByteArray& previous);
diff --git a/src/kitemviews/private/kitemlistroleeditor.h b/src/kitemviews/private/kitemlistroleeditor.h
index 3b8f96865..f889ea4f4 100644
--- a/src/kitemviews/private/kitemlistroleeditor.h
+++ b/src/kitemviews/private/kitemlistroleeditor.h
@@ -44,15 +44,15 @@ public:
void setRole(const QByteArray& role);
QByteArray role() const;
- virtual bool eventFilter(QObject* watched, QEvent* event);
+ bool eventFilter(QObject* watched, QEvent* event) Q_DECL_OVERRIDE;
signals:
void roleEditingFinished(const QByteArray& role, const QVariant& value);
void roleEditingCanceled(const QByteArray& role, const QVariant& value);
protected:
- virtual bool event(QEvent* event);
- virtual void keyPressEvent(QKeyEvent* event);
+ bool event(QEvent* event) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent* event) Q_DECL_OVERRIDE;
private slots:
/**
diff --git a/src/kitemviews/private/kitemlistselectiontoggle.h b/src/kitemviews/private/kitemlistselectiontoggle.h
index d058ee988..e3f5bb63c 100644
--- a/src/kitemviews/private/kitemlistselectiontoggle.h
+++ b/src/kitemviews/private/kitemlistselectiontoggle.h
@@ -42,10 +42,10 @@ public:
void setHovered(bool hovered);
- virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
+ void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0) Q_DECL_OVERRIDE;
protected:
- virtual void resizeEvent(QGraphicsSceneResizeEvent* event);
+ void resizeEvent(QGraphicsSceneResizeEvent* event) Q_DECL_OVERRIDE;
private:
void updatePixmap();
diff --git a/src/kitemviews/private/kitemlistsizehintresolver.cpp b/src/kitemviews/private/kitemlistsizehintresolver.cpp
index 1d8067026..02f1865b3 100644
--- a/src/kitemviews/private/kitemlistsizehintresolver.cpp
+++ b/src/kitemviews/private/kitemlistsizehintresolver.cpp
@@ -25,6 +25,7 @@ KItemListSizeHintResolver::KItemListSizeHintResolver(const KItemListView* itemLi
m_itemListView(itemListView),
m_logicalHeightHintCache(),
m_logicalWidthHint(0.0),
+ m_logicalHeightHint(0.0),
m_needsResolving(false)
{
}
@@ -33,6 +34,12 @@ KItemListSizeHintResolver::~KItemListSizeHintResolver()
{
}
+QSizeF KItemListSizeHintResolver::maxSizeHint()
+{
+ updateCache();
+ return QSizeF(m_logicalWidthHint, m_logicalHeightHint);
+}
+
QSizeF KItemListSizeHintResolver::sizeHint(int index)
{
updateCache();
@@ -149,6 +156,12 @@ void KItemListSizeHintResolver::updateCache()
{
if (m_needsResolving) {
m_itemListView->calculateItemSizeHints(m_logicalHeightHintCache, m_logicalWidthHint);
+ // Set logical height as the max cached height (if the cache is not empty).
+ if (m_logicalHeightHintCache.isEmpty()) {
+ m_logicalHeightHint = 0.0;
+ } else {
+ m_logicalHeightHint = *std::max_element(m_logicalHeightHintCache.begin(), m_logicalHeightHintCache.end());
+ }
m_needsResolving = false;
}
}
diff --git a/src/kitemviews/private/kitemlistsizehintresolver.h b/src/kitemviews/private/kitemlistsizehintresolver.h
index ff17f2de2..841e9ca10 100644
--- a/src/kitemviews/private/kitemlistsizehintresolver.h
+++ b/src/kitemviews/private/kitemlistsizehintresolver.h
@@ -36,6 +36,7 @@ class DOLPHIN_EXPORT KItemListSizeHintResolver
public:
KItemListSizeHintResolver(const KItemListView* itemListView);
virtual ~KItemListSizeHintResolver();
+ QSizeF maxSizeHint();
QSizeF sizeHint(int index);
void itemsInserted(const KItemRangeList& itemRanges);
@@ -50,6 +51,7 @@ private:
const KItemListView* m_itemListView;
mutable QVector<qreal> m_logicalHeightHintCache;
mutable qreal m_logicalWidthHint;
+ mutable qreal m_logicalHeightHint;
bool m_needsResolving;
};
diff --git a/src/kitemviews/private/kitemlistsmoothscroller.h b/src/kitemviews/private/kitemlistsmoothscroller.h
index a3576a3fd..7d01a6b62 100644
--- a/src/kitemviews/private/kitemlistsmoothscroller.h
+++ b/src/kitemviews/private/kitemlistsmoothscroller.h
@@ -83,7 +83,7 @@ public:
void handleWheelEvent(QWheelEvent* event);
protected:
- virtual bool eventFilter(QObject* obj, QEvent* event);
+ bool eventFilter(QObject* obj, QEvent* event) Q_DECL_OVERRIDE;
private slots:
void slotAnimationStateChanged(QAbstractAnimation::State newState,