本文整理汇总了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;
}
}
示例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);
}
}
示例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;
}
}