Esempio n. 1
0
DlgSelectVars::DlgSelectVars(MOVector<Variable> * variables, QList<VariableCausality> causalities,MOVector<Variable>* alreadySelected)
{
    _useOpt = false;
    _variables = variables;

    if(alreadySelected)
        _selectedVars=alreadySelected;
    else
        _selectedVars=new MOVector<Variable>(false);

    QGridLayout* allLayout = new QGridLayout(this);
    QGridLayout* varLayout = new QGridLayout(this);

    widgetSelectVars = new WidgetSelectVars(_variables,this,causalities,_selectedVars);
    varLayout->addWidget(widgetSelectVars);

    pushOk = new QPushButton("Ok",this);
    pushCancel = new QPushButton("Cancel",this);

    allLayout->addLayout(varLayout,0,0,1,3);
    allLayout->addItem(new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum),1,0);
    allLayout->addWidget(pushCancel,1,1,1,1);
    allLayout->addWidget(pushOk,1,2,1,1);
    this->setLayout(allLayout);

    connect(pushOk,SIGNAL(clicked()),this,SLOT(pushedOk()));
    connect(pushCancel,SIGNAL(clicked()),this,SLOT(pushedCancel()));
}
Esempio n. 2
0
MOParametersDlg::MOParametersDlg(MOParameters *parameters, bool editable)
{
    // save parameters
    _orgParameters = parameters;

    // create layout
    this->setLayout(new QVBoxLayout(this));

    // add parameters widget
    // no direct link : widget works on a copy. Only when clicked on Ok,
    // parameters values are updated.
    _widget = new WidgetParameters(parameters,false,editable);
    this->layout()->addWidget(_widget);

    // add buttons
    QHBoxLayout *buttonsLayout = new QHBoxLayout(this);
    QPushButton *pushOk = new QPushButton("Ok",this);
    buttonsLayout->addItem(new QSpacerItem(20, 40, QSizePolicy::Expanding, QSizePolicy::Minimum));
    buttonsLayout->addWidget(pushOk);
    connect(pushOk,SIGNAL(clicked()),this,SLOT(pushedOk()));

    if(editable)
    {
        QPushButton *pushDefault = new QPushButton("Restore default",this);
        connect(pushDefault,SIGNAL(clicked()),this,SLOT(pushedDefault()));
        QPushButton *pushCancel = new QPushButton("Cancel",this);
        connect(pushCancel,SIGNAL(clicked()),this,SLOT(pushedCancel()));

        buttonsLayout->addWidget(pushDefault);
        buttonsLayout->addWidget(pushCancel);
    }

    pushOk->setDefault(true);

    QWidget *buttonsWidget = new QWidget(this);
    buttonsWidget->setLayout(buttonsLayout);

    this->layout()->addWidget(buttonsWidget);
}