本文整理汇总了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();
}
示例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();
}
}
示例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());
}
示例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);
}
}
示例5:
void MainWindow::on_actionSet_background_color_2_triggered()
{
QColorDialog dialog;
dialog.setCurrentColor(mBackgroundColor);
int result = dialog.exec();
if (result)
{
mBackgroundColor = dialog.currentColor();
}
}
示例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()));
}
}
示例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();
}
示例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&)));
}
示例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();
}
}
示例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);
}
}
示例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;
}
示例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());
}
示例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);
}
}
示例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);
}
}
示例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()));
}