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


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

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


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

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

示例2: onForegroundColourClicked

/**
Handler for changing the foreground colour of an integrated peak.
*/
void PeaksWorkspaceWidget::onForegroundColourClicked() {
  QColorDialog colourDlg;
  colourDlg.result();
  QColor selectedColour = colourDlg.getColor();
  if (selectedColour.isValid()) {
    ui.btnPeakColor->setBackgroundColor(selectedColour);
    emit peakColourChanged(this->m_ws, selectedColour);
  }
}
开发者ID:spaceyatom,项目名称:mantid,代码行数:12,代码来源:PeaksWorkspaceWidget.cpp

示例3: setModelData

//--------------------------------------------------------------------------------------
void RMapObjectTableViewDelegate::setModelData(QWidget *editor,
                                               QAbstractItemModel *model,
                                               const QModelIndex &index) const
{   
    switch (index.data(Qt::UserRole).toInt()) {
    case RMapObjectModel::ET_COLOR_SELECTOR: {
        QColorDialog *colorbox = static_cast<QColorDialog *>(editor);
        if (colorbox->result() == QDialog::Accepted) {
            QColor color = colorbox->currentColor();
            model->setData(index, color, Qt::EditRole);
        }
        break;
    }

    case RMapObjectModel::ET_FONT_SELECTOR: {
        RFontSelectorDialog *fontSelector = static_cast<RFontSelectorDialog *>(editor);
        if (fontSelector->result() == QDialog::Accepted) {
            const RFontDescriptor *fd = fontSelector->currentFontDescriptor();
            model->setData(index, qVariantFromValue(fd), Qt::EditRole);
        }
        break;
    }

    case RMapObjectModel::ET_PICTURE_SELECTOR: {
        RPictureSelectorDialog *pictureSelector = static_cast<RPictureSelectorDialog *>(editor);
        if (pictureSelector->result() == QDialog::Accepted) {
            const RImageDescriptor *id = pictureSelector->currentImageDescriptor();
            model->setData(index, qVariantFromValue(id), Qt::EditRole);
        }
        break;
    }

    case RMapObjectModel::ET_REFS_SELECTOR: {
        QComboBox *refsSelector = static_cast<QComboBox *>(editor);
        int row = refsSelector->currentIndex();
        int data = refsSelector->itemData(row).toInt();
        const RRefsDescriptor *rd = &RMapRegistry::instance().getRefsDescriptorById(data);
        model->setData(index, qVariantFromValue(rd), Qt::EditRole);
        break;
    }

    default:
        QItemDelegate::setModelData(editor, model, index);
        break;
    }
}
开发者ID:vvviperrr,项目名称:map_editor,代码行数:47,代码来源:rmapobjecttableviewdelegate.cpp


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