Exemplo n.º 1
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    if(initalized==false){
        QPalette Pal(palette());
        initalized=true;
        Pal.setColor(QPalette::Background, defaultcolor);
        ui->color_display->setAutoFillBackground(true);
        ui->color_display->setPalette(Pal);
    }

    //connect

    //display to control
    //QObject::connect(ui->AngleInput,SIGNAL(textChanged(QString)),ui->openGLWidget,SLOT(changeAngle(QString)));
    QObject::connect(ui->openGLWidget,SIGNAL(axiomRead(QString)),ui->Axiom,SLOT(setText(QString)));
    QObject::connect(ui->openGLWidget,SIGNAL(angleRead(QString)),ui->AngleInput,SLOT(setText(QString)));
    QObject::connect(ui->openGLWidget,SIGNAL(RuleRead(QString)),ui->RuleDIsplay,SLOT(setPlainText(QString)));
    QObject::connect(ui->openGLWidget,SIGNAL(iterationRead(int)),ui->Iteration_spinBox,SLOT(setValue(int)));
    QObject::connect(ui->openGLWidget,SIGNAL(RuleCalculated(QString)),ui->L_systemResult,SLOT(setPlainText(QString)));
    //control to display
    QObject::connect(ui->Axiom,SIGNAL(textEdited(QString)),ui->openGLWidget,SLOT(changeAxiom(QString)));
    QObject::connect(ui->AngleInput,SIGNAL(textEdited(QString)),ui->openGLWidget,SLOT(changeAngle(QString)));
    QObject::connect(ui->Iteration_spinBox,SIGNAL(valueChanged(int)),ui->openGLWidget,SLOT(changeIteration(int)));
    QObject::connect(ui->foceUpdateButton,SIGNAL(pressed()),ui->openGLWidget,SLOT(UpdateL_system()));
    QObject::connect(ui->FileSelector,SIGNAL(currentTextChanged(QString)),ui->openGLWidget,SLOT(ChangeTemplate(QString)));
    QObject::connect(ui->foceUpdateButton,SIGNAL(pressed()),ui->openGLWidget,SLOT(setFocus()));
    QObject::connect(this,SIGNAL(ColorChange(QColor)),ui->openGLWidget,SLOT(getChangedColor(QColor)));
    //this->setAttribute(Qt::WA_TranslucentBackground, true);
}
Exemplo n.º 2
0
void ColorSelector::setColorWithSignal(const Color& color)
{
  setColor(color, ChangeType);

  // Fire ColorChange signal
  ColorChange(color);
}
Exemplo n.º 3
0
void SColorGradientEditor::OnSelectedStopColorChanged( FLinearColor InNewColor )
{
	FScopedTransaction ColorChange( LOCTEXT("ChangeGradientStopColor", "Change Gradient Stop Color") );
	SelectedStop.SetColor( InNewColor, *CurveOwner );
	CurveOwner->ModifyOwner();

	// Set the the last edited color.  The next time a new stop is added we'll use this value
	LastModifiedColor.R = InNewColor.R;
	LastModifiedColor.G = InNewColor.G;
	LastModifiedColor.B = InNewColor.B;
}
Exemplo n.º 4
0
void MainWindow::on_ColorSelector_clicked()
{
    QColor colorcache=defaultcolor;
    defaultcolor=QColorDialog::getColor(defaultcolor, this);
    if(colorcache!=defaultcolor){
        emit ColorChange(defaultcolor);
    }
    QPalette Pal(palette());
    initalized=true;
    Pal.setColor(QPalette::Background, defaultcolor);
    ui->color_display->setAutoFillBackground(true);
    ui->color_display->setPalette(Pal);
    ui->openGLWidget->setFocus();
}
Exemplo n.º 5
0
void HexColorEntry::onEntryChange()
{
  std::string text = m_entry.getText();
  int r, g, b;

  // Fill with zeros at the end of the text
  while (text.size() < 6)
    text.push_back('0');

  // Convert text (Base 16) to integer
  int hex = std::strtol(text.c_str(), NULL, 16);

  r = (hex & 0xff0000) >> 16;
  g = (hex & 0xff00) >> 8;
  b = (hex & 0xff);

  ColorChange(Color::fromRgb(r, g, b));
}
Exemplo n.º 6
0
void HexColorEntry::onEntryChange()
{
  std::string text = m_entry.getText();
  int r, g, b;

  // Remove non hex digits
  while (text.size() > 0 && !is_hex_digit(text[0]))
    text.erase(0, 1);

  // Fill with zeros at the end of the text
  while (text.size() < 6)
    text.push_back('0');

  // Convert text (Base 16) to integer
  int hex = std::strtol(text.c_str(), NULL, 16);

  r = (hex & 0xff0000) >> 16;
  g = (hex & 0xff00) >> 8;
  b = (hex & 0xff);

  ColorChange(app::Color::fromRgb(r, g, b));
}