refactor headers

This commit is contained in:
Alfredo Monclus
2025-02-16 10:08:26 -03:00
parent 9ed3c90303
commit 6e5982e2be
7 changed files with 347 additions and 379 deletions

View File

@@ -16,149 +16,13 @@
namespace QSint
{
/**
\brief Class representing a panel of actions similar to Windows Vista/7 control panel items.
\since 0.2
\image html ActionBox.png An example of ActionBox
ActionBox normally consists of an icon, clickable header and a list of actions.
Every action can have own icon as well, provide tooltips and status tips,
be clickable and checkable etc. i.e. behave like a normal ActionLabel.
ActionBox objects are easily customizable via CSS technology - you can get
different look just by writing corresponding style sheet.
<b>Usage of ActionBox in the application</b>
1. Create ActionBox using constructor (or in Designer as Promoted Objects).
Icon and header text can be passed to the constructor as well. For example:
\code
ActionBox *box1 = new ActionBox(":/icons/box1icon.png", "Header Text", this);
\endcode
2. ActionBox header itself is a clickable item (based on ActionLabel), so you
can retrieve it and use, for example, to connect with a slot:
\code
connect(box1->header(), SIGNAL(clicked()), this, SLOT(header1clicked()));
\endcode
3. To create an action, use one of createItem() functions. For example:
\code
ActionLabel *action1 = box1->createItem(":/icons/action1icon.png", "Action1 Text");
connect(action1, SIGNAL(clicked()), this, SLOT(action1clicked()));
ActionLabel *action2 = box1->createItem(":/icons/action2icon.png", "Action2 Text");
connect(action2, SIGNAL(clicked()), this, SLOT(action2clicked()));
\endcode
createItem() also allows one to create an ActionLabel from already existing QAction:
\code
QAction myAction3(":/icons/action3icon.png", "Action3 Text");
connect(myAction3, SIGNAL(clicked()), this, SLOT(action3clicked()));
ActionLabel *action3 = box1->createItem(myAction3);
\endcode
4. By default, actions are arranged vertically, one per row. In order
to have more than one actions in a row, first add horizontal layout item
using createHBoxLayout() function, and then pass it to the createItem() to
create actions.
\code
// create horizontal layout
QLayout *hbl1 = box1->createHBoxLayout();
// create actions using this layout
ActionLabel *action3 = box1->createItem(":/icons/action3icon.png", "1st action in row", hbl1);
ActionLabel *action4 = box1->createItem("2nd action in row", hbl1);
\endcode
5. Sometimes you would like to have a spacer between the items. Use createSpacer()
function to insert an empty space into default or specified layout.
\code
// create a spacer after two actions added before
box1->createSpacer(hbl1);
// create another action which will be preceded by the empty space (i.e. right-aligned)
ActionLabel *action5 = box1->createItem("3rd action in row", hbl1);
\endcode
6. You can insert arbitrary layout items and widgets into ActionBox using
addLayout() and addWidgets() functions. Please note that ownership of these items
transferred to ActionBox, so you must not delete them manually.
<b>Customization of ActionBox via CSS</b>
ActionBox items can be easily customized using CSS mechanism. Just create a new
style and apply it to the ActionBox with setStyleSheet().
See the following example of the complete ActionBox customization. Note that
\a QSint--ActionBox is used as a main class name. Headers are ActionLabels with
property \a class='header'. Actions are ActionLabels with
property \a class='action'.
\code
// define a string representing CSS style
const char* ActionBoxNewStyle =
// customization of ActionBox
"QSint--ActionBox {"
"background-color: white;"
"border: 1px solid white;"
"border-radius: 3px;"
"text-align: left;"
"}"
"QSint--ActionBox:hover {"
"background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #F9FDFF, stop: 1 #EAF7FF);"
"border: 1px solid #DAF2FC;"
"}"
// customization of ActionBox's header
"QSint--ActionBox QSint--ActionLabel[class='header'] {"
"text-align: left;"
"font: 14px;"
"color: #006600;"
"background-color: transparent;"
"border: none;"
"}"
"QSint--ActionBox QSint--ActionLabel[class='header']:hover {"
"color: #00cc00;"
"text-decoration: underline;"
"}"
// customization of ActionBox's actions
"QSint--ActionBox QSint--ActionLabel[class='action'] {"
"background-color: transparent;"
"border: none;"
"color: #0033ff;"
"text-align: left;"
"font: 11px;"
"}"
"QSint--ActionBox QSint--ActionLabel[class='action']:hover {"
"color: #0099ff;"
"text-decoration: underline;"
"}"
"QSint--ActionBox QSint--ActionLabel[class='action']:on {"
"background-color: #ddeeff;"
"color: #006600;"
"}"
;
// apply the style
box1->setStyleSheet(ActionBoxNewStyle);
\endcode
*/
* @brief A panel of actions, similar to Windows Vista/7 control panel items.
*
* An ActionBox displays an icon, a clickable header, and a list of actions.
* Actions can have icons, tooltips, status tips, and support click/check functionality
* (similar to ActionLabel). Customizable via CSS.
*/
class QSINT_EXPORT ActionBox : public QFrame
{
Q_OBJECT
@@ -167,93 +31,129 @@ class QSINT_EXPORT ActionBox : public QFrame
Q_PROPERTY(ActionLabel header READ header) // clazy:exclude=qproperty-without-notify
public:
/** Constructor.
*/
/**
* @brief Constructs an ActionBox.
* @param parent The parent widget.
*/
explicit ActionBox(QWidget *parent = nullptr);
/** Constructor.
*/
/**
* @brief Constructs an ActionBox with a header text.
* @param headerText The header text.
* @param parent The parent widget.
*/
ActionBox(const QString & headerText, QWidget *parent = nullptr);
/** Constructor.
*/
/**
* @brief Constructs an ActionBox with an icon and header text.
* @param icon The icon.
* @param headerText The header text.
* @param parent The parent widget.
*/
explicit ActionBox(const QPixmap & icon, const QString & headerText, QWidget *parent = nullptr);
/** Sets icon of the ActionBox to \a icon.
*/
/**
* @brief Sets the ActionBox icon.
* @param icon The icon.
*/
void setIcon(const QPixmap & icon);
/** Returns icon of the ActionBox.
*/
QPixmap icon() const;// { return iconLabel->pixmap(); }
/** Returns header item of the ActionBox.
*/
/**
* @brief Returns the ActionBox icon.
* @return The icon.
*/
QPixmap icon() const;
/**
* @brief Returns the header label.
* @return The header label.
*/
inline ActionLabel* header() const { return headerLabel; }
/** Creates action item from the \a action and returns it.
By default, action is added to the default vertical layout, i.e. subsequent
calls of this function will create several actions arranged vertically,
one below another.
You can add action to the specified layout passing it as \a l parameter.
This allows one to do custom actions arrangements, i.e. horizontal etc.
\since 0.2
*/
/**
* @brief Creates and adds an action from a QAction.
* @param action The QAction.
* @param l Optional layout to add the action to. Defaults to the
* ActionBox's default vertical layout.
* @return The created ActionLabel.
*/
ActionLabel* createItem(QAction * action, QLayout * l = nullptr);
/** Creates action items from the \a actions list and returns the list of action items.
\since 0.2
*/
/**
* @brief Creates and adds multiple actions from a list of QActions.
* @param actions The list of QActions.
* @return The list of created ActionLabels.
*/
QList<ActionLabel*> createItems(const QList<QAction*> actions);
/** Adds an action with \a text to the ActionBox and returns action item.
*/
/**
* @brief Creates and adds an action with text.
* @param text The action text.
* @param l Optional layout to add the action to.
* @return The created ActionLabel.
*/
ActionLabel* createItem(const QString & text = QString(), QLayout * l = nullptr);
/** Adds an action with \a icon and \a text to the ActionBox and returns action item.
This function acts just like previous one. See the description above.
*/
/**
* @brief Creates and adds an action with an icon and text.
* @param icon The action icon.
* @param text The action text.
* @param l Optional layout to add the action to.
* @return The created ActionLabel.
*/
ActionLabel* createItem(const QPixmap & icon, const QString & text, QLayout * l = nullptr);
/** Adds a spacer and returns spacer item.
By default, a spacer is added to the default vertical layout.
You can add a spacer to the specified layout passing it as \a l parameter.
*/
/**
* @brief Creates and adds a spacer.
* @param l Optional layout to add the spacer to. Defaults to the
* ActionBox's default vertical layout.
* @return The created spacer item.
*/
QSpacerItem* createSpacer(QLayout * l = nullptr);
/** Creates empty horizontal layout.
Use this function to arrange action items into a row.
*/
/**
* @brief Creates a horizontal layout.
* @return The created layout.
*/
QLayout* createHBoxLayout();
/** Returns default layout used for actions (typically it's QVBoxLayout).
*/
/**
* @brief Returns the default layout used for actions.
* @return The default layout.
*/
inline QLayout* itemLayout() const { return dataLayout.get(); }
/** Adds layout \a l to the default layout.
*/
/**
* @brief Adds a layout.
* @param l The layout to add.
*/
void addLayout(QLayout * l);
/** Adds widget \a w to the layout.
By default, widget is added to the default vertical layout.
You can add widget to the specified layout passing it as \a l parameter.
*/
/**
* @brief Adds a widget.
* @param w The widget to add.
* @param l Optional layout to add the widget to. Defaults to the
* ActionBox's default vertical layout.
*/
void addWidget(QWidget * w, QLayout * l = nullptr);
/**
* @brief Returns the recommended minimum size.
* @return The minimum size hint.
*/
QSize minimumSizeHint() const override;
protected:
/**
* @brief Initializes the ActionBox.
* @param headerText The initial header text.
*/
void init(const QString &headerText = QString());
std::unique_ptr<QVBoxLayout> dataLayout;
QLabel *iconLabel = nullptr;
ActionLabel *headerLabel = nullptr;
std::unique_ptr<QVBoxLayout> dataLayout; ///< Default layout for actions/widgets.
QLabel *iconLabel = nullptr; ///< Label for the ActionBox icon.
ActionLabel *headerLabel = nullptr; ///< Label for the header.
};
} // namespace
#endif // ACTIONBOX_H

View File

@@ -16,18 +16,15 @@
namespace QSint
{
class ActionLabel;
class ActionPanelScheme;
class TaskHeader;
class TaskGroup;
/**
* @brief A collapsible group widget for organizing actions
*
* ActionGroup consists of an optional header and a collection of actions represented by ActionLabel.
* It can also contain arbitrary widgets.
* @brief A collapsible group widget for organizing actions.
*
* An ActionGroup can have a header and contains actions (ActionLabels) or other widgets.
*/
class QSINT_EXPORT ActionGroup : public QWidget
{
@@ -38,107 +35,158 @@ class QSINT_EXPORT ActionGroup : public QWidget
Q_PROPERTY(QString headerText READ headerText WRITE setHeaderText)
public:
explicit ActionGroup(QWidget *parent = nullptr);
explicit ActionGroup(const QString& title, bool expandable = true, QWidget *parent = nullptr);
explicit ActionGroup(const QPixmap& icon, const QString& title, bool expandable = true, QWidget *parent = nullptr);
~ActionGroup() override;
/**
* @brief Creates an action item from the given `action` and returns it.
*
* If `addToLayout` is `true` (default), the action is added to the default vertical layout, meaning
* subsequent calls will arrange multiple `ActionLabel`s vertically, one below another.
*
* If `addToLayout` is `false`, the action must be added to a layout manually.
* This allows for custom arrangements, such as horizontal layouts.
*
* If `addStretch` is `true` (default),`ActionLabel` will be automatically aligned to the left side.
* if `addStretch` is `false` `ActionLabel` will occupy all available horizontal space.
* @brief Constructs an ActionGroup.
* @param parent The parent widget.
*/
explicit ActionGroup(QWidget *parent = nullptr);
/**
* @brief Constructs an ActionGroup with a title.
* @param title The title of the group's header.
* @param expandable If `true` (default), the group can be expanded/collapsed.
* @param parent The parent widget.
*/
explicit ActionGroup(const QString& title, bool expandable = true, QWidget *parent = nullptr);
/**
* @brief Constructs an ActionGroup with an icon and title.
* @param icon The icon for the group's header.
* @param title The title of the group's header.
* @param expandable If `true` (default), the group can be expanded/collapsed.
* @param parent The parent widget.
*/
explicit ActionGroup(const QPixmap& icon, const QString& title, bool expandable = true, QWidget *parent = nullptr);
/**
* @brief Destroys the ActionGroup.
*/
~ActionGroup() override;
/**
* @brief Creates and adds an action.
* @param action The QAction to add.
* @param addToLayout If `true` (default), adds the action to the group's layout.
* @param addStretch If `true` (default), aligns the ActionLabel to the left.
* @return The newly created ActionLabel.
*/
ActionLabel* addAction(QAction *action, bool addToLayout = true, bool addStretch = true);
/**
* @brief Adds an `ActionLabel` to the group.
* See `addAction()` for parameter details.
* @brief Adds an existing ActionLabel.
* @param label The ActionLabel to add.
* @param addToLayout If `true` (default), adds the label to the group's layout.
* @param addStretch If `true` (default), aligns the ActionLabel to the left.
* @return The added ActionLabel.
*/
ActionLabel* addActionLabel(ActionLabel *label, bool addToLayout = true, bool addStretch = true);
/**
* @brief Adds a `QWidget` to the group. Returns `true` if added successfully.
* See `addAction()` for parameter details.
* @brief Adds a widget to the group.
* @param widget The widget to add.
* @param addToLayout If `true` (default), adds the widget to the group's layout.
* @param addStretch If `true` (default), aligns the widget to the left.
* @return `true` if added successfully.
*/
bool addWidget(QWidget *widget, bool addToLayout = true, bool addStretch = true);
/**
* @brief Returns the group's layout (QVBoxLayout by default).
* @brief Returns the group's layout.
* @return The group's layout (QVBoxLayout by default).
*/
QBoxLayout* groupLayout();
/**
* @brief Checks if the group can collapse or expand.
* @brief Checks if the group is expandable.
* @return `true` if the group is expandable, `false` otherwise.
*/
bool isExpandable() const;
/**
* @brief Makes the group expandable or not.
* @brief Sets whether the group is expandable.
* @param expandable If `true`, the group can be expanded/collapsed.
*/
void setExpandable(bool expandable);
/**
* @brief Checks if the group has a header.
* @return `true` if the group has a header, `false` otherwise.
*/
bool hasHeader() const;
/**
* @brief Enables or disables the group's header.
* @brief Sets whether the group has a header.
* @param enable If `true`, the group will have a header.
*/
void setHeader(bool enable);
/**
* @brief Returns the text of the header.
* @brief Returns the header text.
* @return The header text.
*/
QString headerText() const;
/**
* @brief Sets the text of the header.
* @brief Sets the header text.
* @param text The header text.
*/
void setHeaderText(const QString &text);
/**
* @brief Sets the icon of the header.
* @brief Sets the header icon.
* @param icon The header icon.
*/
void setHeaderIcon(const QPixmap &icon);
/**
* @brief Returns the recommended minimum size for the group.
* @return The minimum size hint.
*/
QSize minimumSizeHint() const override;
enum FoldEffect
{
NoFolding,
ShrunkFolding,
SlideFolding
};
public Q_SLOTS:
/**
* @brief Shows or hides the group's contents.
*/
void showHide();
protected Q_SLOTS:
/**
* @brief Handles hiding the group's contents.
*/
void processHide();
/**
* @brief Handles showing the group's contents.
*/
void processShow();
protected:
/**
* @brief Paints the group.
* @param event The paint event.
*/
void paintEvent(QPaintEvent *event) override;
/**
* @brief Initializes the group.
* @param hasHeader Whether the group has a header.
*/
void init(bool hasHeader);
double m_foldStep = 0;
double m_foldDelta = 0;
double m_fullHeight = 0;
double m_tempHeight = 0;
int m_foldDirection = 0;
double m_foldStep = 0; ///< Current folding animation step.
double m_foldDelta = 0; ///< Change in height per animation step.
double m_fullHeight = 0; ///< Full (expanded) height of the group.
double m_tempHeight = 0; ///< Temporary height during animation.
int m_foldDirection = 0; ///< Direction of folding animation.
QPixmap m_foldPixmap;
QPixmap m_foldPixmap; ///< Pixmap for the fold/unfold icon.
std::unique_ptr<TaskHeader> myHeader;
std::unique_ptr<TaskGroup> myGroup;
std::unique_ptr<QWidget> myDummy;
std::unique_ptr<TaskHeader> myHeader; ///< The group's header.
std::unique_ptr<TaskGroup> myGroup; ///< The container for actions/widgets.
std::unique_ptr<QWidget> myDummy; ///< Dummy widget for animation.
ActionPanelScheme *myScheme = nullptr; ///< The color scheme.
};
} // namespace QSint
#endif // ACTIONGROUP_H

View File

@@ -11,84 +11,58 @@
#include <QToolButton>
#include "qsint_global.h"
namespace QSint
{
/**
\brief Class representing an action similar to Windows Vista/7 control panel item.
\image html ActionLabel.png An example of ActionLabel
ActionLabel normally consists of an icon and text.
It also can have tooltip and status tip,
be clickable and checkable etc. i.e. behave like a normal QToolButton.
<b>Customization of ActionLabel via CSS</b>
ActionLabel objects are easily customizable via CSS technology - you can get
different look just by writing corresponding style sheet and applying it with setStyleSheet().
See the following example of the complete ActionLabel customization. Note that
\a QSint--ActionLabel is used as a main class name.
\code
// define a string representing CSS style
const char* ActionLabelNewStyle =
"QSint--ActionLabel[class='action'] {"
"background-color: transparent;"
"border: 1px solid transparent;"
"color: #0033ff;"
"text-align: left;"
"font: 11px;"
"}"
"QSint--ActionLabel[class='action']:hover {"
"color: #0099ff;"
"text-decoration: underline;"
"}"
"QSint--ActionLabel[class='action']:focus {"
"border: 1px dotted black;"
"}"
"QSint--ActionLabel[class='action']:on {"
"background-color: #ddeeff;"
"color: #006600;"
"}"
;
// apply the style
label1->setStyleSheet(ActionLabelNewStyle);
\endcode
*/
* @brief Represents an action, similar to a Windows Vista/7 control panel item.
*
* An ActionLabel typically displays an icon and text. It supports tooltips, status tips,
* clickability, checkability, and other features similar to a QToolButton.
*
* Customization via CSS: The class name `QSint--ActionLabel` is used.
*/
class QSINT_EXPORT ActionLabel : public QToolButton
{
Q_OBJECT
public:
/** Constructor.
*/
/**
* @brief Constructs an ActionLabel.
* @param parent The parent widget.
*/
explicit ActionLabel(QWidget *parent = nullptr);
/** Constructor. Creates ActionLabel from the \a action.
\since 0.2
*/
/**
* @brief Constructs an ActionLabel from a QAction.
* @param action The QAction to represent.
* @param parent The parent widget.
*/
explicit ActionLabel(QAction *action, QWidget *parent = nullptr);
/**
* @brief Destroys the ActionLabel.
*/
~ActionLabel() override = default;
/**
* @brief Returns the recommended size for the label.
* @return The size hint.
*/
QSize sizeHint() const override;
/**
* @brief Returns the minimum size the label can be.
* @return The minimum size hint.
*/
QSize minimumSizeHint() const override;
protected:
/**
* @brief Initializes the ActionLabel.
*/
void init();
};
} // namespace
#endif // ACTIONLABEL_H

