COPASI API  4.16.103
Public Member Functions | Protected Slots | Protected Attributes | List of all members
CQSpringLayoutParameterWindow Class Reference

#include <CQSpringLayoutParameterWindow.h>

Inheritance diagram for CQSpringLayoutParameterWindow:
Inheritance graph
[legend]
Collaboration diagram for CQSpringLayoutParameterWindow:
Collaboration graph
[legend]

Public Member Functions

 CQSpringLayoutParameterWindow (const QString &title, QWidget *parent=0, Qt::WindowFlags flags=0)
 
CCopasiSpringLayout::ParametersgetLayoutParameters ()
 
virtual ~CQSpringLayoutParameterWindow ()
 

Protected Slots

void slotLayoutSliderChanged ()
 

Protected Attributes

CCopasiSpringLayout::Parameters mLayoutParameters
 
std::vector< QwtSlider * > mLayoutSliders
 

Detailed Description

Definition at line 17 of file CQSpringLayoutParameterWindow.h.

Constructor & Destructor Documentation

CQSpringLayoutParameterWindow::CQSpringLayoutParameterWindow ( const QString &  title,
QWidget *  parent = 0,
Qt::WindowFlags  flags = 0 
)

Definition at line 14 of file CQSpringLayoutParameterWindow.cpp.

References CCopasiSpringLayout::Parameters::isLog, CCopasiSpringLayout::Parameters::max, CCopasiSpringLayout::Parameters::min, mLayoutParameters, mLayoutSliders, CCopasiSpringLayout::Parameters::names, slotLayoutSliderChanged(), and CCopasiSpringLayout::Parameters::values.

15  : QDockWidget(title, parent, flags)
16 {
17  QWidget* pParaWidget = new QWidget(this);
18  QVBoxLayout* pLayout = new QVBoxLayout;
19  pParaWidget->setLayout(pLayout);
20  size_t i;
21 
22  for (i = 0; i < mLayoutParameters.values.size(); ++i)
23  {
24  QLabel* label = new QLabel(mLayoutParameters.names[i].c_str());
25  pLayout->addWidget(label);
26  QwtSlider* slider = new QwtSlider(pParaWidget, Qt::Horizontal, QwtSlider::BottomScale);
27 
28  if (mLayoutParameters.isLog[i])
29  {
30  slider->setScaleEngine(new QwtLog10ScaleEngine);
31  slider->setRange(log10(mLayoutParameters.min[i]), log10(mLayoutParameters.max[i]));
32  slider->setScale(mLayoutParameters.min[i], mLayoutParameters.max[i]);
33  slider->setValue(log10(mLayoutParameters.values[i]));
34  }
35  else
36  {
37  slider->setRange(mLayoutParameters.min[i], mLayoutParameters.max[i]);
38  slider->setValue(mLayoutParameters.values[i]);
39  }
40 
41  pLayout->addWidget(slider);
42  mLayoutSliders.push_back(slider);
43 
44  connect(slider, SIGNAL(valueChanged(double)), this, SLOT(slotLayoutSliderChanged()));
45  }
46 
47  setWidget(pParaWidget);
48  setVisible(false);
49 }
std::vector< QwtSlider * > mLayoutSliders
CCopasiSpringLayout::Parameters mLayoutParameters
std::vector< std::string > names
CQSpringLayoutParameterWindow::~CQSpringLayoutParameterWindow ( )
virtual

Definition at line 51 of file CQSpringLayoutParameterWindow.cpp.

52 {
53 }

Member Function Documentation

CCopasiSpringLayout::Parameters & CQSpringLayoutParameterWindow::getLayoutParameters ( )

Definition at line 55 of file CQSpringLayoutParameterWindow.cpp.

References mLayoutParameters.

Referenced by CQLayoutThread::randomizeLayout(), and CQLayoutThread::run().

56 {
57  return mLayoutParameters;
58 }
CCopasiSpringLayout::Parameters mLayoutParameters
void CQSpringLayoutParameterWindow::slotLayoutSliderChanged ( )
protectedslot

Definition at line 60 of file CQSpringLayoutParameterWindow.cpp.

References CCopasiSpringLayout::Parameters::isLog, mLayoutParameters, mLayoutSliders, and CCopasiSpringLayout::Parameters::values.

Referenced by CQSpringLayoutParameterWindow().

61 {
62  //std::cout << "slider..." << std::endl;
63  size_t i;
64 
65  for (i = 0; i < mLayoutSliders.size(); ++i)
66  {
67  if (mLayoutParameters.isLog[i])
68  mLayoutParameters.values[i] = pow(10, mLayoutSliders[i]->value());
69  else
70  mLayoutParameters.values[i] = mLayoutSliders[i]->value();
71  }
72 }
std::vector< QwtSlider * > mLayoutSliders
CCopasiSpringLayout::Parameters mLayoutParameters

Member Data Documentation

CCopasiSpringLayout::Parameters CQSpringLayoutParameterWindow::mLayoutParameters
protected
std::vector<QwtSlider*> CQSpringLayoutParameterWindow::mLayoutSliders
protected

The documentation for this class was generated from the following files: