myDialog::myDialog(QWidget *p,Qt::WindowFlags f):QDialog(p,f) { s.setRange(100,200); l.setRange(100,200); s.setValue(100); l.setValue(100); l.setOrientation(Qt::Horizontal); toplay.addWidget(&s); toplay.addWidget(&l); b1.setText(QString("yes")); b2.setText(QString("no")); bottomlay.addWidget(&b1); bottomlay.addWidget(&b2); mlay.addLayout(&toplay); mlay.addLayout(&bottomlay); setLayout(&mlay); QObject::connect(&s,SIGNAL(valueChanged(int)),&l,SLOT(setValue(int))); QObject::connect(&l,SIGNAL(valueChanged(int)),&s,SLOT(setValue(int))); QObject::connect(&s,SIGNAL(valueChanged(int)),this,SLOT(valueChange(int))); QObject::connect(&l,SIGNAL(valueChanged(int)),this,SLOT(valueChange(int))); //QObject::connect(&b1,SIGNAL(clicked()),this,SLOT(accept())); QObject::connect(&b2,SIGNAL(clicked()),this,SLOT(reject())); QObject::connect(&b1,SIGNAL(clicked()),this,SLOT(valueUpdate())); }
void djvColorWidget::setColor(const djvColor & color) { if (color == _p->color) return; //DJV_DEBUG("djvColorWidget::setColor"); //DJV_DEBUG_PRINT("color = " << color); const djvColor prev = _p->color; _p->color = color; if (_p->color.pixel() != prev.pixel()) { widgetUpdate(); } valueUpdate(); Q_EMIT colorChanged(_p->color); }
void djvColorWidget::intCallback(int) { for (int i = 0; i < djvPixel::channels(_p->color.pixel()); ++i) { switch (djvPixel::type(_p->color.pixel())) { case djvPixel::U8: _p->color.setU8 (_p->intWidgets[i]->value(), i); break; case djvPixel::U10: _p->color.setU10(_p->intWidgets[i]->value(), i); break; case djvPixel::U16: _p->color.setU16(_p->intWidgets[i]->value(), i); break; case djvPixel::F16: _p->color.setF16( static_cast<djvPixel::F16_T>(_p->floatWidgets[i]->value()), i); break; case djvPixel::F32: _p->color.setF32( static_cast<djvPixel::F32_T>(_p->floatWidgets[i]->value()), i); break; default: break; } } valueUpdate(); Q_EMIT colorChanged(_p->color); }
void ValueTabView::initKeyValue(KeyModel * model) { loader->stop(); loaderLabel->hide(); this->model = model; saveValue = new QPushButton; saveValue->setText("Save value"); saveValue->setStyleSheet("color: green; font-weight: 800;"); saveValue->setFixedHeight(35); saveValue->setFixedWidth(150); connect(saveValue, SIGNAL(clicked()), this, SLOT(valueUpdate())); renameKey->setEnabled(true); deleteKey->setEnabled(true); keyName->setEnabled(true); singleValue = new QPlainTextEdit(controller); if (model->getKeyModelType() == KeyModel::KEY_MODEL_TYPE) { keyValue = new QTableView(controller); keyValue->setEditTriggers(QAbstractItemView::NoEditTriggers); keyValue->setWordWrap(true); keyValue->horizontalHeader()->setDefaultSectionSize(220); singleValue->appendPlainText("Select table cell"); singleValue->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); singleValueGroup = new QGroupBox("Value:"); QGridLayout *grid = new QGridLayout; grid->addWidget(formatterLabel, 0, 0, 1, 1); grid->addWidget(singleValueFormatterType, 0, 1, 1, 1); grid->addWidget(singleValue, 1, 0, 1, 2); grid->addWidget(saveValue, 2, 1, 1, 1); singleValueGroup->setLayout(grid); splitter = new QSplitter(); splitter->setOrientation(Qt::Vertical); splitter->addWidget(keyValue); splitter->addWidget(singleValueGroup); gridLayout->addWidget(splitter, 1, 0, 1, 2); keyValue->setItemDelegate(new FastItemDelegate); keyValue->setModel(model); initPagination(); } else if (model->getKeyModelType() == StringKeyModel::KEY_MODEL_TYPE) { gridLayout->addWidget(singleValueFormatterType, 1, 1, 1, 1); gridLayout->addWidget(singleValue, 2, 1, 1, 1); gridLayout->addWidget(saveValue, 3, 1, 1, 1); keyValueLabel = new QLabel(controller); keyValueLabel->setText("Value:"); gridLayout->addWidget(keyValueLabel, 1, 0, 1, 1); StringKeyModel * stringModel = (StringKeyModel *) model; singleValue->setPlainText(stringModel->getValue()); } }
djvColorWidget::djvColorWidget(djvGuiContext * context, QWidget * parent) : QWidget(parent), _p(new djvColorWidgetPrivate) { //DJV_DEBUG("djvColorWidget::djvColorWidget"); // Create the widgets. for (int i = 0; i < djvPixel::channelsMax; ++i) { djvIntEditSlider * intSlider = new djvIntEditSlider(context); intSlider->setResetToDefault(false); _p->intWidgets += intSlider; djvFloatEditSlider * floatSlider = new djvFloatEditSlider(context); floatSlider->setResetToDefault(false); floatSlider->editObject()->setClamp(false); _p->floatWidgets += floatSlider; } _p->formatWidget = new QComboBox; _p->formatWidget->addItems(djvPixel::formatLabels()); _p->formatWidget->setToolTip(qApp->translate("djvColorWidget", "Pixel format")); _p->typeWidget = new QComboBox; _p->typeWidget->addItems(djvPixel::typeLabels()); _p->typeWidget->setToolTip(qApp->translate("djvColorWidget", "Pixel type")); // Layout the widgets. QVBoxLayout * layout = new QVBoxLayout(this); layout->setMargin(0); for (int i = 0; i < djvPixel::channelsMax; ++i) { layout->addWidget(_p->intWidgets[i]); layout->addWidget(_p->floatWidgets[i]); } _p->bottomLayout = new QHBoxLayout; _p->bottomLayout->setMargin(0); _p->bottomLayout->setSpacing(0); _p->bottomLayout->addStretch(); _p->bottomLayout->addWidget(_p->formatWidget); _p->bottomLayout->addWidget(_p->typeWidget); layout->addLayout(_p->bottomLayout); // Initialize. setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); widgetUpdate(); valueUpdate(); // Setup the callbacks. for (int i = 0; i < djvPixel::channelsMax; ++i) { connect( _p->intWidgets[i], SIGNAL(valueChanged(int)), SLOT(intCallback(int))); connect( _p->floatWidgets[i], SIGNAL(valueChanged(double)), SLOT(floatCallback(double))); } connect( _p->formatWidget, SIGNAL(activated(int)), SLOT(formatCallback(int))); connect( _p->typeWidget, SIGNAL(activated(int)), SLOT(typeCallback(int))); }