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

Cura 11003 add searchbar for offlineprinter #18804

Merged
merged 20 commits into from
Apr 17, 2024

Conversation

saumyaj3
Copy link
Contributor

@saumyaj3 saumyaj3 commented Apr 3, 2024

Description

Add Searchbar to the "Add An Offline Printer" list
search

saumyaj3 and others added 3 commits April 3, 2024 12:32
Added a search field in the 'Add Local Printer' section which allows users to search for their desired printer. A timer has been set to trigger the search function as the user types into the search field. A clear button is visible for easy removal of the search text. Adjusted the ListModel.py to correctly emit dataChanged signal when there are changes in the list.

CURA-11003
@saumyaj3 saumyaj3 marked this pull request as draft April 3, 2024 13:40
The commit simplifies the function for updating current items in the AddLocalPrinterScrollView.qml file. It also removes unnecessary properties and functions, streamlining the process for setting printer info. The changes improve code readability and efficiency

CURA-11003
@saumyaj3 saumyaj3 marked this pull request as ready for review April 3, 2024 14:25
Copy link
Contributor

@wawanbreton wawanbreton left a comment

Choose a reason for hiding this comment

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

Just some minor remarks and questions.

I also wanted to point out that Qt has a QSortFilterProxyModel class that is designed to handle this use case. You don't have to change the data in the model, but just apply the filter on the view. This is a bit faster and also makes it much easier to keep the selection and hide empty sections. I have a real-life example here if you are interested (in C++ though)

resources/qml/WelcomePages/AddLocalPrinterScrollView.qml Outdated Show resolved Hide resolved
resources/qml/WelcomePages/AddLocalPrinterScrollView.qml Outdated Show resolved Hide resolved
resources/qml/WelcomePages/AddLocalPrinterScrollView.qml Outdated Show resolved Hide resolved
@saumyaj3
Copy link
Contributor Author

saumyaj3 commented Apr 4, 2024

Just some minor remarks and questions.

I also wanted to point out that Qt has a QSortFilterProxyModel class that is designed to handle this use case. You don't have to change the data in the model, but just apply the filter on the view. This is a bit faster and also makes it much easier to keep the selection and hide empty sections. I have a real-life example here if you are interested (in C++ though)

This indeed looks like a good way to filter out the messages. I just used the functionality already present in the MachineModel for filtering out the machines. I also need another filter, visible:true else whole bunch of other random things shows up in the list.

saumyaj3 and others added 5 commits April 8, 2024 14:08
This commit addresses an issue wherein undefined current items were not properly handled in the AddLocalPrinterScrollView module. We've changed the code so that it now checks if currentItem and currentItem.name exist before attempting to assign. If they don't exist, we now set default values to avoid null or undefined references. This prevents potential errors or inconsistent behaviors in the UI.

CURA-11003
@saumyaj3 saumyaj3 requested a review from nallath April 12, 2024 10:35
@HellAholic HellAholic merged commit 549d107 into main Apr 17, 2024
9 checks passed
@HellAholic HellAholic deleted the CURA-11003-add-searchbar-for-offlineprinter branch April 17, 2024 13:27
@johnsmith491
Copy link

has anyone tried this method? and how it is performing?

@saumyaj3
Copy link
Contributor Author

solves #16716. This feature will be available in the next version of cura.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants