コード例 #1
0
ファイル: LineDialog.cpp プロジェクト: trnielsen/mantid
void LineDialog::apply()
{
    if (tw->currentPage()==dynamic_cast<QWidget *>(options)){
        lm->setStyle(Graph::getPenStyle(styleBox->currentItem()));
        lm->setColor(colorBox->color());
        lm->setWidth(widthBox->value());
        lm->drawEndArrow(endBox->isChecked());
        lm->drawStartArrow(startBox->isChecked());
  } else if (tw->currentPage()==dynamic_cast<QWidget *>(head)){
        if (lm->headLength() != boxHeadLength->value())
            lm->setHeadLength( boxHeadLength->value() );

        if (lm->headAngle() != boxHeadAngle->value())
            lm->setHeadAngle( boxHeadAngle->value() );

        if (lm->filledArrowHead() != filledBox->isChecked())
            lm->fillArrowHead( filledBox->isChecked() );
  } else if (tw->currentPage()==dynamic_cast<QWidget *>(geometry))
        setCoordinates(unitBox->currentItem());

	QwtPlot *plot = lm->plot();
  Graph *g = dynamic_cast<Graph *>(plot->parent());
	plot->replot();
	g->notifyChanges();

	enableHeadTab();
}
コード例 #2
0
void LineDialog::apply()
{
    if (tw->currentPage()==(QWidget *)options){
        lm->setStyle(styleBox->style());
        lm->setColor(colorBox->color());
        lm->setWidth(widthBox->value());
        lm->drawEndArrow(endBox->isChecked());
        lm->drawStartArrow(startBox->isChecked());
	} else if (tw->currentPage()==(QWidget *)head){
        if (lm->headLength() != boxHeadLength->value())
            lm->setHeadLength( boxHeadLength->value() );

        if (lm->headAngle() != boxHeadAngle->value())
            lm->setHeadAngle( boxHeadAngle->value() );

        if (lm->filledArrowHead() != filledBox->isChecked())
            lm->fillArrowHead( filledBox->isChecked() );
	} else if (tw->currentPage()==(QWidget *)geometry)
        setCoordinates(unitBox->currentItem());

	Graph *g = (Graph *)lm->plot();
	g->replot();
	g->multiLayer()->notifyChanges();

	enableHeadTab();
}
コード例 #3
0
void lineDialog::apply()
{
if (tw->currentPage()==(QWidget *)options)
	{
	Qt::PenStyle style;

	switch (styleBox->currentItem())
		{
		case 0:
			style=Qt::SolidLine;
		break;
		case 1:
			style=Qt::DashLine;
		break;
		case 2:
			style=Qt::DotLine;
		break;
		case 3:
			style=Qt::DashDotLine;
		break;
		case 4:
			style=Qt::DashDotDotLine;
		break;
		}

	emit values(colorBox->color(),widthBox->currentText().toInt(),style, endBox->isChecked(),startBox->isChecked());
	}
else if (tw->currentPage()==(QWidget *)head)
	{
	emit setHeadGeometry(boxHeadLength->value(),boxHeadAngle->value(), 
		filledBox->isChecked());
	}
else if (tw->currentPage()==(QWidget *)geometry)
	{
	emit setLineGeometry(QPoint(xStartBox->value(),yStartBox->value()),
			QPoint(xEndBox->value(),yEndBox->value()));
	}
enableHeadTab();
}
コード例 #4
0
ファイル: LineDialog.cpp プロジェクト: trnielsen/mantid
LineDialog::LineDialog( ArrowMarker *line, QWidget* parent,  Qt::WFlags fl )
    : QDialog( parent, fl )
{
  unitBox=NULL;

  setWindowTitle( tr( "MantidPlot - Line options" ) );
	setAttribute(Qt::WA_DeleteOnClose);
	
	lm = line;

	QGroupBox *gb1 = new QGroupBox();
    QGridLayout *gl1 = new QGridLayout();

    gl1->addWidget(new QLabel(tr("Color")), 0, 0);
	colorBox = new ColorButton();
	colorBox->setColor(lm->color());
	gl1->addWidget(colorBox, 0, 1);

	gl1->addWidget(new QLabel(tr("Line type")), 1, 0);
    styleBox = new QComboBox();
	styleBox->insertItem("_____");
	styleBox->insertItem("- - -");
	styleBox->insertItem(".....");
	styleBox->insertItem("_._._");
	styleBox->insertItem("_.._..");
	gl1->addWidget(styleBox, 1, 1);

	setLineStyle(lm->style());

	gl1->addWidget(new QLabel(tr("Line width")), 2, 0);
    widthBox = new DoubleSpinBox('f');
  widthBox->setLocale(dynamic_cast<ApplicationWindow *>(this->parent())->locale());
	widthBox->setSingleStep(0.1);
    widthBox->setRange(0, 100);
	widthBox->setValue(lm->width());
	gl1->addWidget(widthBox, 2, 1);

	startBox = new QCheckBox();
    startBox->setText( tr( "Arrow at &start" ) );
	startBox->setChecked(lm->hasStartArrow());
	gl1->addWidget(startBox, 3, 0);

	endBox = new QCheckBox();
    endBox->setText( tr( "Arrow at &end" ) );
	endBox->setChecked(lm->hasEndArrow());
	gl1->addWidget(endBox, 3, 1);
	gl1->setRowStretch(4, 1);

	gb1->setLayout(gl1);

	QHBoxLayout* hl1 = new QHBoxLayout();
    hl1->addWidget(gb1);

	options = new QWidget();
    options->setLayout(hl1);

	tw = new QTabWidget();
	tw->addTab(options, tr( "Opti&ons" ) );

    QGroupBox *gb2 = new QGroupBox();
    QGridLayout *gl2 = new QGridLayout();

    gl2->addWidget(new QLabel(tr("Length")), 0, 0);
	boxHeadLength = new QSpinBox();
	boxHeadLength->setValue(lm->headLength());
	gl2->addWidget(boxHeadLength, 0, 1);

	gl2->addWidget(new QLabel(tr( "Angle" )), 1, 0 );
	boxHeadAngle = new QSpinBox();
	boxHeadAngle->setRange(0, 85);
	boxHeadAngle->setSingleStep(5);
	boxHeadAngle->setValue(lm->headAngle());
	gl2->addWidget(boxHeadAngle, 1, 1);

	filledBox = new QCheckBox();
    filledBox->setText( tr( "&Filled" ) );
	filledBox->setChecked(lm->filledArrowHead());
	gl2->addWidget(filledBox, 2, 1);
	gl2->setRowStretch(3, 1);

	gb2->setLayout(gl2);

	QHBoxLayout* hl2 = new QHBoxLayout();
    hl2->addWidget(gb2);

    head = new QWidget();
    head->setLayout(hl2);
	tw->addTab(head, tr("Arrow &Head"));

	initGeometryTab();

	buttonDefault = new QPushButton( tr( "Set &Default" ) );
	btnApply = new QPushButton( tr( "&Apply" ) );
	btnOk = new QPushButton(tr( "&Ok" ) );
    btnOk->setDefault(true);

    QBoxLayout *bl1 = new QBoxLayout (QBoxLayout::LeftToRight);
    bl1->addStretch();
	bl1->addWidget(buttonDefault);
	bl1->addWidget(btnApply);
	bl1->addWidget(btnOk);

	QVBoxLayout* vl = new QVBoxLayout();
    vl->addWidget(tw);
	vl->addLayout(bl1);
	setLayout(vl);

	enableHeadTab();

	connect( btnOk, SIGNAL( clicked() ), this, SLOT(accept() ) );
	connect( btnApply, SIGNAL( clicked() ), this, SLOT(apply() ) );
	connect( tw, SIGNAL(currentChanged (QWidget *)), this, SLOT(enableButtonDefault(QWidget *)));
	connect( buttonDefault, SIGNAL(clicked()), this, SLOT(setDefaultValues()));
}