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


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

本文整理汇总了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();
}
开发者ID:twodee,项目名称:madeup,代码行数:9,代码来源:MadeupWindow.cpp

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

示例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();
}
开发者ID:Bntdumas,项目名称:LED-matrixes-controller-programmer,代码行数:7,代码来源:cubeConfiguration.cpp

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

示例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());
   }
}
开发者ID:VojtechVitek,项目名称:spaint,代码行数:18,代码来源:colorsicon.cpp


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