Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken flamegraph #683

Merged
merged 4 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ repos:
args: [--allow-multiple-documents]
- id: check-json
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v17.0.6
rev: v18.1.8
hooks:
- id: clang-format
files: (\.cpp|\.h|\.c)
Expand Down
8 changes: 2 additions & 6 deletions src/flamegraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,8 @@ FlameGraph::FlameGraph(QWidget* parent, Qt::WindowFlags flags)

connect(Settings::instance(), &Settings::collapseDepthChanged, this, updateHelper);

m_scene->setBackgroundBrush(QBrush());

m_scene->setItemIndexMethod(QGraphicsScene::NoIndex);
m_view->setScene(m_scene);
m_view->viewport()->installEventFilter(this);
Expand Down Expand Up @@ -1189,12 +1191,6 @@ void FlameGraph::selectItem(FrameGraphicsItem* item)
// then layout all items below the selected on
layoutItems(item);

#if QT_VERSION <= QT_VERSION_CHECK(5, 15, 12) && QT_VERSION > QT_VERSION_CHECK(5, 15, 10)
// the scene background doesn't get cleared correctly when using qt 5.15.12
// this doesn't happen in 5.15.10 and 5.15.13
m_scene->setBackgroundBrush(QBrush());
#endif

// Triggers a refresh of the scene's bounding rect without going via the
// event loop. This makes the centerOn call below work as expected in all cases.
m_scene->sceneRect();
Expand Down
2 changes: 1 addition & 1 deletion src/models/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ add_library(
models STATIC
../settings.cpp
../util.cpp
byfilemodel.cpp
callercalleemodel.cpp
callercalleeproxy.cpp
byfilemodel.cpp
codedelegate.cpp
costdelegate.cpp
data.cpp
Expand Down
10 changes: 4 additions & 6 deletions tests/modeltests/tst_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@ private slots:
{
const std::array<int, 0> testArray = {};

QCOMPARE(search(
testArray.cbegin(), testArray.cend(), 0, Direction::Forward, [](int) { return false; }, [] {}),
-1);
QCOMPARE(search(
testArray.cbegin(), testArray.cend(), 0, Direction::Backward, [](int) { return false; }, [] {}),
-1);
QCOMPARE(
search(testArray.cbegin(), testArray.cend(), 0, Direction::Forward, [](int) { return false; }, [] {}), -1);
QCOMPARE(
search(testArray.cbegin(), testArray.cend(), 0, Direction::Backward, [](int) { return false; }, [] {}), -1);
}
void testSearch()
{
Expand Down