Skip to content

Add QtGraphs-based analysis page to AdvancedPy example#39

Open
AndrewSazonov wants to merge 8 commits intodevelopfrom
qtgraphs
Open

Add QtGraphs-based analysis page to AdvancedPy example#39
AndrewSazonov wants to merge 8 commits intodevelopfrom
qtgraphs

Conversation

@AndrewSazonov
Copy link
Member

This PR adds a new Analysis page to the AdvancedPy example and connects it to both mock QML and real Python backends.

Analysis page includes:

  • a QtGraphs chart page for generated analysis data
  • sidebar controls for point count and regenerating data

@AndrewSazonov AndrewSazonov added [scope] enhancement Adds/improves features (major.MINOR.patch) [priority] medium Normal/default priority labels Mar 23, 2026
@AndrewSazonov AndrewSazonov marked this pull request as ready for review March 24, 2026 15:35
@AndrewSazonov AndrewSazonov requested a review from rozyczko March 25, 2026 08:02
Copy link
Member

@rozyczko rozyczko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor issues found. Please consider before merging.


QtObject {

property int dataSize: 50
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the default dataSize in corresponding analysis.py is set to 10000. Why the difference?

Comment on lines +56 to +60
//visible: true
//gridVisible: false
//subGridVisible: true
//labelsVisible: true
//subTickCount: 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of commented-out code in this file. Please either comment on why it needs to stay or remove.

Comment on lines +62 to +63
labelDelegate: TextEdit {
horizontalAlignment: TextInput.AlignHCenter
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this supposed to be TextEdit? Are you expected to be able to edit axis labels?
I think you meant labelDelegate: Text

Comment on lines +95 to +97
mvx = memoryview(x)
mvy = memoryview(y)
return [QPointF(xi, yi) for xi, yi in zip(mvx, mvy)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

memoryview avoids copying indeed, but when you later iterate over it with zip, each element is still converted from the memoryview into a Python float object before being passed to QPointF.
You're still doing float conversion...

>>> a = np.array([1.0, 2.0])
>>> for x in memoryview(a):
...     print(type(x))
<class 'float'>
<class 'float'>

Comment on lines +67 to +68
x, y = self._generate_data(n_points=self.dataSize)
console.debug(" Data generation completed.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No exception handling on results from _generate_data, which might throw.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[priority] medium Normal/default priority [scope] enhancement Adds/improves features (major.MINOR.patch)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants