예제 #1
0
void FitDialog::initEditPage()
{
    QGridLayout *gl1 = new QGridLayout();
    gl1->addWidget(new QLabel(tr("Category")), 0, 0);
    gl1->addWidget(new QLabel(tr("Function")), 0, 1);
    gl1->addWidget(new QLabel(tr("Expression")), 0, 2);

	categoryBox = new QListWidget();
	categoryBox->addItem(tr("User defined"));
	categoryBox->addItem(tr("Built-in"));
	categoryBox->addItem(tr("Basic"));
	categoryBox->addItem(tr("Plugins"));

    gl1->addWidget(categoryBox, 1, 0);
	funcBox = new QListWidget();
    gl1->addWidget(funcBox, 1, 1);
	explainBox = new QTextEdit();
	explainBox->setReadOnly(true);
    gl1->addWidget(explainBox, 1, 2);

	boxUseBuiltIn = new QCheckBox();
	boxUseBuiltIn->setText(tr("Fit with &built-in function"));
	boxUseBuiltIn->hide();

    QHBoxLayout *hbox1 = new QHBoxLayout();
	hbox1->addWidget(boxUseBuiltIn);
    hbox1->addStretch();

	polynomOrderLabel = new QLabel( tr("Polynomial Order"));
	polynomOrderLabel->hide();
    hbox1->addWidget(polynomOrderLabel);

	polynomOrderBox = new QSpinBox();
    polynomOrderBox->setMinimum(1);
	polynomOrderBox->setValue(2);
	polynomOrderBox->hide();
	connect(polynomOrderBox, SIGNAL(valueChanged(int)), this, SLOT(showExpression(int)));
    hbox1->addWidget(polynomOrderBox);

	buttonPlugins = new QPushButton(tr( "&Choose plugins folder..." ) );
    hbox1->addWidget(buttonPlugins);
	buttonPlugins->hide();

    buttonClearUsrList = new QPushButton(tr( "Clear user &list" ) );
    hbox1->addWidget(buttonClearUsrList);
	buttonClearUsrList->hide();

    QGridLayout *gl2 = new QGridLayout();
    gl2->addWidget(new QLabel(tr("Name")), 0, 0);
	boxName = new QLineEdit(tr("user1"));
    gl2->addWidget(boxName, 0, 1);
	btnAddFunc = new QPushButton(tr( "&Save" ));
    gl2->addWidget(btnAddFunc, 0, 2);
    gl2->addWidget(new QLabel(tr("Parameters")), 1, 0);
	boxParam = new QLineEdit("a, b");
    gl2->addWidget(boxParam, 1, 1);
	btnDelFunc = new QPushButton( tr( "&Remove" ));
    gl2->addWidget(btnDelFunc, 1, 2);

    QGroupBox *gb = new QGroupBox();
    gb->setLayout(gl2);

	editBox = new QTextEdit();
	editBox->setTextFormat(Qt::PlainText);
	editBox->setFocus();

    QVBoxLayout *vbox1 = new QVBoxLayout();
	btnAddTxt = new QPushButton(tr( "Add &expression" ) );
    vbox1->addWidget(btnAddTxt);
	btnAddName = new QPushButton(tr( "Add &name" ));
    vbox1->addWidget(btnAddName);
	buttonClear = new QPushButton(tr( "Rese&t" ));
    vbox1->addWidget(buttonClear);
	buttonCancel2 = new QPushButton(tr( "&Close" ));
    vbox1->addWidget(buttonCancel2);
    btnContinue = new QPushButton(tr( "&Fit >>" ));
    vbox1->addWidget(btnContinue);
    vbox1->addStretch();

    QHBoxLayout *hbox2 = new QHBoxLayout();
	hbox2->addWidget(editBox);
    hbox2->addLayout(vbox1);

    QVBoxLayout *vbox2 = new QVBoxLayout();
    vbox2->addLayout(gl1);
    vbox2->addLayout(hbox1);
    vbox2->addWidget(gb);
    vbox2->addLayout(hbox2);

    editPage = new QWidget();
    editPage->setLayout(vbox2);
    tw->addWidget(editPage);

	connect( buttonPlugins, SIGNAL( clicked() ), this, SLOT(choosePluginsFolder()));
    connect( buttonClear, SIGNAL( clicked() ), this, SLOT(resetFunction()));
	connect( buttonClearUsrList, SIGNAL( clicked() ), this, SLOT(clearUserFunctions()));
	connect( categoryBox, SIGNAL(currentRowChanged (int)), this, SLOT(showFunctionsList(int) ) );
	connect( funcBox, SIGNAL(currentRowChanged(int)), this, SLOT(showExpression(int)));
	connect( boxUseBuiltIn, SIGNAL(toggled(bool)), this, SLOT(setFunction(bool) ) );
	connect( btnAddName, SIGNAL(clicked()), this, SLOT(pasteFunctionName() ) );
	connect( btnAddTxt, SIGNAL(clicked()), this, SLOT(pasteExpression() ) );
	connect( btnContinue, SIGNAL(clicked()), this, SLOT(showFitPage() ) );
	connect( btnAddFunc, SIGNAL(clicked()), this, SLOT(saveUserFunction()));
	connect( btnDelFunc, SIGNAL(clicked()), this, SLOT(removeUserFunction()));
	connect( buttonCancel2, SIGNAL(clicked()), this, SLOT(close()) );
}
예제 #2
0
void fitDialog::initEditPage()
{
    editPage = new QWidget( tw, "editPage" );

    QHBox *hbox1=new QHBox(editPage,"hbox1");
    hbox1->setSpacing(5);

    QVBox *vbox1=new QVBox(hbox1,"vbox1");
    vbox1->setSpacing(5);
    new QLabel( tr("Category"), vbox1, "TextLabel41",0 );
    categoryBox = new QListBox( vbox1, "categoryBox" );
    categoryBox->insertItem(tr("User defined"));
    categoryBox->insertItem(tr("Built-in"));
    categoryBox->insertItem(tr("Basic"));
    categoryBox->insertItem(tr("Plugins"));
    categoryBox->setSizePolicy(QSizePolicy (QSizePolicy::Fixed, QSizePolicy::Expanding, 2, 0, FALSE ));

    QVBox *vbox2=new QVBox(hbox1,"vbox2");
    vbox2->setSpacing(5);
    new QLabel( tr("Function"), vbox2, "TextLabel41",0 );
    funcBox = new QListBox( vbox2, "funcBox" );

    QVBox *vbox3=new QVBox(hbox1,"vbox3");
    vbox3->setSpacing(5);
    new QLabel( tr("Expression"), vbox3, "TextLabel41",0 );
    explainBox = new QTextEdit( vbox3, "explainBox" );
    explainBox->setReadOnly(true);

    QHBox *hbox3=new QHBox(editPage,"hbox3");
    hbox3->setSpacing(5);

    boxUseBuiltIn = new QCheckBox(hbox3,"boxUseBuiltIn");
    boxUseBuiltIn->setText(tr("Fit with &built-in function"));
    boxUseBuiltIn->hide();

    buttonPlugins = new QPushButton(hbox3, "buttonPlugins" );
    buttonPlugins->setText( tr( "&Choose plugins folder..." ) );
    buttonPlugins->hide();

    QButtonGroup *GroupBox1 = new QButtonGroup( 3,QGroupBox::Horizontal,tr(""),editPage,"GroupBox3" );

    new QLabel( tr("Name"), GroupBox1, "TextLabel41",0 );
    boxName = new QLineEdit(GroupBox1, "boxName" );
    boxName->setText("user1");

    btnAddFunc = new QPushButton(GroupBox1, "btnAddFunc" );
    btnAddFunc->setText( tr( "&Save" ) );

    new QLabel( tr("Parameters"), GroupBox1, "TextLabel41",0 );
    boxParam = new QLineEdit(GroupBox1, "boxParam" );
    boxParam->setText("a, b");

    btnDelFunc = new QPushButton(GroupBox1, "btnDelFunc" );
    btnDelFunc->setText( tr( "&Remove" ) );

    QHBox *hbox2=new QHBox(editPage,"hbox2");
    hbox2->setSpacing(5);

    editBox = new QTextEdit( hbox2, "editBox" );
    editBox->setTextFormat(Qt::PlainText);
    editBox->setFocus();

    QVBox *vbox4=new QVBox(hbox2,"vbox4");
    vbox4->setSpacing(5);

    btnAddTxt = new QPushButton(vbox4, "btnAddTxt" );
    btnAddTxt->setText( tr( "Add &expression" ) );

    btnAddName = new QPushButton(vbox4, "btnClose" );
    btnAddName->setText( tr( "Add &name" ) );

    buttonClear = new QPushButton(vbox4, "buttonClear" );
    buttonClear->setText( tr( "Clear user &list" ) );

    btnContinue = new QPushButton(vbox4, "btnContinue" );
    btnContinue->setText( tr( "&Fit >>" ) );

    QVBoxLayout* hlayout = new QVBoxLayout(editPage, 5, 5, "hlayout");
    hlayout->addWidget(hbox1);
    hlayout->addWidget(hbox3);
    hlayout->addWidget(GroupBox1);
    hlayout->addWidget(hbox2);

    connect( buttonPlugins, SIGNAL( clicked() ), this, SLOT(choosePluginsFolder()));
    connect( buttonClear, SIGNAL( clicked() ), this, SLOT(clearList()));
    connect( categoryBox, SIGNAL(highlighted(int)), this, SLOT(showFunctionsList(int) ) );
    connect( funcBox, SIGNAL(highlighted(int)), this, SLOT(showExpression(int)));
    connect( boxUseBuiltIn, SIGNAL(toggled(bool)), this, SLOT(setFunction(bool) ) );
    connect( btnAddName, SIGNAL(clicked()), this, SLOT(addFunctionName() ) );
    connect( btnAddTxt, SIGNAL(clicked()), this, SLOT(addFunction() ) );
    connect( btnContinue, SIGNAL(clicked()), this, SLOT(showFitPage() ) );
    connect( btnAddFunc, SIGNAL(clicked()), this, SLOT(saveUserFunction()));
    connect( btnDelFunc, SIGNAL(clicked()), this, SLOT(removeUserFunction()));
}