7 #include "fwGuiQt/container/QtContainer.hpp" 12 #include <QMetaObject> 29 QtContainer::~QtContainer() noexcept
32 "Error during destruction : The qt container included in this class is still allocated, please call destroyContainer() before.",
33 m_container ==
nullptr );
40 SLM_ASSERT(
"The container must be initialized before invoking setLayout().", m_container);
43 QLayout* oldLayout = m_container->layout();
45 if(
nullptr != oldLayout)
55 m_container->setLayout(layout);
60 void QtContainer::clean()
62 SLM_ASSERT(
"The container must be initialized before invoking clean().", m_container);
65 QLayout* oldLayout = m_container->layout();
67 if(
nullptr != oldLayout)
70 m_container->setUpdatesEnabled(
false);
72 for( QLayoutItem* child = oldLayout->takeAt(0);
nullptr != child; child = oldLayout->takeAt(0))
78 m_container->setUpdatesEnabled(
true);
84 void QtContainer::destroyContainer()
86 SLM_ASSERT(
"The container must be initialized before invoking destroyContainer().", m_container);
97 void QtContainer::setQtContainer(QWidget* container)
99 m_container = container;
104 QWidget* QtContainer::getQtContainer()
111 bool QtContainer::isShownOnScreen()
113 SLM_ASSERT(
"The container must be initialized before invoking isShownOnScreen().", m_container);
114 return m_container->isVisible();
119 void QtContainer::setVisible(
bool isVisible)
121 SLM_ASSERT(
"The container must be initialized before invoking setVisible().", m_container);
123 QWidget* parent = m_container->parentWidget();
124 QDockWidget* dock = qobject_cast<QDockWidget*>(parent);
128 dock->setVisible(isVisible);
131 m_container->setVisible(isVisible);
136 void QtContainer::setEnabled(
bool isEnabled)
138 SLM_ASSERT(
"The container must be initialized before invoking setEnabled().", m_container);
140 QWidget* parent = m_container->parentWidget();
141 QDockWidget* dock = qobject_cast<QDockWidget*>(parent);
145 dock->setEnabled(isEnabled);
148 m_container->setEnabled(isEnabled);
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.
The namespace fwGuiQt contains classes which provide the implementation of the Gui using Qt library...
virtual FWGUIQT_API void setLayout(QLayout *const layout)
Assign a layout to the container widget. Previous layout and its children are deleted and the contain...
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...