[SCM] ktp-contact-list packaging branch, master, updated. debian/15.12.1-2-1070-g6c56f91

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:14:37 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-contact-list.git;a=commitdiff;h=de0452a

The following commit has been merged in the master branch:
commit de0452aec3f4f95375c70880aeea9cdd08702045
Author: Martin Klapetek <mklapetek at kde.org>
Date:   Fri Apr 25 12:58:54 2014 +0200

    Partially Revert "Add a filter to hide empty groups as well as fix expansion of metacontacts"
    
    This partially reverts commit e65e7fc099d647d62fd7eb36f8ae905839b2a935.
    
    This commit caused a visual regression in the contact list delegate,
    reverting part of it back.
---
 contact-list-widget.cpp | 24 ++++++++++++++++++++++++
 contact-list-widget_p.h |  1 +
 2 files changed, 25 insertions(+)

diff --git a/contact-list-widget.cpp b/contact-list-widget.cpp
index a636c84..ae1b9c9 100644
--- a/contact-list-widget.cpp
+++ b/contact-list-widget.cpp
@@ -65,6 +65,28 @@
 #include <kpeople/personsmodel.h>
 #endif
 
+//create a new style that does not draw the vertical lines in the tree view
+//this maps "draw branch" to "draw right arrow" and "draw down arrow"
+//we cannot just override drawBranches as then we cannot highlight the active branch
+//Qt does so by utilising some internal methods of QTreeView
+class NoLinesStyle: public QProxyStyle
+{
+    void drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const
+    {
+        if (element == QStyle::PE_IndicatorBranch) {
+            if (option->state & QStyle::State_Children) {
+                if (option->state & QStyle::State_Open) {
+                    return QProxyStyle::drawPrimitive(PE_IndicatorArrowDown, option, painter, widget);
+                } else {
+                    return QProxyStyle::drawPrimitive(PE_IndicatorArrowRight, option, painter, widget);
+                }
+            }
+        } else {
+            return QProxyStyle::drawPrimitive(element, option, painter, widget);
+        }
+    }
+};
+
 ContactListWidget::ContactListWidget(QWidget *parent)
     : QTreeView(parent),
       d_ptr(new ContactListWidgetPrivate)
@@ -82,7 +104,9 @@ ContactListWidget::ContactListWidget(QWidget *parent)
     d->model->setTrackUnreadMessages(true);
     d->model->setDynamicSortFilter(true);
     d->model->setSortRole(Qt::DisplayRole);
+    d->style.reset(new NoLinesStyle());
 
+    setStyle(d->style.data());
     loadGroupStatesFromConfig();
 
     header()->hide();
diff --git a/contact-list-widget_p.h b/contact-list-widget_p.h
index df117bc..e4a5eb3 100644
--- a/contact-list-widget_p.h
+++ b/contact-list-widget_p.h
@@ -54,6 +54,7 @@ public:
     Tp::AccountManagerPtr         accountManager;
     KTp::ContactsModel::GroupMode groupMode; // Stores current grouping mode (by accounts or by groups)
     QPersistentModelIndex         selectedIndex;
+    QScopedPointer<QStyle>        style;
 };
 
 #endif //CONTACT_LIST_WIDGET_P_H

-- 
ktp-contact-list packaging



More information about the pkg-kde-commits mailing list