コード例 #1
0
void AdvancedSettings::onSelectorClicked()
{
    int emitter = getEmitter (QObject::sender());

    /* Configure the color dialog */
    QString color;
    QColorDialog dialog;
    dialog.setCurrentColor (getColor (emitter));
    dialog.setOption (QColorDialog::DontUseNativeDialog);

    /* Get new color */
    if (dialog.exec() == QColorDialog::Accepted)
        color = QVariant (dialog.currentColor()).toString();

    /* User clicked the 'Cancel' button in the color dialog */
    else
        return;

    /* Update the line edit that matches the button that called this function */
    switch (emitter) {
    case Base:
        ui.BaseEdit->setText (color);
        break;
    case Highlight:
        ui.HighlightEdit->setText (color);
        break;
    case Background:
        ui.BackgroundEdit->setText (color);
        break;
    case Foreground:
        ui.ForegroundEdit->setText (color);
        break;
    }
}
コード例 #2
0
void DisneyMaterialLayerUI::slot_open_color_picker(const QString& widget_name)
{
    IInputWidgetProxy* widget_proxy = m_widget_proxies.get(widget_name.toStdString());

    const string color_expression = widget_proxy->get();
    const QColor initial_color = ColorExpressionProxy::expression_to_qcolor(widget_proxy->get());

    QColorDialog* dialog = new QColorDialog(initial_color, m_content_widget);
    dialog->setWindowTitle("Pick Color");
    dialog->setOptions(QColorDialog::DontUseNativeDialog);

    ForwardColorChangedSignal* forward_signal =
        new ForwardColorChangedSignal(dialog, widget_name, initial_color);
    connect(
        dialog, SIGNAL(currentColorChanged(const QColor&)),
        forward_signal, SLOT(slot_color_changed(const QColor&)));
    connect(
        forward_signal, SIGNAL(signal_color_changed(const QString&, const QColor&)),
        SLOT(slot_color_changed(const QString&, const QColor&)));
    connect(
        dialog, SIGNAL(rejected()),
        forward_signal, SLOT(slot_color_reset()));
    connect(
        forward_signal, SIGNAL(signal_color_reset(const QString&, const QColor&)),
        SLOT(slot_color_changed(const QString&, const QColor&)));

    dialog->exec();
}
コード例 #3
0
 void NodeConfigurationDialog::setNodeLabelColor(void)
 {
     if (!graph)
         return;
     if (!graph->numValidNodes) {
         QMessageBox::information(this, tr("A Serious Lack of Nodes"), tr("No nodes to configure yet, sorry.")); 
         return; 
     }
     QColor clr(
             graph->nodes[0].labelColor.r, 
             graph->nodes[0].labelColor.g, 
             graph->nodes[0].labelColor.b, 
             graph->nodes[0].labelColor.a);
     QColorDialog *d = new QColorDialog(clr, this);
     d->setOption(QColorDialog::ShowAlphaChannel, true); 
     d->exec();
     if (QDialog::Accepted==d->result()) {
         clr=d->currentColor();
         watcher::Color c(clr.red(), clr.green(), clr.blue(), clr.alpha()); 
         QString ss;
         ss.sprintf("background-color: #%02x%02x%02x; color: #%02x%02x%02x", 
                 clr.red(), clr.green(), clr.blue(), 
                 (~clr.red())&0xFF, (~clr.green())&0xFF, (~clr.blue())&0xFF);  
         labelColorButton->setStyleSheet(ss); 
         if (useNodeId)
             graph->nodes[curNodeId].labelColor=c;
         else
             for (size_t n=0; n<graph->numValidNodes; n++) 
                 graph->nodes[n].labelColor=c;
     }
 }
