本文整理汇总了C++中QColorDialog::setOption方法的典型用法代码示例。如果您正苦于以下问题:C++ QColorDialog::setOption方法的具体用法?C++ QColorDialog::setOption怎么用?C++ QColorDialog::setOption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QColorDialog
的用法示例。
在下文中一共展示了QColorDialog::setOption方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: selectColor
void MadeupWindow::selectColor(const td::QVector4<float> &initial_color,
std::function<void(const QColor &)> onSelect) {
QColorDialog *picker = new QColorDialog(toQColor(initial_color), this);
picker->setOption(QColorDialog::ShowAlphaChannel);
picker->setOption(QColorDialog::NoButtons);
connect(picker, &QColorDialog::currentColorChanged, onSelect);
picker->setAttribute(Qt::WA_DeleteOnClose);
picker->show();
}
示例2: 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;
}
}
示例3: on_btMonoChromeColor_clicked
void cubeConfiguration::on_btMonoChromeColor_clicked()
{
QColorDialog *colorDialog = new QColorDialog(m_cube->getdefaultColor(), this);
colorDialog->setOption ( QColorDialog::ShowAlphaChannel);
connect(colorDialog, SIGNAL(currentColorChanged(QColor)), m_cube, SLOT(setMonoChromeColor(QColor)));
colorDialog->show();
}
示例4: 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;
}
}
示例5: pickColor
void ColorsIcon::pickColor(QPalette::ColorRole role)
{
// TODO: QColorDialog is bugged. Corrupts alpha when no adjustment occurs.
QColorDialog dlg;
dlg.setOption(QColorDialog::DontUseNativeDialog);
dlg.setOption(QColorDialog::ShowAlphaChannel);
dlg.setCurrentColor(role == QPalette::Foreground ? mPen : mBrush);
dlg.setWindowTitle(role == QPalette::Foreground ?
tr("Select pen color") :
tr("Select brush color"));
// Execute dialog
if(dlg.exec() == QDialog::Accepted) {
// Emit color change
emit colorPicked(role, dlg.currentColor());
}
}