DockWidgetConfig::DockWidgetConfig():
    QDockWidget()
{
    connect(this,SIGNAL(itemListChanged()),this,SLOT(handlerItemListChanged()));

    titulo.SeparadorFrame = new QFrame();
    titulo.SeparadorFrame->setFrameShape(QFrame::HLine);
    titulo.TituloLabel = new QLabel();
    titulo.isTit=false;
    titulo.isSeparador=false;
    mainVLayout = new QVBoxLayout();
    mainGroupBox = new QGroupBox();
    lastSpacer = new QSpacerItem(10,10,QSizePolicy::Maximum,QSizePolicy::Expanding);
    mainGroupBox->setLayout(mainVLayout);
    this->setWidget(mainGroupBox);
    mainVLayout->addSpacerItem(lastSpacer);

/*
    //DEBUG
    QLabel *aux = new QLabel("WOOYYYYYYYYYYYYY");
    QSpinBox *aux2 = new QSpinBox();
    QHBoxLayout *layaux = new QHBoxLayout();
    layaux->addWidget(aux2);
    layaux->addWidget(aux);
    mainVLayout->addLayout(layaux);
*/

    itemList.clear();
}
void DockWidgetConfig::removeItem(itemDockWidgetConfig_t *itemPtr)
{
    itemList.removeOne(itemPtr);
    itemDockWidgetConfig_t *auxItem = itemPtr;
    delete auxItem->Slider;
    delete auxItem->Spinbox;
    delete auxItem->Titulo;
    delete auxItem->DoubleSpinBox;
    delete auxItem->localHLayout;
    delete auxItem->localVLayout;
    emit itemListChanged();
}
void DockWidgetConfig::removeItemAt(int index)
{
    itemDockWidgetConfig_t *auxItem = itemList.at(index);
    itemList.removeAt(index);

    delete auxItem->Slider;
    delete auxItem->Spinbox;
    delete auxItem->Titulo;
    delete auxItem->DoubleSpinBox;
    delete auxItem->localHLayout;
    delete auxItem->localVLayout;
    emit itemListChanged();
}
void DockWidgetConfig::clearItems()
{
    for (int i=0;i< itemList.size() ; i++)
    {
        itemDockWidgetConfig_t *aux = itemList.at(i);

        delete aux->DoubleSpinBox;
        delete aux->localHLayout;
        delete aux->localVLayout;
        delete aux->Slider;
        delete aux->Spinbox;
        delete aux->Titulo;
        delete aux;
    }
    itemList.clear();
    emit itemListChanged();
}
void DockWidgetConfig::addItem(QString nombre, float rangeMin, float rangeMax, float statingPoint)
{
    itemDockWidgetConfig_t *item = new itemDockWidgetConfig_t;
    item->Titulo = new QLabel(nombre);
    item->Slider = new QSlider( Qt::Horizontal );
    item->Slider->setRange(rangeMin,rangeMax);
    item->Slider->setSliderPosition(statingPoint);
    item->Spinbox=NULL;
    item->isDouble = true;
    item->DoubleSpinBox = new QDoubleSpinBox();
    item->DoubleSpinBox->setRange(rangeMin,rangeMax);
    item->DoubleSpinBox->setValue(statingPoint);

    item->localHLayout = new QHBoxLayout();
    item->localVLayout = new QVBoxLayout();

    itemList.push_back(item);
    emit itemListChanged();
}
コード例 #6
0
ファイル: Persistance.cpp プロジェクト: SPQRTeam/Erenci
void Persistance::setModel(MotionMaker * model){
	this->model = model;
	connect(this->model, SIGNAL(itemListChanged()), this, SLOT(editingPerformed()));
}
void DockWidgetConfig::addItem(itemDockWidgetConfig_t *item)
{
    itemList.push_back(item);
    emit itemListChanged();
}