@@ -102,6 +102,14 @@ struct DockWidgetPrivate
102102 */
103103 DockWidgetPrivate (CDockWidget* _public);
104104
105+ /* *
106+ * Convenience function to ease components factory access
107+ */
108+ QSharedPointer<ads::CDockComponentsFactory> componentsFactory () const
109+ {
110+ return DockManager ? DockManager->componentsFactory () : CDockComponentsFactory::factory ();
111+ }
112+
105113 /* *
106114 * Show dock widget
107115 */
@@ -358,17 +366,25 @@ void DockWidgetPrivate::setToolBarStyleFromDockManager()
358366
359367// ============================================================================
360368CDockWidget::CDockWidget (const QString &title, QWidget *parent) :
361- QFrame (parent),
362- d (new DockWidgetPrivate(this ))
369+ CDockWidget (nullptr , title, parent)
363370{
371+ }
372+
373+
374+ // ============================================================================
375+ CDockWidget::CDockWidget (CDockManager *manager, const QString &title, QWidget* parent)
376+ : QFrame(parent),
377+ d (new DockWidgetPrivate(this ))
378+ {
379+ d->DockManager = manager;
364380 d->Layout = new QBoxLayout (QBoxLayout::TopToBottom);
365381 d->Layout ->setContentsMargins (0 , 0 , 0 , 0 );
366382 d->Layout ->setSpacing (0 );
367383 setLayout (d->Layout );
368384 setWindowTitle (title);
369385 setObjectName (title);
370386
371- d->TabWidget = componentsFactory ()->createDockWidgetTab (this );
387+ d->TabWidget = d-> componentsFactory ()->createDockWidgetTab (this );
372388
373389 d->ToggleViewAction = new QAction (title, this );
374390 d->ToggleViewAction ->setCheckable (true );
@@ -382,6 +398,7 @@ CDockWidget::CDockWidget(const QString &title, QWidget *parent) :
382398 }
383399}
384400
401+
385402// ============================================================================
386403CDockWidget::~CDockWidget ()
387404{
0 commit comments