QToolButton *StManagerStudyListComp::createToolButton ( const QIcon &icon, const char *member ) { QToolButton *toolButton = new QToolButton(); toolButton->setCheckable( true ); toolButton->setAutoExclusive( true ); toolButton->setIconSize( QSize( 27, 27 ) ); toolButton->setIcon( icon ); connect( toolButton, SIGNAL(clicked()), this, member ); return toolButton; }
QToolButton * AdvancedImageWidget::addToolButton(QString name, QIcon icon, bool checkable) { QFrame* holder = getToolsFrame(); QToolButton *toolButton = new QToolButton(); toolButton->setIcon(icon); toolButton->setText(name); toolButton->setToolTip(name); toolButton->setIconSize(QSize(24,24)); if (checkable) { toolButton->setAutoExclusive(true); toolButton->setCheckable(true); toolButton->setAutoRaise(true); } holder->layout()->addWidget(toolButton); connect(toolButton, SIGNAL(released()),&mToolMapper, SLOT(map())); mToolMapper.setMapping(toolButton, toolButton); //connect(toolButton, SIGNAL(released()), this, SLOT(toolButtonReleased())); return toolButton; }
EditorTools::EditorTools(EditorWorkspace * parent) :QGroupBox((QWidget *)parent) { editor = parent; setTitle(tr("Tools")); QGridLayout * layout = new QGridLayout(this); this->setLayout(layout); QSize iconSize = QSize(22,22); QToolButton * pointer = new QToolButton(this); pointer->setIcon(QIcon(":images/cursor_arrow.png")); pointer->setToolTip(tr("Drag/Scale Image\n(Shift to activate)")); pointer->setIconSize(iconSize); pointer->setCheckable(true); pointer->setAutoExclusive(true); if(editor->editorView()->editorMode() == ImageEditorView::EditorDefaultMode){ pointer->setChecked(true); } connect(pointer,SIGNAL(clicked(bool)),this,SLOT(onPointerClicked())); layout->addWidget(pointer,0,0); QToolButton * bullseye = new QToolButton(this); bullseye->setIcon(QIcon(":images/bullseye.png")); bullseye->setToolTip(tr("Set Image Center")); bullseye->setIconSize(iconSize); bullseye->setCheckable(true); bullseye->setAutoExclusive(true); connect(bullseye,SIGNAL(toggled(bool)),this,SLOT(onBullseyeToggled(bool))); layout->addWidget(bullseye,0,1); QToolButton * drop = new QToolButton(this); drop->setIcon(QIcon(":images/water_drop.png")); drop->setToolTip(tr("Blur Image")); drop->setIconSize(iconSize); drop->setCheckable(true); drop->setAutoExclusive(true); if(editor->editorView()->editorMode() == ImageEditorView::EditorBlurMode){ drop->setChecked(true); } connect(drop,SIGNAL(clicked(bool)),this,SLOT(onDropClicked())); layout->addWidget(drop,0,2); QToolButton * mathEdit = new QToolButton(this); mathEdit->setIcon(QIcon(":images/formula_pi.png")); mathEdit->setToolTip(tr("Evaluate Expression")); mathEdit->setIconSize(iconSize); connect(mathEdit,SIGNAL(clicked(bool)),this,SLOT(onMathEdit())); layout->addWidget(mathEdit,0,3); QToolButton * editMask = new QToolButton(this); editMask->setIcon(QIcon(":images/mask_happy.png")); editMask->setToolTip(tr("Edit image mask")); editMask->setIconSize(iconSize); editMask->setCheckable(true); editMask->setAutoExclusive(true); connect(editMask,SIGNAL(clicked(bool)),this,SLOT(onEditMaskClicked())); layout->addWidget(editMask,0,4); /* QToolButton * filter = new QToolButton(this); filter->setIcon(QIcon(":images/optical_filter.png")); filter->setToolTip(tr("Filter Image")); filter->setIconSize(iconSize); filter->setCheckable(true); filter->setAutoExclusive(true); connect(filter,SIGNAL(clicked(bool)),this,SLOT(onFilterClicked())); layout->addWidget(filter,0,4);*/ QToolButton * selection = new QToolButton(this); selection->setIcon(QIcon(":images/selection.png")); selection->setToolTip(tr("Select image section")); selection->setIconSize(iconSize); selection->setCheckable(true); selection->setAutoExclusive(true); connect(selection,SIGNAL(clicked(bool)),this,SLOT(onSelectionClicked())); layout->addWidget(selection,0,5); QToolButton * lineout = new QToolButton(this); lineout->setIcon(QIcon(":images/lineout_plot.png")); lineout->setToolTip(tr("Plot linear profile")); lineout->setIconSize(iconSize); lineout->setCheckable(true); lineout->setAutoExclusive(true); connect(lineout,SIGNAL(clicked(bool)),this,SLOT(onLineoutClicked())); layout->addWidget(lineout,0,6); QToolButton * undo = new QToolButton(this); undo->setIcon(QIcon(":images/undo.png")); undo->setToolTip(tr("Undo last edit")); undo->setIconSize(iconSize); undo->setEnabled(false); connect(undo,SIGNAL(clicked(bool)),this,SLOT(onUndoClicked())); layout->addWidget(undo,1,0); QToolButton * redo = new QToolButton(this); redo->setIcon(QIcon(":images/redo.png")); redo->setToolTip(tr("Redo last undone edit")); redo->setIconSize(iconSize); redo->setEnabled(false); connect(redo,SIGNAL(clicked(bool)),this,SLOT(onRedoClicked())); layout->addWidget(redo,1,1); QToolButton * removeElectronics = new QToolButton(this); removeElectronics->setIcon(QIcon(":images/hardware.png")); removeElectronics->setToolTip(tr("Remove electronic noise")); removeElectronics->setIconSize(iconSize); removeElectronics->setCheckable(true); removeElectronics->setAutoExclusive(true); connect(removeElectronics,SIGNAL(clicked(bool)),this,SLOT(onRemoveElectronicsClicked())); layout->addWidget(removeElectronics,1,2); QToolButton * xcamMagic = new QToolButton(this); xcamMagic->setIcon(QIcon(":images/xcam.png")); xcamMagic->setToolTip(tr("Remove overscan and noise from xcam data")); xcamMagic->setIconSize(iconSize); connect(xcamMagic,SIGNAL(clicked(bool)),this,SLOT(onXcamMagicClicked())); layout->addWidget(xcamMagic,1,3); QToolButton * fillEmpty = new QToolButton(this); fillEmpty->setIcon(QIcon(":images/magic.png")); fillEmpty->setToolTip(tr("Fill data on the missing regions by interpolation")); fillEmpty->setIconSize(iconSize); fillEmpty->setCheckable(true); fillEmpty->setAutoExclusive(true); connect(fillEmpty,SIGNAL(clicked(bool)),this,SLOT(onFillEmptyClicked())); layout->addWidget(fillEmpty,1,4); QToolButton * crop = new QToolButton(this); crop->setIcon(QIcon(":images/crop.png")); crop->setToolTip(tr("Crop image to selection")); crop->setIconSize(iconSize); connect(crop,SIGNAL(clicked(bool)),this,SLOT(onCropClicked())); layout->addWidget(crop,1,5); // connect(mathEdit,SIGNAL(clicked(bool)),this,SLOT(onMathEdit())); toolOptions = new QWidget(this); QVBoxLayout * vbox = new QVBoxLayout(toolOptions); toolOptions->setLayout(vbox); QFrame * separator = new QFrame(toolOptions); separator->setFrameStyle(QFrame::HLine|QFrame::Raised); separator->setLineWidth(1); vbox->addWidget(separator); toolOptionsLayout = new QStackedLayout(); vbox->addLayout(toolOptionsLayout); toolOptionsLayout->addWidget(new QWidget(toolOptions)); toolOptionsLayout->addWidget(new QWidget(toolOptions)); dropToolOptions = new QWidget(toolOptions); QGridLayout * grid = new QGridLayout(dropToolOptions); dropToolOptions->setLayout(grid); grid->addWidget(new QLabel(tr("Brush Radius:"),dropToolOptions),0,0); QDoubleSpinBox * spinBox = new QDoubleSpinBox(dropToolOptions); connect(spinBox,SIGNAL(valueChanged(double)),editor->editorView(),SLOT(setDropBrushRadius(double))); spinBox->setMinimum(0); spinBox->setValue(editor->editorView()->getDropBrushRadius()); grid->addWidget(spinBox,0,1); grid->addWidget(new QLabel(tr("Blur Radius:"),dropToolOptions),1,0); spinBox = new QDoubleSpinBox(dropToolOptions); spinBox->setMinimum(0); spinBox->setValue(editor->editorView()->getDropBlurRadius()); connect(spinBox,SIGNAL(valueChanged(double)),editor->editorView(),SLOT(setDropBlurRadius(double))); grid->addWidget(spinBox,1,1); toolOptionsLayout->addWidget(dropToolOptions); editMaskToolOptions = new QWidget(toolOptions); grid = new QGridLayout(editMaskToolOptions); editMaskToolOptions->setLayout(grid); QLabel * label = new QLabel(tr("Mode:"),editMaskToolOptions); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); grid->addWidget(label,1,1); editMaskIncludeButton = new QToolButton(editMaskToolOptions); editMaskIncludeButton->setIcon(QIcon(":images/mask_happy.png")); editMaskIncludeButton->setToolTip("Include in mask"); editMaskIncludeButton->setCheckable(true); editMaskIncludeButton->setChecked(true); editMaskIncludeButton->setAutoExclusive(true); grid->addWidget(editMaskIncludeButton,1,2); editMaskExcludeButton = new QToolButton(editMaskToolOptions); editMaskExcludeButton->setIcon(QIcon(":images/mask_sad.png")); editMaskExcludeButton->setToolTip("Exclude from mask"); editMaskExcludeButton->setCheckable(true); editMaskExcludeButton->setAutoExclusive(true); grid->addWidget(editMaskExcludeButton,1,3); label = new QLabel(tr("Brush Radius:"),editMaskToolOptions); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); grid->addWidget(label,2,1); m_editMaskBrushRadius = new QSpinBox(editMaskToolOptions); connect(m_editMaskBrushRadius,SIGNAL(valueChanged(int)),editor->editorView(),SLOT(updateEditMaskCursor(int))); m_editMaskBrushRadius->setValue(5); grid->addWidget(m_editMaskBrushRadius,2,2,1,2); QPushButton * loadMaskFromFile = new QPushButton("Load mask from file", editMaskToolOptions); loadMaskFromFile->setToolTip("Load a mask from a black and white png file.\n" "White is included in the mask and black excluded."); connect(loadMaskFromFile,SIGNAL(clicked()),this,SLOT(onLoadMaskFromFile())); grid->addWidget(loadMaskFromFile,3,1,1,3); QPushButton * invertMask = new QPushButton("Invert mask", editMaskToolOptions); invertMask->setToolTip("Inverts the mask of the current image."); connect(invertMask,SIGNAL(clicked()),this,SLOT(onInvertMask())); grid->addWidget(invertMask,4,1,1,3); grid->setRowStretch(0,100); grid->setColumnStretch(0,100); grid->setRowStretch(5,100); grid->setColumnStretch(5,100); toolOptionsLayout->addWidget(editMaskToolOptions); filterToolOptions = new QWidget(toolOptions); grid = new QGridLayout(filterToolOptions); filterToolOptions->setLayout(grid); grid->addWidget(new QLabel(tr("Filter Type:"),filterToolOptions),0,0); QComboBox * comboBox = new QComboBox(filterToolOptions); comboBox->addItem("Gaussian Radial"); comboBox->addItem("Horizontal bands removal"); comboBox->setMinimumContentsLength(10); comboBox->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon); grid->addWidget(comboBox,0,1); grid->setRowStretch(2,100); grid->setColumnStretch(2,100); toolOptionsLayout->addWidget(filterToolOptions); selectionToolOptions = new QWidget(toolOptions); grid = new QGridLayout(selectionToolOptions); selectionToolOptions->setLayout(grid); label = new QLabel("Mode:",selectionToolOptions); label->setAlignment(Qt::AlignRight); grid->addWidget(label,0,0); QToolButton * button = new QToolButton(selectionToolOptions); button->setIcon(QIcon(":images/selection.png")); button->setToolTip("Set selection"); button->setCheckable(true); button->setChecked(true); button->setAutoExclusive(true); connect(button,SIGNAL(clicked()),this,SLOT(setSelectionModeSet())); grid->addWidget(button,0,1); button = new QToolButton(selectionToolOptions); button->setIcon(QIcon(":images/selection_union.png")); button->setToolTip("Add to selection"); button->setCheckable(true); button->setAutoExclusive(true); connect(button,SIGNAL(clicked()),this,SLOT(setSelectionModeUnite())); grid->addWidget(button,0,2); button = new QToolButton(selectionToolOptions); button->setIcon(QIcon(":images/selection_subtract.png")); button->setToolTip("Remove from selection"); button->setCheckable(true); button->setAutoExclusive(true); connect(button,SIGNAL(clicked()),this,SLOT(setSelectionModeSubtract())); grid->addWidget(button,0,3); label = new QLabel("Expression:",selectionToolOptions); label->setAlignment(Qt::AlignRight); grid->addWidget(label,1,0); selectExpression = new QLineEdit("A > 10",selectionToolOptions); grid->addWidget(selectExpression,1,1,1,3); QPushButton * evalExpression = new QPushButton("Select by Expression",selectionToolOptions); connect(evalExpression,SIGNAL(clicked()),this,SLOT(onSelectByExpression())); grid->addWidget(evalExpression,2,0,1,4); grid->setRowStretch(5,100); grid->setColumnStretch(5,100); _selectionMode = SelectionSet; toolOptionsLayout->addWidget(selectionToolOptions); electronicsToolOptions = new QWidget(toolOptions); grid = new QGridLayout(electronicsToolOptions); electronicsToolOptions->setLayout(grid); QPushButton * push = new QPushButton("Remove Vertical Lines",electronicsToolOptions); grid->addWidget(push,0,0); connect(push,SIGNAL(clicked()),this,SLOT(onRemoveVerticalLinesClicked())); push = new QPushButton("Remove Horizontal Lines",electronicsToolOptions); grid->addWidget(push,1,0); connect(push,SIGNAL(clicked()),this,SLOT(onRemoveHorizontalLinesClicked())); toolOptionsLayout->addWidget(electronicsToolOptions); fillEmptyToolOptions = new QWidget(toolOptions); grid = new QGridLayout(fillEmptyToolOptions); fillEmptyToolOptions->setLayout(grid); grid->addWidget(new QLabel("Blur Radius (px)",0,0)); fillBlurRadius = new QDoubleSpinBox(fillEmptyToolOptions); grid->addWidget(fillBlurRadius,0,1); grid->addWidget(new QLabel("Iterations"),1,0); fillIterations = new QSpinBox(fillEmptyToolOptions); fillIterations->setMinimum(1); grid->addWidget(fillIterations,1,1); grid->addWidget(new QLabel("Blur Kernel"),2,0); fillBlurKernel = new QComboBox(fillEmptyToolOptions); fillBlurKernel->addItem("Gaussian"); fillBlurKernel->addItem("Sinc"); grid->addWidget(fillBlurKernel,2,1); push = new QPushButton("Interpolate",fillEmptyToolOptions); grid->addWidget(push,3,0,1,2); connect(push,SIGNAL(clicked()),this,SLOT(onInterpolateEmptyClicked())); toolOptionsLayout->addWidget(fillEmptyToolOptions); toolOptions->hide(); layout->addWidget(toolOptions,2,0,1,11); layout->setColumnStretch(11,100); layout->setRowStretch(3,100); }