コード例 #4
0
ファイル: color_editor.cpp プロジェクト: jkammerl/rviz
void ColorEditor::onButtonClick()
{
  // On OSX, once the dialog opens, the tree view loses focus and thus
  // this editor is destroyed.  Therefore everything we do in this
  // function after dialog->exec() should only use variables on the
  // stack, not member variables.

  ColorProperty* prop = property_;
  QColor original_color = prop->getColor();

  QColorDialog* dialog = new QColorDialog( color_, this );

  // On Linux these two connections are redundant, because the editor
  // lives while the dialog is up.  This should not hurt anything,
  // just be slightly inefficient.  On OSX, only the connection to the
  // Property will exist because this editor will be destroyed.

  connect( dialog, SIGNAL( currentColorChanged( const QColor& )),
           property_, SLOT( setColor( const QColor& )));
  connect( dialog, SIGNAL( currentColorChanged( const QColor& )),
           this, SLOT( setColor( const QColor& )));

  if( dialog->exec() != QDialog::Accepted )
  {
#ifdef Q_OS_MAC
    prop->setColor( original_color );
#else
    setColor( original_color );
#endif
  }
}
コード例 #5
0
void gNodeComponentWidget::selectComponentColor()
{
   QColorDialog w;
   if(!w.exec())return;
   QColor q = w.selectedColor();
   m_component->setColor(q.red(),q.green(),q.blue());
}
コード例 #6
0
ファイル: vpgriddialog.cpp プロジェクト: WizzerWorks/QtVp
 bool VpGridDialog::eventFilter(QObject *obj, QEvent *ev)
 {
     if ((obj == m_ui->colorWell) || (obj == m_ui->referenceColorWell))
     {
         if (ev->type() == QEvent::MouseButtonRelease)
         {
             //QMouseEvent *event = static_cast<QMouseEvent*>(ev);
             QColorDialog *colorDialog = new QColorDialog();
             if (obj == m_ui->colorWell)
                 // Modify grid color.
                 colorDialog->setCurrentColor(getColor());
             else
                 // Modify reference color.
                 colorDialog->setCurrentColor(getReferenceColor());
             int retValue = colorDialog->exec();
             if (retValue == QDialog::Accepted)
             {
                 QColor selectedColor = colorDialog->currentColor();
                 if (obj == m_ui->colorWell)
                     // Modify grid color.
                     setColor(selectedColor);
                 else
                     // Modify reference color.
                     setReferenceColor(selectedColor);
             }
             delete colorDialog;
             return true;
         } else {
             return false;
         }
     } else {
         // Pass the event on to the parent class.
         return QDialog::eventFilter(obj, ev);
     }
 }
コード例 #7
0
	void ColorListEditorWidget::on_AddColorButton__released ()
	{
		QColorDialog dia (this);
		if (dia.exec () != QDialog::Accepted)
			return;

		AddColor (dia.selectedColor ());
	}
