当前位置: 首页>>代码示例>>C++>>正文


C++ QColorDialog::exec方法代码示例

本文整理汇总了C++中QColorDialog::exec方法的典型用法代码示例。如果您正苦于以下问题:C++ QColorDialog::exec方法的具体用法?C++ QColorDialog::exec怎么用?C++ QColorDialog::exec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QColorDialog的用法示例。


在下文中一共展示了QColorDialog::exec方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: onSelectorClicked

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;
    }
}
开发者ID:umer936,项目名称:QDriverStation,代码行数:34,代码来源:AdvancedSettings.cpp

示例2: slot_open_color_picker

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();
}
开发者ID:dcoeurjo,项目名称:appleseed,代码行数:28,代码来源:disneymateriallayerui.cpp

示例3: setNodeLabelColor

 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;
     }
 }
开发者ID:akbardotinfo,项目名称:watcher-visualization,代码行数:31,代码来源:nodeConfigurationDialog.cpp

示例4: onButtonClick

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
  }
}
开发者ID:jkammerl,项目名称:rviz,代码行数:31,代码来源:color_editor.cpp

示例5: selectComponentColor

void gNodeComponentWidget::selectComponentColor()
{
   QColorDialog w;
   if(!w.exec())return;
   QColor q = w.selectedColor();
   m_component->setColor(q.red(),q.green(),q.blue());
}
开发者ID:enriquevaquero,项目名称:Jarvis,代码行数:7,代码来源:gnodecomponentwidget.cpp

示例6: eventFilter

 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);
     }
 }
开发者ID:WizzerWorks,项目名称:QtVp,代码行数:35,代码来源:vpgriddialog.cpp

示例7: on_AddColorButton__released

	void ColorListEditorWidget::on_AddColorButton__released ()
	{
		QColorDialog dia (this);
		if (dia.exec () != QDialog::Accepted)
			return;

		AddColor (dia.selectedColor ());
	}
开发者ID:AlexWMF,项目名称:leechcraft,代码行数:8,代码来源:colorlisteditorwidget.cpp

示例8: textColor

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);
}
开发者ID:gamalielmendez,项目名称:BibliotecaImpresionSql,代码行数:10,代码来源:XYZ_TextEditor.cpp

示例9: slotClicked

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());
}
开发者ID:DrGluck,项目名称:LimeReport,代码行数:10,代码来源:lrcoloreditor.cpp

示例10: on_pushButtonBackgroundColor_clicked

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);
    }
}
开发者ID:mfs6174,项目名称:WizQTClient,代码行数:10,代码来源:wizpreferencedialog.cpp

示例11: colorDialog

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();
    }
}
开发者ID:frankyifei,项目名称:crengine-snapshot-sourceforge,代码行数:10,代码来源:settings.cpp

示例12: on_pushButtonCouleurPointsAxes_clicked

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();
}
开发者ID:lovehina13,项目名称:NumerisationDeCourbes,代码行数:11,代码来源:FenetreParametresAffichage.cpp

示例13: on_pbColor_clicked

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();
}
开发者ID:FeodorFitsner,项目名称:Joker,代码行数:11,代码来源:PeopleEditionDialog.cpp

示例14: backGroundChanged

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()));
    }
}
开发者ID:pit-le-rouge,项目名称:rolisteam,代码行数:11,代码来源:chatbrowser.cpp

示例15:

void MainWindow::on_actionSet_background_color_2_triggered()
{
    QColorDialog dialog;
    dialog.setCurrentColor(mBackgroundColor);
    int result = dialog.exec();

    if (result)
    {
        mBackgroundColor = dialog.currentColor();
    }
}
开发者ID:FlyingTarrasque,项目名称:freeablo,代码行数:11,代码来源:mainwindow.cpp


注:本文中的QColorDialog::exec方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。