From: Yordan Karadzhov <ykaradzhov@vmware.com> To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org Subject: [PATCH v2 3/6] kernel-shark-qt: Make the selection in the Table less touchy Date: Wed, 9 Jan 2019 15:09:42 +0200 Message-ID: <20190109130945.28519-4-ykaradzhov@vmware.com> (raw) In-Reply-To: <20190109130945.28519-1-ykaradzhov@vmware.com> This patch aims to make the selection in the table by using the mouse more intuitive (less touchy). First of all, it disables the auto-scrolling in horizontal direction. In addition to this, it makes sure that all columns of the table have proper sizes when the main window gets resized by the user. Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> --- kernel-shark-qt/src/KsTraceViewer.cpp | 18 ++++++++++++++++++ kernel-shark-qt/src/KsTraceViewer.hpp | 2 ++ 2 files changed, 20 insertions(+) diff --git a/kernel-shark-qt/src/KsTraceViewer.cpp b/kernel-shark-qt/src/KsTraceViewer.cpp index d64c2af..2418de3 100644 --- a/kernel-shark-qt/src/KsTraceViewer.cpp +++ b/kernel-shark-qt/src/KsTraceViewer.cpp @@ -30,6 +30,23 @@ void KsTableView::mousePressEvent(QMouseEvent *e) { QTableView::mousePressEvent(e); } +/** + * Reimplemented the handler for Auto-scrolling. With this we disable + * the Horizontal Auto-scrolling. + */ +void KsTableView::scrollTo(const QModelIndex &index, ScrollHint hint) +{ + int bottomMargin(2); + + if (hint == QAbstractItemView::EnsureVisible && + index.row() > indexAt(rect().topLeft()).row() && + index.row() < indexAt(rect().bottomLeft()).row() - bottomMargin) + return; + + QTableView::scrollTo(index, hint); +} + + /** Create a default (empty) Trace viewer widget. */ KsTraceViewer::KsTraceViewer(QWidget *parent) : QWidget(parent), @@ -588,6 +605,7 @@ void KsTraceViewer::resizeEvent(QResizeEvent* event) int nColumns = _tableHeader.count(); int tableSize(0), viewSize, freeSpace; + _resizeToContents(); for (int c = 0; c < nColumns; ++c) { tableSize += _view.columnWidth(c); } diff --git a/kernel-shark-qt/src/KsTraceViewer.hpp b/kernel-shark-qt/src/KsTraceViewer.hpp index a89fce1..a8c1fe6 100644 --- a/kernel-shark-qt/src/KsTraceViewer.hpp +++ b/kernel-shark-qt/src/KsTraceViewer.hpp @@ -33,6 +33,8 @@ public: : QTableView(parent) {}; void mousePressEvent(QMouseEvent *event) override; + + void scrollTo(const QModelIndex &index, ScrollHint hint) override; }; /** -- 2.17.1
next prev parent reply index Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-01-09 13:09 [PATCH v2 0/6] Modifications toward KS 1.0 Yordan Karadzhov 2019-01-09 13:09 ` [PATCH v2 1/6] kernel-shark-qt: Rearrange the "Filter" top menu Yordan Karadzhov 2019-01-09 13:09 ` [PATCH v2 2/6] kernel-shark-qt: Cosmetic modifications in KsQuickContextMenu Yordan Karadzhov 2019-01-09 16:33 ` Steven Rostedt 2019-01-09 16:38 ` Yordan Karadzhov 2019-01-09 16:47 ` Steven Rostedt 2019-01-09 13:09 ` Yordan Karadzhov [this message] 2019-01-09 13:09 ` [PATCH v2 4/6] kernel-shark-qt: Do not auto-scrolling when the marker switches Yordan Karadzhov 2019-01-09 13:09 ` [PATCH v2 5/6] kernel-shark-qt: Add the CPU filters to the filter clearing method Yordan Karadzhov 2019-01-09 13:09 ` [PATCH v2 6/6] kernel-shark-qt: Fix bug in plugin actions execution Yordan Karadzhov 2019-01-09 16:52 ` Steven Rostedt 2019-03-15 0:01 ` Steven Rostedt 2019-03-15 0:05 ` Steven Rostedt 2019-03-15 6:20 ` Yordan Karadzhov
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=20190109130945.28519-4-ykaradzhov@vmware.com \ --to=ykaradzhov@vmware.com \ --cc=linux-trace-devel@vger.kernel.org \ --cc=rostedt@goodmis.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