24 m_formContainer(
new QWidget),
25 m_formContainerLayout(
new QStackedLayout),
26 m_layout(
new QStackedLayout)
28 m_layout->setContentsMargins(QMargins());
29 m_layout->setSpacing(0);
30 m_layout->setStackingMode(QStackedLayout::StackAll);
35 m_formContainerLayout->setContentsMargins(QMargins());
36 m_formContainer->setObjectName(u"formContainer"_s);
37 m_formContainer->setLayout(m_formContainerLayout);
38 m_formContainerLayout->setStackingMode(QStackedLayout::StackAll);
41 m_formContainer->setAutoFillBackground(
true);
59 if (index < 0 || index >= cnt) {
60 qDebug(
"FormWindowWidgetStack::setCurrentTool(): invalid index: %d", index);
69 m_tools.at(cur)->deactivated();
72 m_layout->setCurrentIndex(index);
74 for (
int i = 0; i < cnt; i++)
75 m_tools.at(i)->editor()->setVisible(i == 0 || i == index);
77 QDesignerFormWindowToolInterface *tool = m_tools.at(index);
80 emit currentToolChanged(index);
127 const int previousCount = m_formContainerLayout->count();
128 QWidget *previousMainContainer = previousCount
129 ? m_formContainerLayout->itemAt(0)->widget() :
nullptr;
130 if (previousMainContainer == w)
134 delete m_formContainerLayout->takeAt(0);
136 m_formContainerLayout->addWidget(w);
141 if (
QWidget *w = tool->editor()) {
142 w->setVisible(m_layout->count() == 0);
143 m_layout->addWidget(w);
146 Q_ASSERT(m_tools.isEmpty());
147 m_layout->addWidget(m_formContainer);
150 m_tools.append(tool);
152 connect(tool->action(), &QAction::triggered,
153 this, &FormWindowWidgetStack::setSenderAsCurrentTool);