ribi::QtToolSurfacePlotterMainDialog::QtToolSurfacePlotterMainDialog(QWidget *parent)
  : QtHideAndShowDialog(parent),
    ui(new Ui::QtToolSurfacePlotterMainDialog)
{
  #ifndef NDEBUG
  Test();
  #endif
  ui->setupUi(this);

  #ifndef NDEBUG
  assert(Rescale(2.0,1.0,5.0,0.0,100.0) >= 24.9999 && Rescale(2.0,1.0,5.0,0.0,100.0) < 25.0001);
  #endif

  QObject::connect(this->ui->edit_equation,SIGNAL(textChanged(QString)),this,SLOT(OnAnyChange()));
  QObject::connect(this->ui->edit_minx,SIGNAL(textChanged(QString)),this,SLOT(OnAnyChange()));
  QObject::connect(this->ui->edit_miny,SIGNAL(textChanged(QString)),this,SLOT(OnAnyChange()));
  QObject::connect(this->ui->edit_maxx,SIGNAL(textChanged(QString)),this,SLOT(OnAnyChange()));
  QObject::connect(this->ui->edit_maxy,SIGNAL(textChanged(QString)),this,SLOT(OnAnyChange()));


  ui->edit_minx->setText(boost::lexical_cast<std::string>(-1.0).c_str());
  ui->edit_miny->setText(boost::lexical_cast<std::string>(-1.0).c_str());
  ui->edit_maxx->setText(boost::lexical_cast<std::string>( 1.0).c_str());
  ui->edit_maxy->setText(boost::lexical_cast<std::string>( 1.0).c_str());

  ui->edit_equation->setText("cos(x*y*100)");

  {
    //Put the dialog in the screen center at 50% x 50% of its size
    const QRect screen = QApplication::desktop()->screenGeometry();
    this->setGeometry(0,0,screen.width() / 2,screen.height() /2 );
    this->move( screen.center() - this->rect().center() );
  }
}
ribi::QtTestPlaneInvestigateAccuracyRibiDialog::QtTestPlaneInvestigateAccuracyRibiDialog(QWidget *parent)
  : QtHideAndShowDialog(parent),
    ui(new Ui::QtTestPlaneInvestigateAccuracyRibiDialog),
    m_widget_x(new QtSurfacePlotWidget),
    m_widget_y(new QtSurfacePlotWidget),
    m_widget_z(new QtSurfacePlotWidget)
{
  #ifndef NDEBUG
  Test();
  #endif
  ui->setupUi(this);

  {
    assert(!ui->widget_plane_x->layout());
    QGridLayout * const my_layout = new QGridLayout;
    ui->widget_plane_x->setLayout(my_layout);
    assert(ui->widget_plane_x->layout());
    my_layout->addWidget(m_widget_x.get());
  }

  {
    assert(!ui->widget_plane_y->layout());
    QGridLayout * const my_layout = new QGridLayout;
    ui->widget_plane_y->setLayout(my_layout);
    assert(ui->widget_plane_y->layout());
    my_layout->addWidget(m_widget_y.get());
  }

  {
    assert(!ui->widget_plane_z->layout());
    QGridLayout * const my_layout = new QGridLayout;
    ui->widget_plane_z->setLayout(my_layout);
    assert(ui->widget_plane_z->layout());
    my_layout->addWidget(m_widget_z.get());
  }

  ui->edit_minx->setText(boost::lexical_cast<std::string>(-1.0).c_str());
  ui->edit_miny->setText(boost::lexical_cast<std::string>(-1.0).c_str());
  ui->edit_maxx->setText(boost::lexical_cast<std::string>( 1.0).c_str());
  ui->edit_maxy->setText(boost::lexical_cast<std::string>( 1.0).c_str());

  QObject::connect(this->ui->edit_minx,static_cast<void (QLineEdit::*)(const QString&)>(&QLineEdit::textChanged),this,&ribi::QtTestPlaneInvestigateAccuracyRibiDialog::OnAnyChange);
  QObject::connect(this->ui->edit_miny,static_cast<void (QLineEdit::*)(const QString&)>(&QLineEdit::textChanged),this,&ribi::QtTestPlaneInvestigateAccuracyRibiDialog::OnAnyChange);
  QObject::connect(this->ui->edit_maxx,static_cast<void (QLineEdit::*)(const QString&)>(&QLineEdit::textChanged),this,&ribi::QtTestPlaneInvestigateAccuracyRibiDialog::OnAnyChange);
  QObject::connect(this->ui->edit_maxy,static_cast<void (QLineEdit::*)(const QString&)>(&QLineEdit::textChanged),this,&ribi::QtTestPlaneInvestigateAccuracyRibiDialog::OnAnyChange);

  QObject::connect(this->ui->box_x1,static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),this,&ribi::QtTestPlaneInvestigateAccuracyRibiDialog::OnAnyChange);
  QObject::connect(this->ui->box_y1,static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),this,&ribi::QtTestPlaneInvestigateAccuracyRibiDialog::OnAnyChange);
  QObject::connect(this->ui->box_z1,static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),this,&ribi::QtTestPlaneInvestigateAccuracyRibiDialog::OnAnyChange);
  QObject::connect(this->ui->box_x2,static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),this,&ribi::QtTestPlaneInvestigateAccuracyRibiDialog::OnAnyChange);
  QObject::connect(this->ui->box_y2,static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),this,&ribi::QtTestPlaneInvestigateAccuracyRibiDialog::OnAnyChange);
  QObject::connect(this->ui->box_z2,static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),this,&ribi::QtTestPlaneInvestigateAccuracyRibiDialog::OnAnyChange);
  QObject::connect(this->ui->box_x3,static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),this,&ribi::QtTestPlaneInvestigateAccuracyRibiDialog::OnAnyChange);
  QObject::connect(this->ui->box_y3,static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),this,&ribi::QtTestPlaneInvestigateAccuracyRibiDialog::OnAnyChange);
  QObject::connect(this->ui->box_z3,static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),this,&ribi::QtTestPlaneInvestigateAccuracyRibiDialog::OnAnyChange);

  OnAnyChange();
}
void ribi::QtAsciiArterMainDialog::on_button_load_clicked()
{
  const std::string filename = QFileDialog::getOpenFileName().toStdString();

  if (!fileio::IsRegularFile(filename))
  {
    m_filename = "";
    return;
  }
  m_filename = filename;
  OnAnyChange();
}
void ribi::QtImageRotaterMainDialog::on_button_load_clicked()
{
  const std::string filename {
    QFileDialog::getOpenFileName(0,"Please select a file").toStdString()
  };
  if (filename.empty()) return;

  //Check if the pixmap is valid
  const QImage image(filename.c_str());
  if (image.isNull()) return;
  m_source = image;
  OnAnyChange();
}
ribi::QtImageRotaterMainDialog::QtImageRotaterMainDialog(QWidget *parent)
  : QtHideAndShowDialog(parent),
    ui(new Ui::QtImageRotaterMainDialog),
    m_source(":/imagerotater/images/ImageRotaterTest.png"),
    m_target(nullptr)
{
  #ifndef NDEBUG
  Test();
  #endif
  ui->setupUi(this);
  assert(!m_source.isNull());
  OnAnyChange();
}
void ribi::WtAsciiArterMainDialog::OnEditWidthChange()
{
  try
  {
    const std::string s = ui.m_edit_width->text().toUTF8();
    m_n_cols = boost::lexical_cast<int>(s);
  }
  catch(boost::bad_lexical_cast&)
  {
    //No problem
  }

  OnAnyChange();
}
//---------------------------------------------------------------------------
///QtTestNewickVectorDialog constructor performs most Newick tests
QtTestNewickVectorDialog::QtTestNewickVectorDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::QtTestNewickVectorDialog),
    m_timer(new QTimer),
    m_dialog(new TestNewickVectorDialog)
{
  ui->setupUi(this);
  QObject::connect(
    ui->edit_newick,SIGNAL(textChanged(QString)),
    this,SLOT(OnAnyChange()));
  QObject::connect(
    ui->edit_theta,SIGNAL(textChanged(QString)),
    this,SLOT(OnAnyChange()));
  QObject::connect(
    ui->edit_max_complexity,SIGNAL(textChanged(QString)),
    this,SLOT(OnAnyChange()));
  QObject::connect(
    ui->box_show_calculation,SIGNAL(clicked()),
    this,SLOT(OnAnyChange()));
  QObject::connect(
    ui->box_compare,SIGNAL(clicked()),
    this,SLOT(OnAnyChange()));


  QObject::connect(
    m_timer,SIGNAL(timeout()),
    this,SLOT(OnDemoTick()));

  #ifndef NDEBUG
  setWindowTitle(windowTitle()+" (debug)");
  #else
  setWindowTitle(windowTitle()+" (release)");
  #endif

  this->OnAnyChange();
}
void ribi::QtTestPlaneInvestigateAccuracyRibiDialog::resizeEvent(QResizeEvent *)
{
  OnAnyChange();
}
示例#9
0
		virtual void OnAnyChange(wxStyledTextEvent& event) { OnAnyChange(); event.Skip(); }
