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


C++ QColorDialog类代码示例

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

示例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;
//.........这里部分代码省略.........
开发者ID:chdinh,项目名称:mne-cpp,代码行数:101,代码来源:data3Dtreedelegate.cpp

示例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);
}
开发者ID:BulatSuleymanoff,项目名称:mne-cpp,代码行数:73,代码来源:braintreedelegate.cpp

示例4: onBtnColorSettingClicked

void ShowPicture::onBtnColorSettingClicked()
{
    QColorDialog* colorDlg = new QColorDialog;
    colorDlg->exec();
    QColor selectColor = colorDlg->selectedColor();
}
开发者ID:wuyougongzi,项目名称:imgProcess,代码行数:6,代码来源:showpicture.cpp

示例5: accept

 virtual void accept()
 {
     KColorDialog::accept();
     original->setCurrentColor(color());
     QMetaObject::invokeMethod(original, "accept"); //workaround protected
 }
开发者ID:aarontc,项目名称:kde-workspace,代码行数:6,代码来源:qguiplatformplugin_kde.cpp


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