[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kcachegrind/frameworks] libviews: Enable icons for cycles
From:       Josef Weidendorfer <Josef.Weidendorfer () gmx ! de>
Date:       2016-10-24 20:51:44
Message-ID: E1bymDg-00016S-P7 () code ! kde ! org
[Download RAW message or body]

Git commit e34e7a5b5b2044e960f644e2fab804b84ff25d4d by Josef Weidendorfer.
Committed on 24/10/2016 at 20:40.
Pushed by weidendo into branch 'frameworks'.

Enable icons for cycles

This was commented out long ago... compiles fine even with Qt4.

M  +5    -10   libviews/callgraphview.cpp
M  +2    -7    libviews/callitem.cpp
M  +2    -6    libviews/instritem.cpp

http://commits.kde.org/kcachegrind/e34e7a5b5b2044e960f644e2fab804b84ff25d4d

diff --git a/libviews/callgraphview.cpp b/libviews/callgraphview.cpp
index 2e0843e..84e4251 100644
--- a/libviews/callgraphview.cpp
+++ b/libviews/callgraphview.cpp
@@ -1305,16 +1305,11 @@ CanvasEdgeLabel::CanvasEdgeLabel(CallGraphView* v, CanvasEdge* ce, int x,
 	_percentage = inclP;
 	if (_percentage > 100.0) _percentage = 100.0;
 
-	if (e->call() && (e->call()->isRecursion() || e->call()->inCycle())) {
-		QString icon = "edit-undo";
-#if 0
-		KIconLoader* loader = KIconLoader::global();
-		QPixmap p= loader->loadIcon(icon, KIconLoader::Small, 0,
-		                            KIconLoader::DefaultState, QStringList(), 0,
-		                            true);
-		setPixmap(0, p);
-#endif
-	}
+    if (e->call() && (e->call()->isRecursion() || e->call()->inCycle())) {
+        QFontMetrics fm(font());
+        QPixmap p = QIcon::fromTheme(QString("edit-undo")).pixmap(fm.height());
+        setPixmap(pixPos, p); // replace percentage pixmap
+    }
 }
 
 void CanvasEdgeLabel::paint(QPainter* p,
diff --git a/libviews/callitem.cpp b/libviews/callitem.cpp
index 298c2f9..603eacb 100644
--- a/libviews/callitem.cpp
+++ b/libviews/callitem.cpp
@@ -147,13 +147,8 @@ void CallItem::updateCost()
 
     QPixmap p;
     if (sameCycle && !selectedIsCycle && !shownIsCycle) {
-
-	QString icon = "edit-undo";
-#if 0 // TODO
-	KIconLoader* loader = KIconLoader::global();
-	p= loader->loadIcon(icon, KIconLoader::Small, 0,
-			    KIconLoader::DefaultState, QStringList(), 0, true);
-#endif
+        QFontMetrics fm(font(4));
+        p = QIcon::fromTheme(QString("edit-undo")).pixmap(fm.height());
     }
     setIcon(4, p);
 }
diff --git a/libviews/instritem.cpp b/libviews/instritem.cpp
index 592be77..2fa043a 100644
--- a/libviews/instritem.cpp
+++ b/libviews/instritem.cpp
@@ -196,12 +196,8 @@ void InstrItem::updateCost()
     QString str;
     QPixmap p;
 
-    QString icon = "edit-undo";
-#if 0 // TODO
-    KIconLoader* loader = KIconLoader::global();
-    p= loader->loadIcon(icon, KIconLoader::Small, 0,
-                        KIconLoader::DefaultState, QStringList(), 0, true);
-#endif
+    QFontMetrics fm(font(1));
+    p = QIcon::fromTheme(QString("edit-undo")).pixmap(fm.height());
     if (p.isNull())
       str = QObject::tr("(cycle)");
 

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic