Remove userType() from public API for now

If added, will need to be through overloads, to not break source
compat. Will add them once there's a need.
This commit is contained in:
Sergio Martins
2021-03-01 16:33:13 +00:00
parent 74b034a195
commit 19fd1635e6
4 changed files with 11 additions and 16 deletions

View File

@@ -24,9 +24,8 @@ public:
~CustomFrameworkWidgetFactory() override;
QUrl titleBarFilename(int userType) const override
QUrl titleBarFilename() const override
{
Q_UNUSED(userType);
return QUrl("qrc:/MyTitleBar.qml");
}
};

View File

@@ -54,9 +54,9 @@ FrameworkWidgetFactory::~FrameworkWidgetFactory()
}
#ifdef KDDOCKWIDGETS_QTWIDGETS
Frame *DefaultWidgetFactory::createFrame(QWidgetOrQuick *parent, FrameOptions options, int userType) const
Frame *DefaultWidgetFactory::createFrame(QWidgetOrQuick *parent, FrameOptions options) const
{
return new FrameWidget(parent, options, userType);
return new FrameWidget(parent, options);
}
TitleBar *DefaultWidgetFactory::createTitleBar(Frame *frame) const
@@ -138,9 +138,9 @@ QAbstractButton* DefaultWidgetFactory::createTitleBarButton(QWidget *parent, Tit
#else
Frame *DefaultWidgetFactory::createFrame(QWidgetOrQuick *parent, FrameOptions options, int userType) const
Frame *DefaultWidgetFactory::createFrame(QWidgetOrQuick *parent, FrameOptions options) const
{
return new FrameQuick(parent, options, userType);
return new FrameQuick(parent, options);
}
TitleBar *DefaultWidgetFactory::createTitleBar(Frame *frame) const
@@ -212,9 +212,8 @@ SideBar *DefaultWidgetFactory::createSideBar(SideBarLocation loc, MainWindowBase
return nullptr;
}
QUrl DefaultWidgetFactory::titleBarFilename(int userType) const
QUrl DefaultWidgetFactory::titleBarFilename() const
{
Q_UNUSED(userType);
return QUrl(QStringLiteral("qrc:/kddockwidgets/private/quick/qml/TitleBar.qml"));
}

View File

@@ -80,9 +80,7 @@ public:
/// DockWidgets.
///@param parent just forward to Frame's constructor
///@param options just forward to Frame's constructor
///@param userType corresponds to DockWidgetBase::userType()
virtual Frame* createFrame(QWidgetOrQuick *parent = nullptr, FrameOptions options = FrameOption_None,
int userType = 0) const = 0;
virtual Frame* createFrame(QWidgetOrQuick *parent = nullptr, FrameOptions options = FrameOption_None) const = 0;
///@brief Called internally by the framework to create a TitleBar
/// Override to provide your own TitleBar sub-class. If overridden then
@@ -144,7 +142,7 @@ public:
///@p parent the button's parent
virtual QAbstractButton* createTitleBarButton(QWidget *parent, TitleBarButtonType) const = 0;
#else
virtual QUrl titleBarFilename(int userType = 0) const = 0;
virtual QUrl titleBarFilename() const = 0;
virtual QUrl dockwidgetFilename() const = 0;
virtual QUrl frameFilename() const = 0;
virtual QUrl floatingWindowFilename() const = 0;
@@ -165,7 +163,7 @@ class DOCKS_EXPORT DefaultWidgetFactory : public FrameworkWidgetFactory
Q_OBJECT
public:
DefaultWidgetFactory() = default;
Frame *createFrame(QWidgetOrQuick *parent, FrameOptions, int userType) const override;
Frame *createFrame(QWidgetOrQuick *parent, FrameOptions) const override;
TitleBar *createTitleBar(Frame *) const override;
TitleBar *createTitleBar(FloatingWindow *) const override;
TabWidget *createTabWidget(Frame *parent) const override;
@@ -180,7 +178,7 @@ public:
#ifdef KDDOCKWIDGETS_QTWIDGETS
QAbstractButton* createTitleBarButton(QWidget *parent, TitleBarButtonType) const override;
#else
Q_INVOKABLE QUrl titleBarFilename(int userType = 0) const override;
Q_INVOKABLE QUrl titleBarFilename() const override;
QUrl dockwidgetFilename() const override;
QUrl frameFilename() const override;
QUrl floatingWindowFilename() const override;

View File

@@ -46,8 +46,7 @@ void MDILayoutWidget::addDockWidget(DockWidgetBase *dw, QPoint localPt, InitialO
if (frame) {
newItem->setGuestWidget(frame);
} else {
frame = Config::self().frameworkWidgetFactory()->createFrame(nullptr, FrameOption_None,
dw->userType());
frame = Config::self().frameworkWidgetFactory()->createFrame(nullptr, FrameOption_None);
frame->addWidget(dw, addingOption);
newItem->setGuestWidget(frame);