mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
added documentation for BrowserAction and SideBar APIs
This commit is contained in:
parent
9501eafbba
commit
76730823d9
@ -37,6 +37,16 @@ QmlBrowserAction::QmlBrowserAction(QObject *parent)
|
||||
connect(m_button, &QmlBrowserActionButton::clicked, this, &QmlBrowserAction::clicked);
|
||||
}
|
||||
|
||||
QmlBrowserActionButton *QmlBrowserAction::button() const
|
||||
{
|
||||
return m_button;
|
||||
}
|
||||
|
||||
QmlBrowserAction::Locations QmlBrowserAction::location() const
|
||||
{
|
||||
return m_locations;
|
||||
}
|
||||
|
||||
QString QmlBrowserAction::identity() const
|
||||
{
|
||||
return m_identity;
|
||||
@ -114,22 +124,12 @@ void QmlBrowserAction::setPopup(QQmlComponent* popup)
|
||||
emit popupChanged(m_popup);
|
||||
}
|
||||
|
||||
QmlBrowserAction::Locations QmlBrowserAction::location() const
|
||||
{
|
||||
return m_locations;
|
||||
}
|
||||
|
||||
void QmlBrowserAction::setLocation(const Locations &locations)
|
||||
{
|
||||
m_locations = locations;
|
||||
emit locationChanged(m_locations);
|
||||
}
|
||||
|
||||
QmlBrowserActionButton *QmlBrowserAction::button() const
|
||||
{
|
||||
return m_button;
|
||||
}
|
||||
|
||||
QmlBrowserActionButton::QmlBrowserActionButton(QObject *parent)
|
||||
: AbstractButtonInterface(parent)
|
||||
, m_popup(nullptr)
|
||||
|
@ -21,27 +21,133 @@
|
||||
|
||||
class QmlBrowserActionButton;
|
||||
|
||||
/**
|
||||
* @brief The class exposing BrowserAction API to QML
|
||||
*/
|
||||
class QmlBrowserAction : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
/**
|
||||
* @brief identity for the button. This is a required property.
|
||||
*/
|
||||
Q_PROPERTY(QString identity READ identity WRITE setIdentity NOTIFY identityChanged)
|
||||
|
||||
/**
|
||||
* @brief name of the button. This is a required property.
|
||||
*/
|
||||
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
|
||||
|
||||
/**
|
||||
* @brief title of the button.
|
||||
*/
|
||||
Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
|
||||
|
||||
/**
|
||||
* @brief tool tip of the button.
|
||||
*/
|
||||
Q_PROPERTY(QString toolTip READ toolTip WRITE setToolTip NOTIFY toolTipChanged)
|
||||
|
||||
/**
|
||||
* @brief Url of the icon of button
|
||||
*/
|
||||
Q_PROPERTY(QString icon READ icon WRITE setIcon NOTIFY iconChanged)
|
||||
|
||||
/**
|
||||
* @brief badge text of the button
|
||||
*/
|
||||
Q_PROPERTY(QString badgeText READ badgeText WRITE setBadgeText NOTIFY badgeTextChanged)
|
||||
|
||||
/**
|
||||
* @brief the popup shown when the button is clicked. This must be a QML Window.
|
||||
*/
|
||||
Q_PROPERTY(QQmlComponent* popup READ popup WRITE setPopup NOTIFY popupChanged)
|
||||
|
||||
/**
|
||||
* @brief represents locations where the button is to be added.
|
||||
*/
|
||||
Q_PROPERTY(Locations location READ location WRITE setLocation NOTIFY locationChanged)
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief The Location enum
|
||||
*/
|
||||
enum Location {
|
||||
NavigationToolBar = 0x1,
|
||||
StatusBar = 0x2
|
||||
NavigationToolBar = 0x1, //!< to add the button in navigation tool bar
|
||||
StatusBar = 0x2 //!< to add the button in status bar
|
||||
};
|
||||
Q_DECLARE_FLAGS(Locations, Location)
|
||||
Q_ENUMS(Locations)
|
||||
|
||||
explicit QmlBrowserAction(QObject *parent = nullptr);
|
||||
QmlBrowserActionButton *button() const;
|
||||
Locations location() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* @brief This signal is emitted when identity property is changed
|
||||
* @param QString representing identity
|
||||
*/
|
||||
void identityChanged(const QString &identity);
|
||||
|
||||
/**
|
||||
* @brief This signal is emitted when name property is changed
|
||||
* @param QString representing name
|
||||
*/
|
||||
void nameChanged(const QString &name);
|
||||
|
||||
/**
|
||||
* @brief This signal is emitted when title property is changed
|
||||
* @param QString representing title
|
||||
*/
|
||||
void titleChanged(const QString &title);
|
||||
|
||||
/**
|
||||
* @brief This signal is emitted when the toolTip property is changed
|
||||
* @param QString representing toolTip
|
||||
*/
|
||||
void toolTipChanged(const QString &toolTip);
|
||||
|
||||
/**
|
||||
* @brief This signal is emitted when the icon property is changed
|
||||
* @param QString representing icon
|
||||
*/
|
||||
void iconChanged(const QString &icon);
|
||||
|
||||
/**
|
||||
* @brief This signal is emitted when the badgeText property is changed
|
||||
* @param QString representing badgeText
|
||||
*/
|
||||
void badgeTextChanged(const QString &badgeText);
|
||||
|
||||
/**
|
||||
* @brief This signal is emitted when the popup property is changed
|
||||
* @param QQmComponent representing popup
|
||||
*/
|
||||
void popupChanged(QQmlComponent *popup);
|
||||
|
||||
/**
|
||||
* @brief This signal is emitted when the locations property is changed
|
||||
* @param locations
|
||||
*/
|
||||
void locationChanged(const Locations &locations);
|
||||
|
||||
/**
|
||||
* @brief This signal is emitted when the button is clicked
|
||||
*/
|
||||
void clicked();
|
||||
|
||||
private:
|
||||
QString m_identity;
|
||||
QString m_name;
|
||||
QString m_title;
|
||||
QString m_toolTip;
|
||||
QString m_icon;
|
||||
QString m_badgeText;
|
||||
QQmlComponent* m_popup;
|
||||
Locations m_locations;
|
||||
QmlBrowserActionButton *m_button;
|
||||
|
||||
QString identity() const;
|
||||
void setIdentity(const QString &identity);
|
||||
QString name() const;
|
||||
@ -56,32 +162,7 @@ public:
|
||||
void setBadgeText(const QString &badgeText);
|
||||
QQmlComponent* popup() const;
|
||||
void setPopup(QQmlComponent* popup);
|
||||
Locations location() const;
|
||||
void setLocation(const Locations &locations);
|
||||
|
||||
QmlBrowserActionButton *button() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void identityChanged(const QString &identity);
|
||||
void nameChanged(const QString &name);
|
||||
void titleChanged(const QString &title);
|
||||
void toolTipChanged(const QString &toolTip);
|
||||
void iconChanged(const QString &icon);
|
||||
void badgeTextChanged(const QString &badgeText);
|
||||
void popupChanged(QQmlComponent *popup);
|
||||
void locationChanged(const Locations &locations);
|
||||
void clicked();
|
||||
|
||||
private:
|
||||
QString m_identity;
|
||||
QString m_name;
|
||||
QString m_title;
|
||||
QString m_toolTip;
|
||||
QString m_icon;
|
||||
QString m_badgeText;
|
||||
QQmlComponent* m_popup;
|
||||
Locations m_locations;
|
||||
QmlBrowserActionButton *m_button;
|
||||
};
|
||||
|
||||
class QmlBrowserActionButton : public AbstractButtonInterface
|
||||
|
@ -39,6 +39,11 @@ QString QmlSideBar::name() const
|
||||
return m_name;
|
||||
}
|
||||
|
||||
SideBarInterface *QmlSideBar::sideBar() const
|
||||
{
|
||||
return m_sideBarHelper;
|
||||
}
|
||||
|
||||
void QmlSideBar::setName(const QString &name)
|
||||
{
|
||||
m_name = name;
|
||||
@ -99,11 +104,6 @@ void QmlSideBar::setItem(QQmlComponent *item)
|
||||
emit itemChanged(m_item);
|
||||
}
|
||||
|
||||
SideBarInterface *QmlSideBar::sideBar() const
|
||||
{
|
||||
return m_sideBarHelper;
|
||||
}
|
||||
|
||||
QmlSideBarHelper::QmlSideBarHelper(QObject *parent)
|
||||
: SideBarInterface(parent)
|
||||
, m_item(nullptr)
|
||||
|
@ -21,39 +21,79 @@
|
||||
|
||||
class QmlSideBarHelper;
|
||||
|
||||
/**
|
||||
* @brief The class exposing SideBar API to QML
|
||||
*/
|
||||
class QmlSideBar : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
/**
|
||||
* @brief name of the sidebar. This is required property.
|
||||
*/
|
||||
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
|
||||
|
||||
/**
|
||||
* @brief title of the sidebar action.
|
||||
*/
|
||||
Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
|
||||
|
||||
/**
|
||||
* @brief icon url of the sidebar action.
|
||||
*/
|
||||
Q_PROPERTY(QString icon READ icon WRITE setIcon NOTIFY iconChanged)
|
||||
|
||||
/**
|
||||
* @brief shortcut for the sidebar action.
|
||||
*/
|
||||
Q_PROPERTY(QString shortcut READ shortcut WRITE setShortcut NOTIFY shortcutChanged)
|
||||
|
||||
/**
|
||||
* @brief represents whether the sidebar action is checkable
|
||||
*/
|
||||
Q_PROPERTY(bool checkable READ checkable WRITE setCheckable NOTIFY checkableChanged)
|
||||
|
||||
/**
|
||||
* @brief the GUI of the sidebar. This must be provided as QML Window.
|
||||
* This is a default property.
|
||||
*/
|
||||
Q_PROPERTY(QQmlComponent* item READ item WRITE setItem NOTIFY itemChanged)
|
||||
Q_CLASSINFO("DefaultProperty", "item")
|
||||
|
||||
public:
|
||||
explicit QmlSideBar(QObject *parent = nullptr);
|
||||
QString name() const;
|
||||
void setName(const QString &name);
|
||||
QString title() const;
|
||||
void setTitle(const QString &title);
|
||||
QString icon() const;
|
||||
void setIcon(const QString &icon);
|
||||
QString shortcut() const;
|
||||
void setShortcut(const QString &shortcut);
|
||||
bool checkable();
|
||||
void setCheckable(bool checkable);
|
||||
QQmlComponent *item() const;
|
||||
void setItem(QQmlComponent *item);
|
||||
|
||||
SideBarInterface *sideBar() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* @brief This signal is emitted when name property is changed.
|
||||
* @param QString represening name
|
||||
*/
|
||||
void nameChanged(const QString &name);
|
||||
|
||||
/**
|
||||
* @brief This signal is emitted when title property is changed
|
||||
* @param QString representing title
|
||||
*/
|
||||
void titleChanged(const QString &title);
|
||||
|
||||
/**
|
||||
* @brief This signal is emitted when icon property is changed
|
||||
* @param QString representing icon path url
|
||||
*/
|
||||
void iconChanged(const QString &icon);
|
||||
|
||||
/**
|
||||
* @brief This signal is emitted when shortcut property is changed
|
||||
* @param QString representing shortcut
|
||||
*/
|
||||
void shortcutChanged(const QString &shortcut);
|
||||
|
||||
/**
|
||||
* @brief This signal is emitted when checkable property is changed
|
||||
* @param checkable
|
||||
*/
|
||||
void checkableChanged(bool checkable);
|
||||
void itemChanged(QQmlComponent *item);
|
||||
|
||||
@ -66,6 +106,18 @@ private:
|
||||
QQmlComponent *m_item;
|
||||
|
||||
QmlSideBarHelper *m_sideBarHelper;
|
||||
|
||||
void setName(const QString &name);
|
||||
QString title() const;
|
||||
void setTitle(const QString &title);
|
||||
QString icon() const;
|
||||
void setIcon(const QString &icon);
|
||||
QString shortcut() const;
|
||||
void setShortcut(const QString &shortcut);
|
||||
bool checkable();
|
||||
void setCheckable(bool checkable);
|
||||
QQmlComponent *item() const;
|
||||
void setItem(QQmlComponent *item);
|
||||
};
|
||||
|
||||
class QmlSideBarHelper : public SideBarInterface
|
||||
|
Loading…
Reference in New Issue
Block a user