View File

@@ -15,90 +15,94 @@
namespace QSint
{
class ActionPanelScheme;
class ActionGroup;
/**
\brief Class representing panels of actions similar to Windows XP task panels.
\since 0.2
\image html ActionPanel1.png An example of ActionPanel
ActionPanel acts like a container for ActionGroup which in turn are containers for
the actions represented by ActionLabel.
The look and fill is complete styleable via setScheme().
Currently the following schemes available: ActionPanelScheme (the default),
WinXPPanelScheme and WinXPPanelScheme2 (blue Windows XP schemes),
WinVistaPanelScheme (Windows Vista variation), MacPanelScheme (MacOS variation),
AndroidPanelScheme (Android variation).
*/
* @brief Provides a panel of actions, similar to Windows XP task panels.
*
* An ActionPanel contains ActionGroups, which in turn contain actions (represented by ActionLabels).
*/
class QSINT_EXPORT ActionPanel : public QFrame
{
typedef QFrame BaseClass;
using BaseClass = QFrame;
Q_OBJECT
public:
/** Constructor.
*/
/**
* @brief Constructs an ActionPanel.
* @param parent The parent widget.
*/
explicit ActionPanel(QWidget *parent = nullptr);
/** Adds a widget \a w to the ActionPanel's vertical layout.
*/
/**
* @brief Adds a widget to the ActionPanel.
* @param w The widget to add.
*/
void addWidget(QWidget *w);
/** Removes the widget \a w from the ActionPanel's vertical layout.
*/
/**
* @brief Removes a widget from the ActionPanel.
* @param w The widget to remove.
*/
void removeWidget(QWidget *w);
/** Adds a spacer with width \a s to the ActionPanel's vertical layout.
Normally you should do this after all the ActionGroups were added, in order to
maintain some space below.
*/
/**
* @brief Adds a spacer to bottom of the ActionPanel.
* @param s The width of the spacer..
*/
void addStretch(int s = 0);
/** Removes the spacer -- if added -- from the ActionPanel's vertical layout.
*/
/**
* @brief Removes the spacer from the ActionPanel (if one was added).
*/
void removeStretch();
/** Creates and adds to the ActionPanel's vertical layout an empty ActionGroup without header.
*/
/**
* @brief Creates and adds an empty ActionGroup (without a header) to the panel.
* @return The newly created ActionGroup.
*/
ActionGroup* createGroup();
/** Creates and adds to the ActionPanel's vertical layout an empty ActionGroup with header's
text set to \a title, but with no icon.
If \a expandable set to \a true (default), the group can be expanded/collapsed by the user.
*/
/**
* @brief Creates and adds an ActionGroup (with a header) to the panel.
* @param title The title of the group's header.
* @param expandable If `true` (default), the group can be expanded/collapsed.
* @return The newly created ActionGroup.
*/
ActionGroup* createGroup(const QString &title, bool expandable = true);
/** Creates and adds to the ActionPanel's vertical layout an empty ActionGroup with header's
text set to \a title and icon set to \a icon.
If \a expandable set to \a true (default), the group can be expanded/collapsed by the user.
*/
/**
* @brief Creates and adds an ActionGroup (with a header) to the panel.
* @param icon The icon for the group's header.
* @param title The title of the group's header.
* @param expandable If `true` (default), the group can be expanded/collapsed.
* @return The newly created ActionGroup.
*/
ActionGroup* createGroup(const QPixmap &icon, const QString &title, bool expandable = true);
/** Sets the scheme of the panel and all the child groups to \a scheme.
By default, ActionPanelScheme::defaultScheme() is used.
*/
/**
* @brief Sets the color scheme for the panel and its child groups.
* @param scheme The new scheme to use. Defaults to `ActionPanelScheme::defaultScheme()`
* if not set.
*/
void setScheme(ActionPanelScheme *scheme);
/**
* @brief Returns the recommended minimum size for the panel.
* @return The minimum size hint.
*/
QSize minimumSizeHint() const override;
protected:
//virtual void paintEvent ( QPaintEvent * event );
/** @brief The color scheme used by the panel. */
ActionPanelScheme *myScheme;
/** @brief The spacer used for bottom spacing. */
QSpacerItem *mySpacer;
};
} // namespace
#endif // ACTIONPANEL_H

