本文整理汇总了C++中QColorDialog类的典型用法代码示例。如果您正苦于以下问题:C++ QColorDialog类的具体用法?C++ QColorDialog怎么用?C++ QColorDialog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QColorDialog类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QColorDialog
void MainWindow::on_colorButton_clicked(bool checked)
{
QColorDialog *colorDialog = new QColorDialog();
colorDialog->open(this, SLOT(cambiarColor(QColor)));
}
示例2: switch
QWidget *Data3DTreeDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option , const QModelIndex& index) const
{
// Only create the editors here. Do not set any data from the model yet. This is done in setEditorData().
//Connect to Data3DTreeDelegate::onEditorEdited if you want to have immediate feedback (default by QItemDelegate is on EditorFinished).
const Data3DTreeModel* pData3DTreeModel = static_cast<const Data3DTreeModel*>(index.model());
const AbstractTreeItem* pAbstractItem = static_cast<const AbstractTreeItem*>(pData3DTreeModel->itemFromIndex(index));
switch(pAbstractItem->type()) {
case MetaTreeItemTypes::SurfaceColorGyri: {
QColorDialog *pColorDialog = new QColorDialog(parent);
connect(pColorDialog, &QColorDialog::currentColorChanged,
this, &Data3DTreeDelegate::onEditorEdited);
pColorDialog->setWindowTitle("Select Gyri Color");
pColorDialog->show();
return pColorDialog;
}
case MetaTreeItemTypes::SurfaceColorSulci: {
QColorDialog *pColorDialog = new QColorDialog();
connect(pColorDialog, &QColorDialog::currentColorChanged,
this, &Data3DTreeDelegate::onEditorEdited);
pColorDialog->setWindowTitle("Select Sulci Color");
pColorDialog->show();
return pColorDialog;
}
case MetaTreeItemTypes::ColormapType: {
QComboBox* pComboBox = new QComboBox(parent);
connect(pComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &Data3DTreeDelegate::onEditorEdited);
pComboBox->addItem("Hot Negative 1");
pComboBox->addItem("Hot Negative 2");
pComboBox->addItem("Hot");
pComboBox->addItem("Jet");
return pComboBox;
}
case MetaTreeItemTypes::DataThreshold: {
Spline* pSpline = new Spline("Set Threshold", 0);
connect(pSpline, static_cast<void (Spline::*)(double, double, double)>(&Spline::borderChanged),
this, &Data3DTreeDelegate::onEditorEdited);
return pSpline;
}
case MetaTreeItemTypes::StreamingTimeInterval: {
QSpinBox* pSpinBox = new QSpinBox(parent);
connect(pSpinBox, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
this, &Data3DTreeDelegate::onEditorEdited);
pSpinBox->setSuffix(" mSec");
pSpinBox->setMinimum(1);
pSpinBox->setMaximum(50000);
pSpinBox->setSingleStep(1);
return pSpinBox;
}
case MetaTreeItemTypes::VisualizationType: {
QComboBox* pComboBox = new QComboBox(parent);
pComboBox->addItem("Interpolation based");
pComboBox->addItem("Annotation based");
return pComboBox;
}
case MetaTreeItemTypes::Color: {
QColorDialog *pColorDialog = new QColorDialog();
connect(pColorDialog, &QColorDialog::currentColorChanged,
this, &Data3DTreeDelegate::onEditorEdited);
pColorDialog->setWindowTitle("Select Color");
pColorDialog->show();
return pColorDialog;
}
case MetaTreeItemTypes::NumberAverages: {
QSpinBox* pSpinBox = new QSpinBox(parent);
connect(pSpinBox, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
this, &Data3DTreeDelegate::onEditorEdited);
pSpinBox->setMinimum(1);
pSpinBox->setMaximum(100);
pSpinBox->setSingleStep(1);
return pSpinBox;
}
case MetaTreeItemTypes::AlphaValue: {
QDoubleSpinBox* pDoubleSpinBox = new QDoubleSpinBox(parent);
connect(pDoubleSpinBox, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
this, &Data3DTreeDelegate::onEditorEdited);
pDoubleSpinBox->setMinimum(0.01);
pDoubleSpinBox->setMaximum(1.0);
pDoubleSpinBox->setSingleStep(0.01);
return pDoubleSpinBox;
}
case MetaTreeItemTypes::SurfaceTessInner: {
QDoubleSpinBox* pDoubleSpinBox = new QDoubleSpinBox(parent);
connect(pDoubleSpinBox, static_cast<void (QDoubleSpinBox::*)()>(&QDoubleSpinBox::editingFinished),
this, &Data3DTreeDelegate::onEditorEdited);
pDoubleSpinBox->setMinimum(1.0);
pDoubleSpinBox->setMaximum(100.0);
pDoubleSpinBox->setSingleStep(1.0);
return pDoubleSpinBox;
//.........这里部分代码省略.........
示例3: switch
void BrainTreeDelegate::setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const
{
const BrainTreeModel* pBrainTreeModel = static_cast<const BrainTreeModel*>(index.model());
const AbstractTreeItem* pAbstractItem = static_cast<const AbstractTreeItem*>(pBrainTreeModel->itemFromIndex(index));
switch(pAbstractItem->type()) {
case BrainTreeModelItemTypes::SurfaceColorGyri: {
QColorDialog* pColorDialog = static_cast<QColorDialog*>(editor);
QColor color = pColorDialog->currentColor();
QVariant data;
data.setValue(color);
model->setData(index, data, BrainTreeItemRoles::SurfaceColorGyri);
model->setData(index, data, Qt::DecorationRole);
return;
}
case BrainTreeModelItemTypes::SurfaceColorSulci: {
QColorDialog* pColorDialog = static_cast<QColorDialog*>(editor);
QColor color = pColorDialog->currentColor();
QVariant data;
data.setValue(color);
model->setData(index, data, BrainTreeItemRoles::SurfaceColorSulci);
model->setData(index, data, Qt::DecorationRole);
return;
}
case BrainTreeModelItemTypes::SurfaceColorInfoOrigin: {
QComboBox* pColorDialog = static_cast<QComboBox*>(editor);
QVariant data;
data.setValue(pColorDialog->currentText());
model->setData(index, data, BrainTreeItemRoles::SurfaceColorInfoOrigin);
model->setData(index, data, Qt::DisplayRole);
return;
}
case BrainTreeModelItemTypes::RTDataColormapType: {
QComboBox* pColorDialog = static_cast<QComboBox*>(editor);
QVariant data;
data.setValue(pColorDialog->currentText());
model->setData(index, data, BrainTreeItemRoles::RTDataColormapType);
model->setData(index, data, Qt::DisplayRole);
return;
}
case BrainTreeModelItemTypes::RTDataNormalizationValue: {
QDoubleSpinBox* pDoubleSpinBox = static_cast<QDoubleSpinBox*>(editor);
QVariant data;
data.setValue(pDoubleSpinBox->value());
model->setData(index, data, BrainTreeItemRoles::RTDataNormalizationValue);
model->setData(index, data, Qt::DisplayRole);
break;
}
case BrainTreeModelItemTypes::RTDataTimeInterval: {
QSpinBox* pSpinBox = static_cast<QSpinBox*>(editor);
QVariant data;
data.setValue(pSpinBox->value());
model->setData(index, data, BrainTreeItemRoles::RTDataTimeInterval);
model->setData(index, data, Qt::DisplayRole);
break;
}
}
QItemDelegate::setModelData(editor, model, index);
}
示例4: onBtnColorSettingClicked
void ShowPicture::onBtnColorSettingClicked()
{
QColorDialog* colorDlg = new QColorDialog;
colorDlg->exec();
QColor selectColor = colorDlg->selectedColor();
}
示例5: accept
virtual void accept()
{
KColorDialog::accept();
original->setCurrentColor(color());
QMetaObject::invokeMethod(original, "accept"); //workaround protected
}