qtquick: The user can now choose another titlebar file

This commit is contained in:
Sergio Martins
2020-12-02 22:43:01 +00:00
parent 979b2fdd40
commit 143c82291d
3 changed files with 15 additions and 3 deletions

View File

@@ -212,6 +212,11 @@ SideBar *DefaultWidgetFactory::createSideBar(SideBarLocation loc, MainWindowBase
return nullptr;
}
QUrl DefaultWidgetFactory::titleBarFilename() const
{
return QUrl(QStringLiteral("qrc:/kddockwidgets/private/quick/qml/TitleBar.qml"));
}
#endif // QtQuick
// iconForButtonType impl is the same for QtQuick and QtWidgets

View File

@@ -61,7 +61,12 @@ class TabBar;
*
* @sa Config::setFrameworkWidgetFactory()
*/
class DOCKS_EXPORT FrameworkWidgetFactory {
class DOCKS_EXPORT FrameworkWidgetFactory : public QObject
{
#ifdef KDDOCKWIDGETS_QTQUICK
Q_PROPERTY(QUrl titleBarFilename READ titleBarFilename CONSTANT)
#endif
Q_OBJECT
public:
FrameworkWidgetFactory() = default;
@@ -137,7 +142,7 @@ public:
///@p parent the button's parent
virtual QAbstractButton* createTitleBarButton(QWidget *parent, TitleBarButtonType) const = 0;
#else
// QtQuick will have some other base class for buttons
virtual QUrl titleBarFilename() const = 0;
#endif
/// @brief Returns the icon to be used with the specified @p type
@@ -168,6 +173,8 @@ public:
#ifdef KDDOCKWIDGETS_QTWIDGETS
QAbstractButton* createTitleBarButton(QWidget *parent, TitleBarButtonType) const override;
#else
QUrl titleBarFilename() const override;
#endif
QIcon iconForButtonType(TitleBarButtonType type, qreal dpr) const override;

View File

@@ -31,7 +31,7 @@ Rectangle {
Loader {
id: titleBar
readonly property QtObject titleBarCpp: root.titleBarCpp
source: "TitleBar.qml"
source: _kddw_widgetFactory.titleBarFilename
anchors {
top: parent.top