本文整理汇总了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;
}
}
示例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();
}
示例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;
}
}
示例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
}
}
示例5: selectComponentColor
void gNodeComponentWidget::selectComponentColor()
{
QColorDialog w;
if(!w.exec())return;
QColor q = w.selectedColor();
m_component->setColor(q.red(),q.green(),q.blue());
}
示例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);
}
}
示例7: on_AddColorButton__released
void ColorListEditorWidget::on_AddColorButton__released ()
{
QColorDialog dia (this);
if (dia.exec () != QDialog::Accepted)
return;
AddColor (dia.selectedColor ());
}
示例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);
}
示例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());
}
示例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);
}
}
示例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();
}
}
示例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();
}
示例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();
}
示例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()));
}
}
示例15:
void MainWindow::on_actionSet_background_color_2_triggered()
{
QColorDialog dialog;
dialog.setCurrentColor(mBackgroundColor);
int result = dialog.exec();
if (result)
{
mBackgroundColor = dialog.currentColor();
}
}