Tpalette::Tpalette(QWidget* parent) : QWidget(parent) { currentItem = NULL; patternList = NULL; TGradDia = NULL; TGradDia = new GradientVectorDialog(this->parentWidget()); TGradDia->hide(); setupUi(this); editLineSelector->setIcon(IconManager::instance()->loadIcon("16/color-stroke.png")); editFillSelector->setIcon(IconManager::instance()->loadIcon("16/color-fill.png")); editFillSelector->setChecked(true); strokeOpacity->setDecimals(0); fillOpacity->setDecimals(0); editFillSelectorButton(); connect(editLineSelector, SIGNAL(clicked()), this, SLOT(editLineSelectorButton())); connect(editFillSelector, SIGNAL(clicked()), this, SLOT(editFillSelectorButton())); connect(strokeOpacity, SIGNAL(valueChanged(double)), this, SLOT(slotTransS(double))); connect(fillOpacity, SIGNAL(valueChanged(double)), this, SLOT(slotTransF(double))); connect(blendModeFill, SIGNAL(activated(int)), this, SIGNAL(NewBlend(int))); connect(blendModeStroke, SIGNAL(activated(int)), this, SIGNAL(NewBlendS(int))); connect(namedGradient, SIGNAL(activated(const QString &)), this, SLOT(setNamedGradient(const QString &))); connect(gradEdit, SIGNAL(gradientChanged()), this, SIGNAL(gradientChanged())); connect(gradEditButton, SIGNAL(clicked()), this, SLOT(editGradientVector())); connect(TGradDia, SIGNAL(NewSpecial(double, double, double, double, double, double, double, double, double, double)), this, SIGNAL(NewSpecial(double, double, double, double, double, double, double, double, double, double))); connect(TGradDia, SIGNAL(paletteShown(bool)), this, SLOT(setActiveGradDia(bool))); connect(gradientType, SIGNAL(activated(int)), this, SLOT(slotGradType(int))); connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(slotGrad(int))); connect(patternBox, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPattern(QListWidgetItem*))); connect(editPatternProps, SIGNAL(clicked()), this, SLOT(changePatternProps())); connect(transpCalcGradient, SIGNAL(clicked()), this, SLOT(switchGradientMode())); connect(transpCalcPattern, SIGNAL(clicked()), this, SLOT(switchPatternMode())); connect(usePatternInverted, SIGNAL(clicked()), this, SLOT(switchPatternMode())); }
void Tpalette::disconnectSignals() { disconnect(gradEdit, SIGNAL(gradientChanged()), this, SIGNAL(gradientChanged())); disconnect(namedGradient, SIGNAL(activated(const QString &)), this, SLOT(setNamedGradient(const QString &))); disconnect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(slotGrad(int))); disconnect(gradientType, SIGNAL(activated(int)), this, SLOT(slotGradType(int))); disconnect(transpCalcGradient, SIGNAL(clicked()), this, SLOT(switchGradientMode())); disconnect(transpCalcPattern, SIGNAL(clicked()), this, SLOT(switchPatternMode())); disconnect(usePatternInverted, SIGNAL(clicked()), this, SLOT(switchPatternMode())); }
TransferFunctionEditorWidget::TransferFunctionEditorWidget(QWidget *parent) : QSplitter(Qt::Vertical, parent) { m_parent = parent; m_splineEditorWidget = new SplineEditorWidget(this); m_gradientEditorWidget = new GradientEditorWidget(this); addWidget(m_splineEditorWidget); addWidget(m_gradientEditorWidget); QList<int> ssz; ssz << 150 << 75; setSizes(ssz); setChildrenCollapsible(false); QObject::connect(m_splineEditorWidget, SIGNAL(giveHistogram(int)), this, SLOT(changeHistogram(int))); QObject::connect(m_gradientEditorWidget, SIGNAL(gradientChanged(QGradientStops)), m_splineEditorWidget, SLOT(setGradientStops(QGradientStops))); QObject::connect(m_splineEditorWidget, SIGNAL(selectEvent(QGradientStops)), m_gradientEditorWidget, SLOT(setColorGradient(QGradientStops))); QObject::connect(m_splineEditorWidget, SIGNAL(deselectEvent()), m_gradientEditorWidget, SLOT(resetColorGradient())); QObject::connect(m_splineEditorWidget, SIGNAL(transferFunctionChanged(QImage)), this, SLOT(transferFunctionChanged(QImage))); }
TransferFunctionEditorWidget::TransferFunctionEditorWidget(QWidget *parent) : QSplitter(Qt::Vertical, parent) { m_splineEditorWidget = new SplineEditorWidget(this); m_gradientEditorWidget = new GradientEditorWidget(this); addWidget(m_splineEditorWidget); addWidget(m_gradientEditorWidget); setChildrenCollapsible(false); QObject::connect(m_splineEditorWidget, SIGNAL(giveHistogram(int)), SLOT(changeHistogram(int))); QObject::connect(m_gradientEditorWidget, SIGNAL(gradientChanged(QGradientStops)), m_splineEditorWidget, SLOT(setGradientStops(QGradientStops))); QObject::connect(m_splineEditorWidget, SIGNAL(selectEvent(QGradientStops)), m_gradientEditorWidget, SLOT(setColorGradient(QGradientStops))); QObject::connect(m_splineEditorWidget, SIGNAL(transferFunctionChanged(QImage)), SLOT(transferFunctionChanged(QImage))); QObject::connect(m_splineEditorWidget, SIGNAL(applyUndo(bool)), SIGNAL(applyUndo(bool))); QObject::connect(m_gradientEditorWidget, SIGNAL(applyUndo(bool)), SIGNAL(applyUndo(bool))); }
void PropertiesPalette_Group::setMainWindow(ScribusMainWindow *mw) { m_ScMW = mw; connect(this->transPalWidget, SIGNAL(gradientChanged()), this, SLOT(handleGradientChanged())); connect(m_ScMW, SIGNAL(UpdateRequest(int)), this, SLOT(handleUpdateRequest(int))); }
void DkGradient::changeColor(DkColorSlider*) { updateGradient(); update(); emit gradientChanged(); }
void MyFracWindow::setGradientOffset(int offset) { _gradientOffset = GRADIENT_LENGTH * 0.01 * offset; if (_gradientData) emit gradientChanged(_gradientData, _gradientScale, _gradientOffset); }
void MyFracWindow::onGradientInvert() { _gradient.invert(); _gradient.fillGradient(_gradientData); emit gradientChanged(_gradientData, _gradientScale, _gradientOffset); }
void MyFracWindow::setGradientScale(int scale) { _gradientScale = GRADIENT_LENGTH * (0.01 + 0.0049 * scale); if (_gradientData) emit gradientChanged(_gradientData, _gradientScale, _gradientOffset); }
ContextPaneWidgetRectangle::ContextPaneWidgetRectangle(QWidget *parent) : QWidget(parent), ui(new Ui::ContextPaneWidgetRectangle), m_gradientLineDoubleClicked(false), m_gradientTimer(-1), m_enableGradientEditing(true) { ui->setupUi(this); ui->colorColorButton->setShowArrow(false); ui->borderColorButton->setShowArrow(false); connect(ui->colorColorButton, SIGNAL(toggled(bool)), this, SLOT(onColorButtonToggled(bool))); connect(ui->borderColorButton, SIGNAL(toggled(bool)), this, SLOT(onBorderColorButtonToggled(bool))); connect(ui->colorSolid, SIGNAL(clicked()), this, SLOT(onColorSolidClicked())); connect(ui->borderSolid, SIGNAL(clicked()), this, SLOT(onBorderSolidClicked())); connect(ui->colorNone, SIGNAL(clicked()), this, SLOT(onColorNoneClicked())); connect(ui->borderNone, SIGNAL(clicked()), this, SLOT(onBorderNoneClicked())); connect(ui->colorGradient, SIGNAL(clicked()), this, SLOT(onGradientClicked())); ContextPaneWidget *parentContextWidget = qobject_cast<ContextPaneWidget*>(parentWidget()); connect(parentContextWidget->colorDialog(), SIGNAL(accepted(QColor)), this, SLOT(onColorDialogApplied(QColor))); connect(parentContextWidget->colorDialog(), SIGNAL(rejected()), this, SLOT(onColorDialogCancled())); connect(ui->gradientLine, SIGNAL(openColorDialog(QPoint)), this, SLOT(onGradientLineDoubleClicked(QPoint))); connect(ui->gradientLine, SIGNAL(gradientChanged()), this, SLOT(onUpdateGradient())); }
void MyFracWindow::setGradient(const Gradient& gradient) { if (!_gradientData) _gradientData = new QRgb[GRADIENT_LENGTH]; _gradient = gradient; _gradient.fillGradient(_gradientData); emit gradientChanged(_gradientData, _gradientScale, _gradientOffset); }
void FractalModel::setGradient( const Gradient& gradient ) { if ( m_gradient != gradient ) { m_gradient = gradient; m_presenter->setGradient( gradient ); if ( m_previewPresenter ) m_previewPresenter->setGradient( gradient ); emit gradientChanged(); } }
void GradientLine::mouseReleaseEvent(QMouseEvent *event) { if (event->button() == Qt::LeftButton) { event->accept(); if (m_dragActive) { m_yOffset += event->pos().y() - 14; if (m_yOffset > 0) { m_yOffset = 0; } else if ((m_yOffset < - 8) && (currentColorIndex()) != 0 && (currentColorIndex() < m_stops.size() - 1)) { m_yOffset = 0; m_dragActive = false; m_stops.removeAt(currentColorIndex()); m_colorList.removeAt(currentColorIndex()); updateGradient(); emit gradientChanged(); setCurrentIndex(0); //delete item } } if (m_dragActive == false && m_create) { qreal stopPos = qreal(event->pos().x() - 9) / qreal((width() - 15)); int index = -1; for (int i =0; i < m_stops.size() - 1; i++) { if ((stopPos > m_stops.at(i)) && (index == -1)) index = i +1; } if (index != -1 && (m_useGradient) && abs(m_dragStart.x() - event->pos().x()) < 10) { //creating of items only in base state m_stops.insert(index, stopPos); m_colorList.insert(index, QColor(Qt::white)); setCurrentIndex(index); } } } m_dragActive = false; m_yOffset = 0; updateGradient(); emit gradientChanged(); update(); setFocus(Qt::MouseFocusReason); }
void QtGradientView::setGradientManager(QtGradientManager *manager) { if (m_manager == manager) return; if (m_manager) { disconnect(m_manager, SIGNAL(gradientAdded(QString,QGradient)), this, SLOT(slotGradientAdded(QString,QGradient))); disconnect(m_manager, SIGNAL(gradientRenamed(QString,QString)), this, SLOT(slotGradientRenamed(QString,QString))); disconnect(m_manager, SIGNAL(gradientChanged(QString,QGradient)), this, SLOT(slotGradientChanged(QString,QGradient))); disconnect(m_manager, SIGNAL(gradientRemoved(QString)), this, SLOT(slotGradientRemoved(QString))); m_ui.listWidget->clear(); m_idToItem.clear(); m_itemToId.clear(); } m_manager = manager; if (!m_manager) return; QMap<QString, QGradient> gradients = m_manager->gradients(); QMapIterator<QString, QGradient> itGrad(gradients); while (itGrad.hasNext()) { itGrad.next(); slotGradientAdded(itGrad.key(), itGrad.value()); } connect(m_manager, SIGNAL(gradientAdded(QString,QGradient)), this, SLOT(slotGradientAdded(QString,QGradient))); connect(m_manager, SIGNAL(gradientRenamed(QString,QString)), this, SLOT(slotGradientRenamed(QString,QString))); connect(m_manager, SIGNAL(gradientChanged(QString,QGradient)), this, SLOT(slotGradientChanged(QString,QGradient))); connect(m_manager, SIGNAL(gradientRemoved(QString)), this, SLOT(slotGradientRemoved(QString))); }
void MyFracWindow::scrollTimer() { _gradientOffset += _scrollDir * _scrollSpeed; if (_gradientOffset > GRADIENT_LENGTH) _gradientOffset -= GRADIENT_LENGTH; if (_gradientOffset < 0.0) _gradientOffset += GRADIENT_LENGTH; if (_gradientData) emit gradientChanged(_gradientData, _gradientScale, _gradientOffset); }
void TupGradientSelector::init() { setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); setMaximumWidth(100); setMinimumWidth(100); setStops(m_gradient.stops()); createGradient(); emit gradientChanged(m_gradient.stops());; }
void TupGradientSelector::setCurrentColor(const QColor& color) { if (m_arrows.count() > 0) { TupGradientArrow *arrow = m_arrows[m_currentArrowIndex]; if (arrow) m_arrows[m_currentArrowIndex]->setColor(color); } createGradient(); emit gradientChanged(m_gradient.stops()); repaint(); m_currentColor = color; }
void GradientLine::setActiveColor(const QColor &newColor) { if (newColor.name() == m_activeColor.name() && newColor.alpha() == m_activeColor.alpha()) return; m_activeColor = newColor; m_colorList.removeAt(currentColorIndex()); m_colorList.insert(currentColorIndex(), m_activeColor); updateGradient(); emit gradientChanged(); emit activeColorChanged(); update(); }
void DkGradient::moveSlider(DkColorSlider* sender, int dragDistX, int yPos) { // Delete the actual slider: if (yPos > deleteSliderDist) { int idx = sliders.lastIndexOf(sender); if (idx != -1) { sliders.remove(idx); delete sender; isActiveSliderExisting = false; } } // Insert a new slider: else { int newPos = sender->pos().x() + dragDistX; if (newPos < 0) newPos = 0; else if (newPos > width() - sliderWidth - 1) newPos = width() - sliderWidth - 1; qreal normedSliderPos = getNormedPos(newPos); if (normedSliderPos > 1) normedSliderPos = 1; if (normedSliderPos < 0) normedSliderPos = 0; DkColorSlider *slider; // Check if the position is already assigned to another slider: for (int i = 0; i < sliders.size(); i++) { slider = sliders.at(i); if (slider != sender) { if (slider->getNormedPos() == normedSliderPos) return; } } sender->setNormedPos(normedSliderPos); sender->move(newPos, sender->pos().y()); } updateGradient(); update(); emit gradientChanged(); }
void FractalModel::setColorSettings( const Gradient& gradient, const QColor& backround, const ColorMapping& mapping ) { if ( m_gradient != gradient || m_backgroundColor != backround || m_colorMapping != mapping ) { m_gradient = gradient; m_backgroundColor = backround; m_colorMapping = mapping; m_presenter->setColorSettings( gradient, backround, mapping ); if ( m_previewPresenter ) m_previewPresenter->setColorSettings( gradient, backround, mapping ); emit gradientChanged(); emit backgroundColorChanged(); emit colorMappingChanged(); } }
void GradientLine::updateGradient() { if (m_useGradient) { QGradientStops stops; for (int i = 0;i < m_stops.size(); i++) { stops.append(QPair<qreal, QColor>(m_stops.at(i), m_colorList.at(i))); } m_gradient.setStops(stops); emit gradientChanged(); } else { if (!active()) return; } }
/** Creates the EffectsScrollArea object. Sets up GUI. */ EffectsScrollArea::EffectsScrollArea(QWidget *parent) : QScrollArea(parent) { setupUi(this); // create connections connect(filterColorRadioButton, SIGNAL(toggled(bool)), this, SLOT(filterToogled(bool)) ); connect(filterTypeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(filterTypeChanged(int)) ); connect(filterGradientWidget, SIGNAL(gradientChanged()), filterBrushFrame, SLOT(changeGradient()) ); connect(imagePathPushButton, SIGNAL(clicked()), this, SLOT(browseImage())); connect(textXComboBox, SIGNAL(currentIndexChanged(QString)), textXSpinBox, SLOT(posUnitChanged(QString)) ); connect(textYComboBox, SIGNAL(currentIndexChanged(QString)), textYSpinBox, SLOT(posUnitChanged(QString)) ); connect(imageXComboBox, SIGNAL(currentIndexChanged(QString)), imageXSpinBox, SLOT(posUnitChanged(QString)) ); connect(imageYComboBox, SIGNAL(currentIndexChanged(QString)), imageYSpinBox, SLOT(posUnitChanged(QString)) ); filterBrushFrame->setColorDialogOptions(0); filterBrushFrame->setGradientType(QGradient::LinearGradient); filterBrushFrame->setGradientStops(filterGradientWidget->gradientStops()); filterTypeComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents); textColorFrame->setColor(Qt::black); // set combo box models setupFilterModels(); filterToogled(filterColorRadioButton->isChecked()); QAbstractItemModel *posUnitModel = textXComboBox->model(); textYComboBox->setModel(posUnitModel); imagePositionComboBox->setModel(textPositionComboBox->model()); imageXComboBox->setModel(posUnitModel); imageYComboBox->setModel(posUnitModel); // set range const QPair<int, int> posRange(-20000, 20000); textXSpinBox->setRange(posRange.first, posRange.second); textYSpinBox->setRange(posRange.first, posRange.second); imageXSpinBox->setRange(posRange.first, posRange.second); imageYSpinBox->setRange(posRange.first, posRange.second); imageRotationSpinBox->setRange(textRotationSpinBox->minimum(), textRotationSpinBox->maximum()); // set icons textBoldPushButton->setIcon(QIcon::fromTheme("format-text-bold")); textItalicPushButton->setIcon(QIcon::fromTheme("format-text-italic")); textUnderlinePushButton->setIcon(QIcon::fromTheme("format-text-underline")); textStrikeOutPushButton->setIcon(QIcon::fromTheme("format-text-strikethrough")); }
void GradientLine::keyPressEvent(QKeyEvent * event) { if (event->matches(QKeySequence::Delete)) { if ((currentColorIndex()) != 0 && (currentColorIndex() < m_stops.size() - 1)) { m_dragActive = false; m_stops.removeAt(currentColorIndex()); m_colorList.removeAt(currentColorIndex()); updateGradient(); emit gradientChanged(); setCurrentIndex(0); //delete item } } else { QWidget::keyPressEvent(event); } }
void DkGradient::setGradient(const QLinearGradient& gradient) { reset(); clearAllSliders(); // reset adds a slider at the start and end this->gradient.setStops(gradient.stops()); QVector<QGradientStop> stops = gradient.stops(); for (int idx = 0; idx < stops.size(); idx++) { addSlider(stops.at(idx).first, stops.at(idx).second); } updateGradient(); update(); emit gradientChanged(); }
void DkTransferToolBar::enableTFCheckBoxClicked(int state) { bool enabled; if (state == Qt::Checked) enabled = true; else enabled = false; enableToolBar(enabled); // At this point the checkbox is disabled, hence enable it... enableTFCheckBox->setEnabled(true); if (enabled) enableTFCheckBox->setStatusTip(tr("Disables the Pseudo Color function")); else enableTFCheckBox->setStatusTip(tr("Enables the Pseudo Color function")); emit tFEnabled(enabled); emit gradientChanged(); }
void TupGradientSelector::moveArrow(const QPoint &pos) { if (orientation() == Qt::Vertical && (pos.y() <= minimum() || pos.y() >= maximum())) return; if (orientation() == Qt::Horizontal && (pos.x() <= minimum() || pos.x() >= maximum())) return; int val; if (orientation() == Qt::Vertical) val = (maximum() - minimum()) * (height()-pos.y()) / (height()) + minimum(); else val = (maximum() - minimum()) * (width()-pos.x()) / (width()) + minimum(); setValue(val); m_arrows[m_currentArrowIndex]->moveArrow(pos); m_update = true; emit gradientChanged(m_gradient.stops()); }
void GradientPreview::mouseReleaseEvent(QMouseEvent *m) { qApp->restoreOverrideCursor(); QRect insideRect = QRect(10, 43, width()-20, 13); if (isEditable) { QRect fpo; if (m->button() == Qt::LeftButton) { if ((Mpressed) && (ActStop > 0) && (ActStop != static_cast<int>(StopM.count()-1)) && (outside || !insideRect.contains(m->pos()))) { onlyselect = false; fill_gradient.removeStop(ActStop); ActStop = 0; repaint(); QList<VColorStop*> cstops = fill_gradient.colorStops(); emit selectedStop(cstops.at(ActStop)); } if ((m->y() < height()) && (m->y() > 43) && (m->x() > 0) && (m->x() < width()) && (ActStop == -1)) { QList<VColorStop*> cstops = fill_gradient.colorStops(); double newStop = static_cast<double>((m->x() - 10)) / (static_cast<double>(width())-20); QColor stopColor = (cstops.count() > 0) ? cstops.at(0)->color : QColor(255, 255, 255); QString stopName = (cstops.count() > 0) ? cstops.at(0)->name : QString("White"); int stopShade = (cstops.count() > 0) ? cstops.at(0)->shade : 100; fill_gradient.addStop(stopColor, newStop, 0.5, 1.0, stopName, stopShade); repaint(); onlyselect = false; cstops = fill_gradient.colorStops(); for (int yg = 0; yg < static_cast<int>(StopM.count()); ++yg) { fpo = QRect(static_cast<int>(StopM[yg])-4, 43, 8, 13); if (fpo.contains(m->pos())) { ActStop = yg; emit selectedStop(cstops.at(ActStop)); repaint(); break; } } } } else if (m->button() == Qt::RightButton) { Mpressed = false; QList<VColorStop*> cstops = fill_gradient.colorStops(); int stop = -1; for (int yg = 0; yg < static_cast<int>(StopM.count()); ++yg) { fpo = QRect(static_cast<int>(StopM[yg])-4, 43, 8, 13); if (fpo.contains(m->pos())) { stop = yg; break; } } contextStop = stop; mPos = m->pos(); QMenu *pmen = new QMenu(); setCursor(QCursor(Qt::ArrowCursor)); pmen->addAction( tr("Add Stop"), this, SLOT(addStop())); if (stop != -1) pmen->addAction( tr("Remove Stop"), this, SLOT(removeStop())); pmen->exec(QCursor::pos()); delete pmen; } } Mpressed = false; if ((!onlyselect) && (ActStop >= 0)){ emit gradientChanged(); QList<VColorStop*> cstops = fill_gradient.colorStops(); emit currStep(cstops.at(ActStop)->rampPoint); } }
GradientLineQmlAdaptor::GradientLineQmlAdaptor(QWidget *parent) : QmlEditorWidgets::GradientLine(parent) { setActive(false); connect(this, SIGNAL(gradientChanged()), this, SLOT(writeGradient())); }
bool RemapWidget::setFile(QList<QString> flnm, int voltype) { m_timeseriesFiles.clear(); Global::statusBar()->clearMessage(); hideWidgets(); if (m_histogramWidget) delete m_histogramWidget; if (m_imageWidget) delete m_imageWidget; if (m_remapVolume) delete m_remapVolume; if (m_gradientWidget) delete m_gradientWidget; if (m_slider) delete m_slider; m_histogramWidget = 0; m_imageWidget = 0; m_gradientWidget = 0; m_remapVolume = 0; m_slider = 0; m_volumeType = voltype; m_volumeFile = flnm; if (m_volumeType == RAWVolume) m_remapVolume = new RemapRawVolume(); else if (m_volumeType == TOMVolume) m_remapVolume = new RemapTomVolume(); else if (m_volumeType == AnalyzeVolume) m_remapVolume = new RemapAnalyze(); else if (m_volumeType == HDF4Volume) m_remapVolume = new RemapHDF4(); else if (m_volumeType == RawSlices) m_remapVolume = new RemapRawSlices(); else if (m_volumeType == RawSlabs) m_remapVolume = new RemapRawSlabs(); else if (m_volumeType == NCVolume) m_remapVolume = new RemapNcVolume(); else if (m_volumeType == ImageVolume) m_remapVolume = new RemapImageVolume(); else if (m_volumeType == ImageMagickVolume) m_remapVolume = new RemapDicomVolume(); if (! m_remapVolume->setFile(m_volumeFile)) return false; m_histogramWidget = new RemapHistogramWidget(); m_histogramWidget->setMinimumSize(100, 300); m_histogramWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); m_gradientWidget = new GradientEditorWidget(); m_gradientWidget->setDrawBox(false); m_gradientWidget->setMinimumSize(200, 20); m_gradientWidget->setGeneralLock(GradientEditor::LockToTop); int d, w, h; m_remapVolume->gridSize(d, w, h); m_slider = new MySlider(); m_slider->set(0, d-1, 0, d-1, 0); ui.histogramFrame->layout()->addWidget(m_histogramWidget); ui.colorFrame->layout()->addWidget(m_gradientWidget); ui.sliderFrame->layout()->addWidget(m_slider); m_imageWidget = new RemapImage(); m_imageWidget->setGridSize(d, w, h); m_scrollArea->setWidget(m_imageWidget); m_currSlice = 0; connect(m_histogramWidget, SIGNAL(getHistogram()), this, SLOT(getHistogram())); connect(m_histogramWidget, SIGNAL(newMapping()), this, SLOT(newMapping())); connect(m_histogramWidget, SIGNAL(newMinMax(float, float)), this, SLOT(newMinMax(float, float))); connect(m_imageWidget, SIGNAL(getSlice(int)), this, SLOT(getSlice(int))); connect(m_imageWidget, SIGNAL(getRawValue(int, int, int)), this, SLOT(getRawValue(int, int, int))); connect(m_imageWidget, SIGNAL(newMinMax(float, float)), this, SLOT(newMinMax(float, float))); connect(m_imageWidget, SIGNAL(saveTrimmed(int, int, int, int, int, int)), this, SLOT(saveTrimmed(int, int, int, int, int, int))); connect(m_imageWidget, SIGNAL(saveTrimmedImages(int, int, int, int, int, int)), this, SLOT(saveTrimmedImages(int, int, int, int, int, int))); connect(m_imageWidget, SIGNAL(extractRawVolume()), this, SLOT(extractRawVolume())); connect(m_gradientWidget, SIGNAL(gradientChanged(QGradientStops)), m_imageWidget, SLOT(setGradientStops(QGradientStops))); connect(m_gradientWidget, SIGNAL(gradientChanged(QGradientStops)), m_histogramWidget, SLOT(setGradientStops(QGradientStops))); connect(m_slider, SIGNAL(valueChanged(int)), m_imageWidget, SLOT(sliceChanged(int))); connect(m_slider, SIGNAL(userRangeChanged(int, int)), m_imageWidget, SLOT(userRangeChanged(int, int))); QGradientStops stops; stops << QGradientStop(0, Qt::black) << QGradientStop(1, Qt::white); m_gradientWidget->setColorGradient(stops); m_imageWidget->setGradientStops(stops); m_histogramWidget->setGradientStops(stops); setRawMinMax(); showWidgets(); return true; }
DkTransferToolBar::DkTransferToolBar(QWidget * parent) : QToolBar(tr("Pseudo Color Toolbar"), parent) { loadSettings(); enableTFCheckBox = new QCheckBox(tr("Enable")); enableTFCheckBox->setStatusTip(tr("Enables the Pseudo Color function")); this->addWidget(enableTFCheckBox); // >DIR: more compact gui [2.3.2012 markus] this->addSeparator(); //this->addWidget(new QLabel(tr("Active channel:"))); channelComboBox = new QComboBox(this); channelComboBox->setStatusTip(tr("Changes the displayed color channel")); this->addWidget(channelComboBox); historyCombo = new QComboBox(this); QAction* delGradientAction = new QAction(tr("Delete"), historyCombo); connect(delGradientAction, SIGNAL(triggered()), this, SLOT(deleteGradient())); historyCombo->addAction(delGradientAction); historyCombo->setContextMenuPolicy(Qt::ActionsContextMenu); updateGradientHistory(); connect(historyCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(switchGradient(int))); connect(historyCombo, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(deleteGradientMenu(QPoint))); this->addWidget(historyCombo); createIcons(); gradient = new DkGradient(this); gradient->setStatusTip(tr("Click into the field for a new slider")); this->addWidget(gradient); effect = new QGraphicsOpacityEffect(gradient); effect->setOpacity(1); gradient->setGraphicsEffect(effect); // Disable the entire transfer toolbar: //enableTF(Qt::Unchecked); // Initialize the combo box for color images: imageMode = mode_uninitialized; applyImageMode(mode_rgb); enableToolBar(false); enableTFCheckBox->setEnabled(true); connect(enableTFCheckBox, SIGNAL(stateChanged(int)), this, SLOT(enableTFCheckBoxClicked(int))); connect(gradient, SIGNAL(gradientChanged()), this, SLOT(applyTF())); // needed for initialization connect(this, SIGNAL(gradientChanged()), gradient, SIGNAL(gradientChanged())); if (!oldGradients.empty()) gradient->setGradient(oldGradients.first()); };