void ribi::QtImageRotaterMainDialog::on_dial_angle_sliderMoved(int )
{
  OnAnyChange();
}
void ribi::WtAsciiArterMainDialog::OnUploadDone()
{
  const std::string filename = ui.m_fileupload->spoolFileName();
  m_filename = filename;
  OnAnyChange();
}
void ribi::QtToolSurfacePlotterMainDialog::resizeEvent(QResizeEvent *)
{
  OnAnyChange();
}
void ribi::QtAsciiArterMainDialog::on_box_width_valueChanged(int)
{
  OnAnyChange();
}
ribi::QtFunctionPlotterMainDialog::QtFunctionPlotterMainDialog(QWidget *parent)
  : QtHideAndShowDialog(parent),
    ui(new Ui::QtFunctionPlotterMainDialog),
    m_curve(new QwtPlotCurve),
    m_plot(new QwtPlot)
{
  #ifndef NDEBUG
  Test();
  #endif
  ui->setupUi(this);

  //Create plot
  {
    assert(!ui->plot_contents->layout());
    QGridLayout * const layout = new QGridLayout;
    ui->plot_contents->setLayout(layout);

    layout->addWidget(m_plot);

    #ifdef _WIN32
    m_plot->setCanvasBackground(QBrush(QColor(255,255,255)));
    #else
    m_plot->setCanvasBackground(QColor(255,255,255));
    #endif

    m_curve->attach(m_plot);
    m_curve->setStyle(QwtPlotCurve::Lines);
    m_curve->setPen(QPen(QColor(128,128,128)));
  }

  QObject::connect(
    this->ui->edit_equation,
    &QLineEdit::textChanged,
    this,
    &ribi::QtFunctionPlotterMainDialog::OnAnyChange
  );
  QObject::connect(
    this->ui->box_minx,
    SIGNAL(valueChanged(QString)),
    this,
    SLOT(OnAnyChange())
  );
  QObject::connect(
    this->ui->box_maxx,
    SIGNAL(valueChanged(QString)),
    this,
    SLOT(OnAnyChange())
  );


  ui->box_minx->setValue(-1.0);
  ui->box_maxx->setValue(1.0);

  ui->edit_equation->setText("cos(x)");


  {
    //Put the dialog in the screen center at 50% x 50% of its size
    const QRect screen = QApplication::desktop()->screenGeometry();
    this->setGeometry(0,0,screen.width() / 2,screen.height() /2 );
    this->move( screen.center() - this->rect().center() );
  }
}
void ribi::QtFunctionPlotterMainDialog::resizeEvent(QResizeEvent *)
{
  OnAnyChange();
}