Linux-Trace-Devel Archive on lore.kernel.org
 help / color / Atom feed
From: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
To: linux-trace-devel@vger.kernel.org
Cc: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
Subject: [PATCH 1/4] kernel-shark: Fix warnings from deprecated Qt APIs
Date: Wed, 21 Apr 2021 17:51:37 +0300
Message-ID: <20210421145140.95517-2-y.karadz@gmail.com> (raw)
In-Reply-To: <20210421145140.95517-1-y.karadz@gmail.com>

Couple of APIs used by KernelShark have been marked as deprecated
in the recent version of Qt. Fix all compilation warnings caused
by the usage of these deprecated APIs.

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 src/KsTraceGraph.cpp |  9 +++++++--
 src/KsWidgetsLib.cpp | 14 +++++++-------
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/src/KsTraceGraph.cpp b/src/KsTraceGraph.cpp
index fd9cfac..1e976df 100644
--- a/src/KsTraceGraph.cpp
+++ b/src/KsTraceGraph.cpp
@@ -327,13 +327,18 @@ void KsTraceGraph::_setPointerInfo(size_t i)
 	QString aux(lanMakeString(kshark_get_aux_info(e)));
 	QString info(lanMakeString(kshark_get_info(e)));
 	QString comm(lanMakeString(kshark_get_task(e)));
-	QString pointer, elidedText;
+	QString elidedText;
 	int labelWidth;
 	uint64_t sec, usec;
+	char *pointer;
 
 	kshark_convert_nano(e->ts, &sec, &usec);
-	pointer.sprintf("%" PRIu64 ".%06" PRIu64 "", sec, usec);
+	labelWidth = asprintf(&pointer, "%" PRIu64 ".%06" PRIu64 "", sec, usec);
+	if (labelWidth <= 0)
+		return;
+
 	_labelP2.setText(pointer);
+	free(pointer);
 
 	comm.append("-");
 	comm.append(QString("%1").arg(kshark_get_pid(e)));
diff --git a/src/KsWidgetsLib.cpp b/src/KsWidgetsLib.cpp
index 4ec6033..e30bf27 100644
--- a/src/KsWidgetsLib.cpp
+++ b/src/KsWidgetsLib.cpp
@@ -926,9 +926,9 @@ KsCPUCheckBoxWidget::KsCPUCheckBoxWidget(kshark_data_stream *stream, QWidget *pa
 		cpuItem->setText(0, "  ");
 		cpuItem->setText(1, QString("CPU %1").arg(i));
 		cpuItem->setCheckState(0, Qt::Checked);
-		cpuItem->setBackgroundColor(0, QColor(colors[i].r(),
-						      colors[i].g(),
-						      colors[i].b()));
+		cpuItem->setBackground(0, QColor(colors[i].r(),
+						 colors[i].g(),
+						 colors[i].b()));
 		_tree.addTopLevelItem(cpuItem);
 		_id[i] = i;
 		_cb[i] = cpuItem;
@@ -1115,12 +1115,12 @@ KsTasksCheckBoxWidget::KsTasksCheckBoxWidget(kshark_data_stream *stream,
 
 		comItem = new QTableWidgetItem(tr(comm));
 
-		pidItem->setBackgroundColor(QColor(colors[pid].r(),
-						   colors[pid].g(),
-						   colors[pid].b()));
+		pidItem->setBackground(QColor(colors[pid].r(),
+					      colors[pid].g(),
+					      colors[pid].b()));
 
 		if (_id[i] == 0)
-			pidItem->setTextColor(Qt::white);
+			pidItem->setForeground(Qt::white);
 
 		_table.setItem(i, 2, comItem);
 	}
-- 
2.27.0


  reply index

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-21 14:51 [PATCH 0/4] Various minor modifications and fixes toward KS 2.0 Yordan Karadzhov (VMware)
2021-04-21 14:51 ` Yordan Karadzhov (VMware) [this message]
2021-04-21 14:51 ` [PATCH 2/4] kernel-shark: Polish the README file Yordan Karadzhov (VMware)
2021-04-21 14:51 ` [PATCH 3/4] kernel-shark: Exclude libkshark-plot from libkshark-devel Yordan Karadzhov (VMware)
2021-04-21 14:51 ` [PATCH 4/4] kernel-shark: Integrate install_libkshark-devel.sh Yordan Karadzhov (VMware)
2021-04-21 15:01 ` [PATCH 0/4] Various minor modifications and fixes toward KS 2.0 Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210421145140.95517-2-y.karadz@gmail.com \
    --to=y.karadz@gmail.com \
    --cc=linux-trace-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-Trace-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-trace-devel/0 linux-trace-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-trace-devel linux-trace-devel/ https://lore.kernel.org/linux-trace-devel \
		linux-trace-devel@vger.kernel.org
	public-inbox-index linux-trace-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-trace-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git