View File

@@ -18,59 +18,97 @@
#include <QHash>
#include <QSize>
#include <QString>
#include <QStyle>
#include <QFontMetrics>
namespace QSint
{
/**
* #@brief Class representing color scheme for ActionPanel and ActionGroup.
* @brief Provides a color scheme and layout parameters for ActionPanel and ActionGroup widgets.
*
* ActionPanels group related actions, and ActionGroups organize actions within a panel.
* This class defines the visual appearance and behavior (e.g., folding animation) of these components.
*/
class QSINT_EXPORT ActionPanelScheme
{
public:
/**
* @brief Animation effect during expanding/collapsing of the ActionGroup's contents.
* @brief Animation effect used when expanding or collapsing an ActionGroup's contents.
*/
enum FoldEffect
{
NoFolding,
ShrunkFolding,
SlideFolding
NoFolding, ///< No folding animation.
ShrunkFolding, ///< Contents shrink to a point during folding.
SlideFolding ///< Contents slide in and out during folding.
};
/**
* @brief Constructs a default ActionPanelScheme.
*/
ActionPanelScheme();
/** Returns a pointer to the default scheme object.
* Must be reimplemented in derived classes for custom schemes.
/**
* @brief Returns a pointer to the default ActionPanelScheme object.
* Derived classes can override this to provide a custom default scheme.
* @return A pointer to the default ActionPanelScheme.
*/
static ActionPanelScheme* defaultScheme();
/// Height of the header in pixels.
/**
* @brief Height of the header area in pixels.
*/
int headerSize;
/// If set to \a true, moving mouse over the header results in changing its opacity slowly.
/**
* @brief Whether mouseover on the header triggers a slow opacity change.
*/
bool headerAnimation;
/// Image of folding button when the group is expanded.
/**
* @brief Image of the folding button when the group is expanded.
*/
QPixmap headerButtonFold;
/// Image of folding button when the group is expanded and mouse cursor is over the button.
/**
* @brief Image of the folding button when the group is expanded and the mouse is over it.
*/
QPixmap headerButtonFoldOver;
/// Image of folding button when the group is collapsed.
/**
* @brief Image of the folding button when the group is collapsed.
*/
QPixmap headerButtonUnfold;
/// Image of folding button when the group is collapsed and mouse cursor is over the button.
/**
* @brief Image of the folding button when the group is collapsed and the mouse is over it.
*/
QPixmap headerButtonUnfoldOver;
/**
* @brief Size of the header button.
*/
QSize headerButtonSize;
/// Number of steps made for expanding/collapsing animation (default 20).
/**
* @brief Number of steps in the expanding/collapsing animation (default: 20).
*/
int groupFoldSteps;
/// Delay in ms between steps made for expanding/collapsing animation (default 15).
/**
* @brief Delay in milliseconds between animation steps (default: 15).
*/
int groupFoldDelay;
/// Sets folding effect during expanding/collapsing.
/**
* @brief Folding effect used during expanding/collapsing.
*/
FoldEffect groupFoldEffect;
/// If set to \a true, changes group's opacity slowly during expanding/collapsing.
/**
* @brief Whether the group's opacity changes slowly during folding.
*/
bool groupFoldThaw;
/// The CSS for the ActionPanel/ActionGroup elements.
/**
* @brief CSS style for ActionPanel/ActionGroup elements.
*/
QString actionStyle;
/**
@@ -83,27 +121,32 @@ public:
*/
void restoreActionStyle();
/**
* @brief Minimal CSS style.
*/
static const QString minimumStyle;
/**
* @brief Generates a custom system style based on the palette.
* @param p The palette to use for generating the style.
* @return A QString containing the generated style.
* @return The generated style.
*/
QString systemStyle(const QPalette& p);
protected:
/**
* @brief Draws a fold/unfold icon based on the palette.
* @brief Draws a fold/unfold icon.
* @param p The palette to use for coloring the icon.
* @param fold True for fold icon, false for unfold icon.
* @param hover True for hover effect, false otherwise.
* @return A QPixmap representing the icon.
* @param fold `true` for fold icon, `false` for unfold icon.
* @param hover `true` for hover effect, `false` otherwise.
* @return The icon as a QPixmap.
*/
QPixmap drawFoldIcon(const QPalette& p, bool fold, bool hover) const;
private:
// Store the built-in icons for restoration.
/**
* @brief Stores the built-in icons for restoration.
*/
QPixmap builtinFold;
QPixmap builtinFoldOver;
QPixmap builtinUnfold;

View File

@@ -21,7 +21,7 @@ namespace QSint
class TaskGroup : public QFrame
{
typedef QFrame BaseClass;
using BaseClass = QFrame;
public:
TaskGroup(QWidget *parent, bool hasHeader = false);
@@ -38,7 +38,6 @@ public:
QPixmap transparentRender();
protected:
void paintEvent ( QPaintEvent * event ) override;
void keyPressEvent ( QKeyEvent * event ) override;
void keyReleaseEvent ( QKeyEvent * event ) override;

View File

@@ -22,7 +22,7 @@ class TaskHeader : public QFrame
{
Q_OBJECT
typedef QFrame BaseClass;
using BaseClass = QFrame;
friend class ActionGroup;