36 QDesignerTaskMenu(widget, parent),
38 m_containerWidget(widget),
39 m_core(formWindow()->core()),
40 m_pagePromotionTaskMenu(
new PromotionTaskMenu(
nullptr, PromotionTaskMenu::ModeSingleWidget,
this)),
41 m_pageMenuAction(
new QAction(
this)),
42 m_pageMenu(
new QMenu),
43 m_actionInsertPageAfter(
new QAction(
this)),
44 m_actionInsertPage(
nullptr),
45 m_actionDeletePage(
new QAction(tr(
"Delete"),
this))
48 m_taskActions.append(createSeparator());
50 connect(m_actionDeletePage, &QAction::triggered,
this, &ContainerWidgetTaskMenu::removeCurrentPage);
52 connect(m_actionInsertPageAfter, &QAction::triggered,
this, &ContainerWidgetTaskMenu::addPageAfter);
57 m_taskActions.append(createSeparator());
63 m_pageMenuAction->setMenu(m_pageMenu);
64 m_taskActions.append(m_pageMenuAction);
69 QAction *insertMenuAction =
new QAction(tr(
"Insert"),
this);
70 QMenu *insertMenu =
new QMenu;
72 m_actionInsertPage =
new QAction(tr(
"Insert Page Before Current Page"),
this);
73 connect(m_actionInsertPage, &QAction::triggered,
this, &ContainerWidgetTaskMenu::addPage);
74 insertMenu->addAction(m_actionInsertPage);
76 m_actionInsertPageAfter->setText(tr(
"Insert Page After Current Page"));
77 insertMenu->addAction(m_actionInsertPageAfter);
79 insertMenuAction->setMenu(insertMenu);
80 m_taskActions.append(insertMenuAction);
84 m_actionInsertPageAfter->setText(tr(
"Add Subwindow"));
85 m_taskActions.append(m_actionInsertPageAfter);
129 const int index = ce->currentIndex();
131 auto actions = QDesignerTaskMenu::taskActions();
132 actions += m_taskActions;
135 const bool canAddWidget = ce->canAddWidget();
136 if (m_actionInsertPage)
137 m_actionInsertPage->setEnabled(canAddWidget);
138 m_actionInsertPageAfter->setEnabled(canAddWidget);
139 m_pageMenu->addAction(m_actionDeletePage);
140 m_actionDeletePage->setEnabled(index >= 0 && ce->canRemove(index) && canDeletePage());
141 m_pageMenuAction->setText(pageMenuText(m_type, index, ce->count()));
143 m_pageMenuAction->setEnabled(
true);
144 m_pagePromotionTaskMenu->setWidget(ce->widget(index));
145 m_pagePromotionTaskMenu->addActions(PromotionTaskMenu::LeadingSeparator|PromotionTaskMenu::SuppressGlobalEdit, m_pageMenu);
147 m_pageMenuAction->setEnabled(
false);
200 m_nextAction(
new QAction(tr(
"Next"),
this)),
201 m_previousAction(
new QAction(tr(
"Back"),
this))
203 connect(m_nextAction, &QAction::triggered, w, &QWizard::next);
204 connect(m_previousAction, &QAction::triggered, w, &QWizard::back);
205 auto &l = containerActions();
206 l.push_front(createSeparator());
207 l.push_front(m_nextAction);
208 l.push_front(m_previousAction);
209 l.push_front(createSeparator());
228 connect(m_nextAction, &QAction::triggered, m, &QMdiArea::activateNextSubWindow);
229 connect(m_previousAction, &QAction::triggered, m , &QMdiArea::activatePreviousSubWindow);
230 connect(m_tileAction, &QAction::triggered, m, &QMdiArea::tileSubWindows);
231 connect(m_cascadeAction, &QAction::triggered, m, &QMdiArea::cascadeSubWindows);
272 if (iid !=
"QDesignerInternalTaskMenuExtension"_L1 || !object->isWidgetType())
277 if (qobject_cast<QStackedWidget*>(widget)
278 || qobject_cast<QToolBox*>(widget)
279 || qobject_cast<QTabWidget*>(widget)
280 || qobject_cast<QMainWindow*>(widget)) {
283 if (
const WidgetDataBase *wb = qobject_cast<
const WidgetDataBase *>(m_core->widgetDataBase())) {
284 const int idx = wb->indexOfObject(widget);
285 const WidgetDataBaseItem *item =
static_cast<
const WidgetDataBaseItem *>(wb->item(idx));
286 if (item->addPageMethod().isEmpty())
294 if (QMdiArea* ma = qobject_cast<QMdiArea*>(widget))
295 return new MdiContainerWidgetTaskMenu(ma, parent);
296 if (QWizard *wz = qobject_cast<QWizard *>(widget))
297 return new WizardContainerWidgetTaskMenu(wz, parent);
298 return new ContainerWidgetTaskMenu(widget, PageContainer, parent);