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


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

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


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

示例1: pickColor

void WangColorView::pickColor()
{
    QColorDialog *colorPicker = new QColorDialog(this);
    colorPicker->setAttribute(Qt::WA_DeleteOnClose);
    colorPicker->setCurrentColor(mClickedWangColor->color());
    connect(colorPicker, &QColorDialog::colorSelected,
            this, &WangColorView::colorPicked);

    colorPicker->open();
}
开发者ID:bjorn,项目名称:tiled,代码行数:10,代码来源:wangcolorview.cpp

示例2: 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:OpenInkpot-archive,项目名称:cr3,代码行数:10,代码来源:settings.cpp

示例3: 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

示例4: 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

示例5:

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

示例6: 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

示例7: 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

示例8: mousePressEvent

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&)));
}
开发者ID:ChuckDanglars,项目名称:exposure-render.release110,代码行数:12,代码来源:Controls.cpp

示例9: showColourDialog

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();
    }

}
开发者ID:alecs1,项目名称:home,代码行数:13,代码来源:SettingsWidget.cpp

示例10: on_highlightBarColor_clicked

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);
   }
}
开发者ID:Heathcode,项目名称:nesicide,代码行数:13,代码来源:environmentsettingsdialog.cpp

示例11: slotOpenColorEditor

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;
}
开发者ID:khardix,项目名称:presquile,代码行数:13,代码来源:propertieseditoritem.cpp

示例12: ColorTest

void CustomGoalWidgetTest::ColorTest()
{
    QFETCH(QTestEventList, events);
    QFETCH(QColor, color);

    QColorDialog * dialog;

    events.simulate(m_ui->btn_Color);
    dialog = m_widget->d_ptr->colorDialog;
    QVERIFY(dialog != NULL);

    if( dialog == NULL )
        return;

    QVERIFY(QTest::qWaitForWindowActive(dialog));

    dialog->setCurrentColor(color);
    QTest::keyClick(dialog, Qt::Key_Return);

    // test cancel and button background color

    QCOMPARE(m_widget->Color(), color);
    QCOMPARE(GetBackgroundColorName(m_ui->btn_Color), color.name());

    events.simulate(m_ui->btn_Color);
    dialog = m_widget->d_ptr->colorDialog;
    QVERIFY(dialog != NULL);

    if( dialog == NULL )
        return;

    QVERIFY(QTest::qWaitForWindowActive(dialog));

    dialog->setCurrentColor(QColor(1,1,1));
    QTest::keyClick(dialog, Qt::Key_Escape);

    QCOMPARE(m_widget->Color(), color);
    QCOMPARE(GetBackgroundColorName(m_ui->btn_Color), color.name());
}
开发者ID:cosmam,项目名称:plastered-bull,代码行数:39,代码来源:customgoalwidgettest.cpp

示例13: on_styleColor_clicked

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);
   }
}
开发者ID:Heathcode,项目名称:nesicide,代码行数:14,代码来源:environmentsettingsdialog.cpp

示例14: on_backgroundColor_clicked

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);
   }
}
开发者ID:Heathcode,项目名称:nesicide,代码行数:14,代码来源:environmentsettingsdialog.cpp

示例15: QColorDialog

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()));
}
开发者ID:louiseichhorst,项目名称:mne-cpp,代码行数:15,代码来源:control3dwidget.cpp


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