Added CompositView, which implements both View and ViewLayout, for combining Views to one Widget. The layout can be set to either horizontal or vertical. SearchView, RefreshView and UndoRedoView are combined to one DockWidget by the ComponentManager now. fortune cookie message = You'll get more secure and confident with your relationship with your co-workers.
40 lines
737 B
C++
40 lines
737 B
C++
#ifndef COMPONENT_H
|
|
#define COMPONENT_H
|
|
|
|
#include <memory>
|
|
|
|
class View;
|
|
class Controller;
|
|
|
|
class Component
|
|
{
|
|
public:
|
|
Component(std::shared_ptr<View> view, std::shared_ptr<Controller> controller);
|
|
~Component();
|
|
|
|
template <typename ControllerType>
|
|
ControllerType* getController() const;
|
|
|
|
template <typename ViewType>
|
|
ViewType* getView() const;
|
|
|
|
private:
|
|
const std::shared_ptr<Controller> m_controller;
|
|
const std::shared_ptr<View> m_view;
|
|
};
|
|
|
|
|
|
template <typename ControllerType>
|
|
ControllerType* Component::getController() const
|
|
{
|
|
return dynamic_cast<ControllerType*>(m_controller.get());
|
|
}
|
|
|
|
template <typename ViewType>
|
|
ViewType* Component::getView() const
|
|
{
|
|
return dynamic_cast<ViewType*>(m_view.get());
|
|
}
|
|
|
|
#endif // COMPONENT_H
|