Skip to content

Commit

Permalink
Added button to expand or collapse all tree items
Browse files Browse the repository at this point in the history
  • Loading branch information
joern274 committed Nov 20, 2023
1 parent 0619ed8 commit 83371d7
Show file tree
Hide file tree
Showing 10 changed files with 316 additions and 99 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file.
* refactored module widget
* added option to show gate content for each module
* added option to show interior nets for each module
* added button to expand or collapse all tree items
* added delete module action and shortcut
* added entries for context menu
* refactored search bar
Expand Down
13 changes: 13 additions & 0 deletions plugins/gui/include/gui/module_widget/module_tree_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ namespace hal
class ModuleTreeView : public QTreeView
{
Q_OBJECT

bool mToggleStateExpanded;

public Q_SLOTS:
void expandAllModules();

void collapseAllModules();

public:
/**
* Constructor.
Expand All @@ -61,5 +69,10 @@ namespace hal
* Sets the default width of each column. MUST be called after setting the model.
*/
void setDefaultColumnWidth();

/**
* Returns whether last toggle action was 'expand all' or 'collapse all'
*/
bool toggleStateExpanded() const;
};
} // namespace hal
50 changes: 29 additions & 21 deletions plugins/gui/include/gui/module_widget/module_widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,18 @@ namespace hal
{
Q_OBJECT
Q_PROPERTY(QString disabledIconStyle READ disabledIconStyle WRITE setDisabledIconStyle)
Q_PROPERTY(QString activeIconStyle READ activeIconStyle WRITE setActiveIconStyle)
Q_PROPERTY(QString showNetsIconPath READ showNetsIconPath WRITE setShowNetsIconPath)
Q_PROPERTY(QString showNetsIconStyle READ showNetsIconStyle WRITE setShowNetsIconStyle)
Q_PROPERTY(QString hideNetsIconPath READ hideNetsIconPath WRITE setHideNetsIconPath)
Q_PROPERTY(QString hideNetsIconStyle READ hideNetsIconStyle WRITE setHideNetsIconStyle)
Q_PROPERTY(QString showGatesIconPath READ showGatesIconPath WRITE setShowGatesIconPath)
Q_PROPERTY(QString showGatesIconStyle READ showGatesIconStyle WRITE setShowGatesIconStyle)
Q_PROPERTY(QString hideGatesIconPath READ hideGatesIconPath WRITE setHideGatesIconPath)
Q_PROPERTY(QString hideGatesIconStyle READ hideGatesIconStyle WRITE setHideGatesIconStyle)
Q_PROPERTY(QString searchIconPath READ searchIconPath WRITE setSearchIconPath)
Q_PROPERTY(QString searchIconStyle READ searchIconStyle WRITE setSearchIconStyle)
Q_PROPERTY(QString searchActiveIconStyle READ searchActiveIconStyle WRITE setSearchActiveIconStyle)
Q_PROPERTY(QString renameIconPath READ renameIconPath WRITE setRenameIconPath)
Q_PROPERTY(QString deleteIconPath READ deleteIconPath WRITE setDeleteIconPath)
Q_PROPERTY(QString deleteIconStyle READ deleteIconStyle WRITE setDeleteIconStyle)
Q_PROPERTY(QString expandedIconPath READ expandedIconPath WRITE setExpandedIconPath)
Q_PROPERTY(QString collapsedIconPath READ collapsedIconPath WRITE setCollapsedIconPath)

public:
/**
Expand Down Expand Up @@ -114,38 +113,37 @@ namespace hal
*/
///@{
QString disabledIconStyle() const;
QString activeIconStyle() const;
QString showNetsIconPath() const;
QString showNetsIconStyle() const;
QString hideNetsIconPath() const;
QString hideNetsIconStyle() const;
QString showGatesIconPath() const;
QString showGatesIconStyle() const;
QString hideGatesIconPath() const;
QString hideGatesIconStyle() const;
QString searchIconPath() const;
QString searchIconStyle() const;
QString searchActiveIconStyle() const;
QString deleteIconPath() const;
QString deleteIconStyle() const;
QString renameIconPath() const;
QString expandedIconPath() const;
QString collapsedIconPath() const;

///@}

/** @name Q_PROPERTY WRITE Functions
*/
///@{
void setDisabledIconStyle(const QString& style);
void setActiveIconStyle(const QString& style);
void setShowNetsIconPath(const QString &path);
void setShowNetsIconStyle(const QString &path);
void setHideNetsIconPath(const QString &path);
void setHideNetsIconStyle(const QString &path);
void setShowGatesIconPath(const QString &path);
void setShowGatesIconStyle(const QString &path);
void setHideGatesIconPath(const QString &path);
void setHideGatesIconStyle(const QString &path);
void setSearchIconPath(const QString &path);
void setSearchIconStyle(const QString &style);
void setSearchActiveIconStyle(const QString &style);
void setDeleteIconPath(const QString& path);
void setDeleteIconStyle(const QString& style);
void setRenameIconPath(const QString& path);
void setExpandedIconPath(const QString& path);
void setCollapsedIconPath(const QString& path);
///@}

public Q_SLOTS:
Expand Down Expand Up @@ -223,6 +221,15 @@ namespace hal
*/
void handleToggleGatesClicked();

/**
* Q_SLOT to toggle whether the tree is entirely expanded or collapsed
*/
void handleToggleExpandTreeClicked();

/**
* Q_SLOT to handle rename button
*/
void handleRenameClicked();

private Q_SLOTS:
void handleDeleteShortcutOnFocusChanged(QWidget *oldWidget, QWidget *newWidget);
Expand All @@ -235,24 +242,25 @@ namespace hal

QAction* mToggleNetsAction;
QAction* mToggleGatesAction;
QAction* mRenameAction;
QAction* mDeleteAction;
QAction* mToggleExpandTreeAction;

QString mDisabledIconStyle;
QString mActiveIconStyle;

QString mShowNetsIconPath;
QString mShowNetsIconStyle;
QString mHideNetsIconPath;
QString mHideNetsIconStyle;

QString mShowGatesIconPath;
QString mShowGatesIconStyle;
QString mHideGatesIconPath;
QString mHideGatesIconStyle;
QString mDeleteIconPath;
QString mDeleteIconStyle;

QString mSearchIconPath;
QString mSearchIconStyle;
QString mSearchActiveIconStyle;
QString mRenameIconPath;
QString mExpandedIconPath;
QString mCollapsedIconPath;

QAction* mFilterAction;

Expand Down
2 changes: 2 additions & 0 deletions plugins/gui/resources/gui_resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@
<file alias="insert-plugin">icons/0501-insert-plugin.svg</file>
<file alias="cli-options">icons/0502-cli-options.svg</file>
<file alias="invoke-gui">icons/0503-invoke-gui.svg</file>
<file alias="tree-collapsed">icons/tree-collapsed.svg</file>
<file alias="tree-expanded">icons/tree-expanded.svg</file>
</qresource>
<qresource prefix="/images">
<file alias="spinner">images/oval.svg</file>
Expand Down
67 changes: 67 additions & 0 deletions plugins/gui/resources/icons/tree-collapsed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
90 changes: 90 additions & 0 deletions plugins/gui/resources/icons/tree-expanded.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 8 additions & 11 deletions plugins/gui/resources/stylesheet/dark.qss
Original file line number Diff line number Diff line change
Expand Up @@ -1197,25 +1197,22 @@ hal--Toolbar QPushButton:checked:hover {
}

hal--ModuleWidget {
qproperty-showNetsIconStyle: "all->#e8e8e8";
qproperty-showNetsIconPath: ":/icons/ne_net";
qproperty-disabledIconStyle: "all->#515050";
qproperty-activeIconStyle: "all->#e8e8e8";

qproperty-hideNetsIconStyle: "all->#e8e8e8";
qproperty-showNetsIconPath: ":/icons/ne_net";
qproperty-hideNetsIconPath: ":/icons/ne_no_net";

qproperty-showGatesIconStyle: "all->#e8e8e8";
qproperty-showGatesIconPath: ":/icons/ne_gate";

qproperty-hideGatesIconStyle: "all->#e8e8e8";
qproperty-hideGatesIconPath: ":/icons/ne_no_gate";

qproperty-deleteIconStyle: "all->#e8e8e8";
qproperty-deleteIconPath: ":/icons/trashcan";
qproperty-disabledIconStyle: "all->#515050";

qproperty-searchActiveIconStyle: "all->#30ac4f";
qproperty-searchIconStyle: "all->#e8e8e8";
qproperty-searchIconPath: ":/icons/search";

qproperty-renameIconPath: ":/icons/pen";
qproperty-deleteIconPath: ":/icons/trashcan";
qproperty-expandedIconPath: ":/icons/tree-expanded";
qproperty-collapsedIconPath: ":/icons/tree-collapsed";
}

hal--MainWindow
Expand Down
19 changes: 8 additions & 11 deletions plugins/gui/resources/stylesheet/light.qss
Original file line number Diff line number Diff line change
Expand Up @@ -1221,25 +1221,22 @@ hal--Toolbar QPushButton:checked:hover {
}

hal--ModuleWidget {
qproperty-showNetsIconStyle: "all->#FFFFFF";
qproperty-showNetsIconPath: ":/icons/ne_net";
qproperty-disabledIconStyle: "all->#515050";
qproperty-activeIconStyle: "all->#FFFFFF";

qproperty-hideNetsIconStyle: "all->#FFFFFF";
qproperty-showNetsIconPath: ":/icons/ne_net";
qproperty-hideNetsIconPath: ":/icons/ne_no_net";

qproperty-showGatesIconStyle: "all->#FFFFFF";
qproperty-showGatesIconPath: ":/icons/ne_gate";

qproperty-hideGatesIconStyle: "all->#FFFFFF";
qproperty-hideGatesIconPath: ":/icons/ne_no_gate";

qproperty-deleteIconStyle: "all->#FFFFFF";
qproperty-deleteIconPath: ":/icons/trashcan";
qproperty-disabledIconStyle: "all->#515050";

qproperty-searchActiveIconStyle: "all->#30ac4f";
qproperty-searchIconStyle: "all->#FFFFFF";
qproperty-searchIconPath: ":/icons/search";

qproperty-renameIconPath: ":/icons/pen";
qproperty-deleteIconPath: ":/icons/trashcan";
qproperty-expandedIconPath: ":/icons/tree-expanded";
qproperty-collapsedIconPath: ":/icons/tree-collapsed";
}

hal--MainWindow
Expand Down
Loading

0 comments on commit 83371d7

Please sign in to comment.