コード例 #8
0
void XYZTextEditor::textColor() {
    QColor color;
    QColorDialog *dlg = new QColorDialog(this);
    if (dlg->exec() == QDialog::Accepted) {
        color = dlg->selectedColor();
    } else return;
    QTextCharFormat fmt;
    fmt.setForeground( QBrush( color ) );
    mergeFormatOnWordOrSelection(fmt);
}
コード例 #9
0
ファイル: lrcoloreditor.cpp プロジェクト: DrGluck/LimeReport
void ColorEditor::slotClicked()
{
    m_buttonPressed = true;
    QColorDialog* dialog = new QColorDialog(this);
    dialog->setCurrentColor(m_color);
    if (dialog->exec()) m_color=dialog->currentColor();
    delete dialog;
    setFocusToParent();
    emit(editingFinished());
}
コード例 #10
0
void CWizPreferenceWindow::on_pushButtonBackgroundColor_clicked()
{
    QColorDialog dlg;
    dlg.setCurrentColor(m_app.userSettings().editorBackgroundColor());
    if (dlg.exec() == QDialog::Accepted)
    {
        QString strColor = dlg.currentColor().name();
        updateEditorBackgroundColor(strColor);
    }
}
コード例 #11
0
void SettingsDlg::colorDialog( const char * optionName, QString title )
{
    QColorDialog dlg;
    dlg.setWindowTitle(title);
    dlg.setCurrentColor( getColor( optionName, 0x000000 ) );
    if ( dlg.exec() == QDialog::Accepted ) {
        setColor( optionName, dlg.currentColor() );
        updateStyleSample();
    }
}
コード例 #12
0
void FenetreParametresAffichage::on_pushButtonCouleurPointsAxes_clicked()
{
    ParametresPoint parametresPointsAxes = this->parametresAffichage.getParametresPointsAxes();
    QColorDialog* fenetreCouleurPointsAxes = new QColorDialog(
            QColor(parametresPointsAxes.getCouleurPoint()), this);
    if (fenetreCouleurPointsAxes->exec() == QColorDialog::Rejected)
        return;
    parametresPointsAxes.setCouleurPoint(fenetreCouleurPointsAxes->selectedColor().rgb());
    this->parametresAffichage.setParametresPointsAxes(parametresPointsAxes);
    this->actualiserElementsGraphiques();
}
コード例 #13
0
void PeopleEditionDialog::on_pbColor_clicked()
{
	QColorDialog dlg;
	// Setting the selected color to the character's one
	dlg.setCurrentColor(QColor(_people->color()));

	// Connecting slot
	connect(&dlg, SIGNAL(currentColorChanged(QColor)), this, SLOT(OnColorSelected(QColor)));

	dlg.exec();
}
コード例 #14
0
void ChatBrowser::backGroundChanged()
{
    QColorDialog dialog;
    dialog.setCurrentColor(m_bgColor);

    if(dialog.exec()==QDialog::Accepted)
    {
        m_bgColor=dialog.currentColor();
        setStyleSheet(QString("QTextBrowser { background:%1;}").arg(m_bgColor.name()));
    }
}
コード例 #15
0
void MainWindow::on_actionSet_background_color_2_triggered()
{
    QColorDialog dialog;
    dialog.setCurrentColor(mBackgroundColor);
    int result = dialog.exec();

    if (result)
    {
        mBackgroundColor = dialog.currentColor();
    }
}
コード例 #16
0
void PageSettingDlg::selectColor() {
    QColor color;
    QColorDialog *dlg = new QColorDialog(color, this);
    if (dlg->exec() == QDialog::Accepted) {
        color = dlg->selectedColor();
    } else return;

    strColor = colorToString(color);
    pageSetting.borderColor = strColor;
    ui->lblBorderColor->setStyleSheet("QLabel {background-color: "+strColor+"}");
}
コード例 #17
0
void QColorPushButton::mousePressEvent(QMouseEvent* pEvent)
{
	QColorDialog ColorDialog;

	connect(&ColorDialog, SIGNAL(currentColorChanged(const QColor&)), this, SLOT(OnCurrentColorChanged(const QColor&)));

	ColorDialog.setWindowIcon(GetIcon("color--pencil"));
	ColorDialog.setCurrentColor(m_Color);
	ColorDialog.exec();

	disconnect(&ColorDialog, SIGNAL(currentColorChanged(const QColor&)), this, SLOT(OnCurrentColorChanged(const QColor&)));
}
コード例 #18
0
ファイル: settingswindow.cpp プロジェクト: Reemjd/genius
void SettingsWindow::on_textColorChangeButton_clicked()
{
  QColorDialog dialog;
  dialog.setWindowTitle("select a color for selector items text");
  if(dialog.exec())
  {
    QColor color=dialog.selectedColor();
    QString name=color.name();
    ui->textColorPreview->setStyleSheet("QLabel{\n	background:"+name+";\n background-repeat: repeat-y;\n  background-position: left;\n}");
    ui->textColorPreview->setText(name);
  }
}
コード例 #19
0
void EnvironmentSettingsDialog::on_highlightBarColor_clicked()
{
   QSettings settings(QSettings::IniFormat, QSettings::UserScope, "CSPSoftware", "NESICIDE");
   QColorDialog dlg;

   dlg.setCurrentColor(m_highlightBarColor);

   if (dlg.exec() == QColorDialog::Accepted)
   {
      m_highlightBarColor = dlg.selectedColor();
      m_scintilla->setMarkerBackgroundColor(m_highlightBarColor,Marker_Highlight);
   }
}
コード例 #20
0
ファイル: SettingsWidget.cpp プロジェクト: alecs1/home
void SettingsWidget::showColourDialog() {
    QColorDialog colorDialog;
    colorDialog.setCurrentColor(settings.tableColour);

    if (colorDialog.exec() == QDialog::Accepted) {
        QColor colour = colorDialog.selectedColor();
        settings.tableColour = colour.name();
        QString colourStyleSheet = "background-color: " + colour.name() + ";";
        ui->colourButton->setStyleSheet(colourStyleSheet);
        applySettings();
    }

}
コード例 #21
0
void PropertiesEditorItem::slotOpenColorEditor()
{
    QColorDialog *dialog = new QColorDialog(parent());
    dialog->setCurrentColor(mProperty.read(mObject.data()).value<QColor>());
    if (dialog->exec() == QDialog::Accepted) {
        mProperty.write(mObject.data(), QVariant::fromValue(dialog->currentColor()));

        QPushButton *button = qobject_cast<QPushButton*>(mWidget.data());
        button->setText(dialog->currentColor().name());
    }

    delete dialog;
}
コード例 #22
0
void EnvironmentSettingsDialog::on_backgroundColor_clicked()
{
   QSettings settings(QSettings::IniFormat, QSettings::UserScope, "CSPSoftware", "NESICIDE");
   QColorDialog dlg;

   dlg.setCurrentColor(m_lexer->defaultPaper());

   if (dlg.exec() == QColorDialog::Accepted)
   {
      QColor chosenColor = dlg.selectedColor();
      m_lexer->setDefaultPaper(chosenColor);
      m_lexer->setPaper(chosenColor,-1);
   }
}
コード例 #23
0
void EnvironmentSettingsDialog::on_styleColor_clicked()
{
   QSettings settings(QSettings::IniFormat, QSettings::UserScope, "CSPSoftware", "NESICIDE");
   QColorDialog dlg;
   int style = ui->styleName->itemData(ui->styleName->currentIndex()).toInt();

   dlg.setCurrentColor(m_lexer->color(style));

   if (dlg.exec() == QColorDialog::Accepted)
   {
      QColor chosenColor = dlg.selectedColor();
      m_lexer->setColor(chosenColor,style);
   }
}
コード例 #24
0
void Control3DWidget::onLightColorPicker()
{
    QColorDialog* pDialog = new QColorDialog(this);
    pDialog->setCurrentColor(m_colCurrentLightColor);

    //Update all connected View3D's scene colors
    connect(pDialog, &QColorDialog::currentColorChanged,
            this, &Control3DWidget::onLightColorChanged);

    pDialog->exec();
    m_colCurrentLightColor = pDialog->currentColor();

    //Set color of button new new scene color
    ui->m_pushButton_lightColorPicker->setStyleSheet(QString("background-color: rgb(%1, %2, %3);").arg(m_colCurrentLightColor.red()).arg(m_colCurrentLightColor.green()).arg(m_colCurrentLightColor.blue()));
}
コード例 #25
0
void CDialogIrcSettings::on_toolButtonChangeColorLink_clicked()
{
	QColorDialog* dlgColor = new QColorDialog( this );
	dlgColor->setCurrentColor( m_ColorLink );

	int result = dlgColor->exec();

	if ( result == QDialog::Accepted )
	{
		m_ColorLink = dlgColor->currentColor();
		ui->labelColorLink->setStyleSheet( QString( "background-color: %1;" ).arg( m_ColorLink.name() ) );

		ui->pushButtonApply->setEnabled( true );
	}
}
コード例 #26
0
void QReportPropertyPageLineType::on_pushButtonSelectColor_clicked()
{
   QColorDialog *dlg = new QColorDialog();
   dlg->exec();

   QPalette palette;
   QBrush brush( dlg->currentColor() );
   brush.setStyle(Qt::SolidPattern);
   palette.setBrush(QPalette::Active, QPalette::Base, brush);
   palette.setBrush(QPalette::Inactive, QPalette::Base, brush);

   textBrowserColorBox->setPalette(palette);

   //textBrowserColorBox->palette().setColor( QPalette::Base, dlg->currentColor() );
}
コード例 #27
0
ファイル: ColorButton.cpp プロジェクト: Atarity/Lightpack
void ColorButton::click()
{
    QColorDialog * dialog = new QColorDialog(this);
    dialog->setWindowFlags(Qt::Window
                          | Qt::WindowStaysOnTopHint
                          | Qt::CustomizeWindowHint
                          | Qt::WindowCloseButtonHint);

    QColor savedColor = getColor();
    connect(dialog, SIGNAL(currentColorChanged(QColor)), this, SLOT(currentColorChanged(QColor)));
    dialog->setCurrentColor(getColor());
    if (dialog->exec() != QDialog::Accepted)
        setColor(savedColor);
    delete dialog;
}
コード例 #28
0
void ListItemSettingsEditor::selectColor()
{
    QColorDialog dialog;
    if (dialog.exec()) {
        QColor color = dialog.selectedColor();
        QString senderName = sender()->objectName();
        if ("textColorToolButton" == senderName) {
            m_listitem->setTextColor(color);
            ui->textColorLineEdit->setText(color.name(QColor::HexRgb));
        } else if ("backgroundColorToolButton" == senderName) {
            m_listitem->setBackgroundColor(color);
            ui->backgroundColorLineEdit->setText(color.name(QColor::HexRgb));
        }
    }
    setupForm();
}
コード例 #29
0
void QConsoleWidgetPrivate::
selectAndSetFontColor() {

	auto color_ = 
		this->textCharFormat.foreground().color();

	QColorDialog * dialog = new QColorDialog(color_);
	if (dialog->exec()) {
		color_ = dialog->selectedColor();
		this->textCharFormat.setForeground(color_);
		super->updateCharFormat();
	}
	
	dialog->deleteLater();
	 
}
コード例 #30
0
void ApplicationPreferencesDialog::colorToolButtonClicked()
{
    QToolButton *toolButton = dynamic_cast< QToolButton * >(sender());
    assert(toolButton);
    QColorDialog colorDlg;
    int result = colorDlg.exec();
    QColor selectedColor;
    if(result == QDialog::Accepted)
    {
        selectedColor = colorDlg.selectedColor();
        QPixmap pixmap(20, 20);
        pixmap.fill(selectedColor);
        toolButton->setIcon(pixmap);
        if(toolButton == ui->ui_unconnectedRailsToolButton)
        {
            m_unconnectedRailsColor = selectedColor;
        }
        else if(toolButton == ui->ui_connectedRailsToolButton)
        {
            m_connectedRailsColor = selectedColor;
        }
        else if(toolButton == ui->ui_systemFunctionToolButton)
        {
            m_systemFunctionColor = selectedColor;
        }
        else if(toolButton == ui->ui_functionNamesToolButton)
        {
            m_functionNamesColor = selectedColor;
        }
        else if(toolButton == ui->ui_functionCallsToolButton)
        {
            m_functionCallsColor = selectedColor;
        }
        else if(toolButton == ui->ui_stringsToolButton)
        {
            m_stringsColor = selectedColor;
        }
        else if(toolButton == ui->ui_variablesToolButton)
        {
            m_variablesColor = selectedColor;
        }
        else if(toolButton == ui->ui_grabbedTextToolButton)
        {
            m_grabbedTextColor = selectedColor;
        }
    }
}