7 #include "fwGuiQt/layoutManager/LineLayoutManager.hpp" 9 #include <fwCore/base.hpp> 11 #include <fwGui/registry/macros.hpp> 15 #include <QScrollArea> 31 LineLayoutManager::~LineLayoutManager()
40 m_parentContainer = ::fwGuiQt::container::QtContainer::dynamicCast(parent);
41 SLM_ASSERT(
"dynamicCast fwContainer to QtContainer failed", m_parentContainer);
43 QBoxLayout* layout =
new QBoxLayout(QBoxLayout::LeftToRight);
44 m_parentContainer->setLayout(layout);
45 layout->setContentsMargins(0, 0, 0, 0);
49 if( orientation == VERTICAL )
51 layout->setDirection(QBoxLayout::TopToBottom);
54 const std::list< ViewInfo>& views = this->getViewsInfo();
57 if(viewInfo.m_isSpacer)
64 int border = viewInfo.m_border;
65 if(viewInfo.m_caption.first)
67 QGroupBox* groupbox =
new QGroupBox();
68 groupbox->setTitle(QString::fromStdString(viewInfo.m_caption.second));
70 border += groupbox->style()->pixelMetric(QStyle::PM_LayoutTopMargin);
74 panel =
new QWidget();
76 panel->setMinimumSize(std::max(viewInfo.m_minSize.first, 0), std::max(viewInfo.m_minSize.second, 0));
77 panel->setContentsMargins(border, border, border, border);
79 ::fwGuiQt::container::QtContainer::sptr subContainer = ::fwGuiQt::container::QtContainer::New();
80 subContainer->setQtContainer(panel);
83 if(viewInfo.m_useScrollBar)
85 QScrollArea* scrollArea =
new QScrollArea();
86 scrollArea->setWidget(panel);
87 scrollArea->setWidgetResizable(
true );
89 layout->addWidget( scrollArea );
90 layout->setStretchFactor(scrollArea, viewInfo.m_proportion);
94 layout->addWidget( panel );
95 layout->setStretchFactor(panel, viewInfo.m_proportion);
98 if(
false == viewInfo.m_visible)
100 subContainer->setVisible(
false);
111 m_parentContainer->clean();
The namespace fwGui contains the base interface for IHM services.
#define SLM_TRACE_FUNC()
Trace contextual function signature.
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.
Defines the line layout manager.
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
Orientation
Defines all possible orientation for a LineLayout.
std::vector< ::fwGui::container::fwContainer::sptr > m_subViews
All sub containers managed by this layout.
virtual FWGUIQT_API void destroyLayout() override
Destroy local layout with sub containers.
virtual FWGUI_API void destroySubViews()
Helper to destroy local sub views.
virtual FWGUIQT_API void createLayout(::fwGui::container::fwContainer::sptr parent) override
Instantiate layout with parent container.