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

Add search bar to OSCollapsibleItemList #618

Merged
merged 3 commits into from
Aug 21, 2023
Merged

Add search bar to OSCollapsibleItemList #618

merged 3 commits into from
Aug 21, 2023

Conversation

macumber
Copy link
Collaborator

@macumber macumber commented Aug 9, 2023

Adds a search bar to OSCollapsibleItemList used for most of the library tabs. OSListView which is used by the ScriptsTab is considerably different, so I did not add a search feature there for now.

@macumber macumber requested a review from jmarrec August 9, 2023 02:32
Copy link
Collaborator

@jmarrec jmarrec 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 nitpicks. Otherwise this is great.

Also, I think these would be good improvements, either for here directly or filed as tickets for later.

  • some kind of button to clear the text in the search bar would be helpful.
  • Hiding the collapsible sections that didn't match at all would be make it clearer

protected:
void paintEvent(QPaintEvent* event) override;

private:
QVBoxLayout* m_vLayout;
QLineEdit* m_searchBox;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I was trying to see if this shouldn't be on the base class "OSItemSelector" and realize we have an unused class ModelObjectTreeWidget.

The other class that inherits it is OSItemList. Should that one had a search bar? Not sure what it does to be honest.

Comment on lines 238 to 239
QLayoutItem* layoutItem = nullptr;
OSCollapsibleItem* collapsibleItem = nullptr;
Copy link
Collaborator

Choose a reason for hiding this comment

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

These two at least can be defined and initialized in the outer for loop no?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done!

@jmarrec
Copy link
Collaborator

jmarrec commented Aug 16, 2023

@macumber This is great! here's a Peek capture.

618_Search

@macumber
Copy link
Collaborator Author

I skipped adding the search bar to OSItem because that is used to display all objects of a single type. There are two instances of OSItem. One is under each OSCollapsibleItemHeader in an OSCollapsibleItemList (box on the right) so a second search bar would be redundant. The other is in the ModelObjectListView used on tabs that don't have a grid view (box on the left). We could configure that search for the case on the left but I don't think it's as useful there.

image

Another place OSCollapsibleItemList is used is the load definition tab, not sure if we'd want to disable the search bar here for consistency with ModelObjectListView?

image

Finally, the other place a search bar might be useful would be on the OSGridView.

Copy link
Collaborator

@jmarrec jmarrec left a comment

Choose a reason for hiding this comment

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

Love the adjustments, thanks @macumber this is going to be very exciting for users! Here's a Peek, v2:

618_Search_v2

@@ -62,6 +62,7 @@ OSCollapsibleItemList::OSCollapsibleItemList(bool addScrollArea, QWidget* parent
this->setLayout(outerVLayout);

m_searchBox = new QLineEdit();
m_searchBox->setClearButtonEnabled(true);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Lol, that icon is a broom?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hehe, weird on Windows it is a nice x button.

@jmarrec jmarrec merged commit 5f2df36 into develop Aug 21, 2023
@jmarrec jmarrec deleted the search_bar branch August 21, 2023 09:50
@github-actions github-actions bot locked and limited conversation to collaborators Aug 21, 2023
@jmarrec jmarrec added this to the OpenStudio Application 1.7.0 milestone Aug 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Search Function Request for User Interface in "My Model" tab and "Library" tab especially for HVAC tab
2 participants