Advertisement
FatalCatharsis

CentralPane.cpp

Apr 13th, 2014
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "CentralPane.h"
  2.  
  3. CentralPane::CentralPane(std::vector<std::pair<Point, vanim::comp> >& points,
  4.                          QWidget * parent) :
  5.     QWidget(parent),
  6.     m_Points(points),
  7.     m_Selection(-1)
  8. {
  9.  
  10.  
  11.     setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
  12.  
  13.     m_Layout = new QVBoxLayout(this);
  14.     m_PlotWindow = new PlotWindow(points);
  15.  
  16.     m_PlotWidget = new PlotWidget(QWidget::createWindowContainer(m_PlotWindow, this), this);
  17.     m_Timeline = new TimeLine(points, this);
  18.  
  19.     m_Layout->addWidget(m_PlotWidget);
  20.     m_Layout->addWidget(m_Timeline);
  21.  
  22.     setLayout(m_Layout);
  23.  
  24.     connect(m_PlotWindow, SIGNAL(setSelection(int)),
  25.             this, SLOT(propSetSelection(int)));
  26.  
  27.     connect(m_PlotWindow, SIGNAL(selectionChanged()),
  28.             this, SLOT(propSelectChanged()));
  29.  
  30.     connect(m_Timeline, SIGNAL(timeChanged(float)),
  31.             m_PlotWindow, SLOT(setTime(float)));
  32.  
  33.     connect(m_PlotWindow, SIGNAL(selectionChanged()),
  34.             m_Timeline, SLOT(updateSelection()));
  35.  
  36.     connect(m_PlotWindow, SIGNAL(setSelection(int)),
  37.             m_Timeline, SLOT(setSelection(int)));
  38.  
  39.     connect(m_Timeline, SIGNAL(setKeyframeSelection(int)),
  40.             m_PlotWindow, SLOT(setKeyframeSelection(int)));
  41.  
  42.     connect(m_PlotWindow, SIGNAL(propKeyframeSelection(int)),
  43.             m_Timeline, SLOT(setKeyframeSelect(int)));
  44.  
  45. }
  46.  
  47. QSize CentralPane::minimumSizeHint() const
  48. {
  49.     return m_Layout->minimumSize();
  50. }
  51.  
  52. QSize CentralPane::sizeHint() const
  53. {
  54.     return m_Layout->sizeHint();
  55. }
  56.  
  57. void CentralPane::resizeEvent(QResizeEvent *)
  58. {
  59.     m_PlotWidget->resize(width() - 40, height() - m_Timeline->height() - 30);
  60.     m_Timeline->resize(m_PlotWidget->width(), m_Timeline->height());
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement