Add Alt+Click to delete an item, add alpha values
This commit is contained in:
parent
5fa398a124
commit
0895f1f0ae
@ -191,6 +191,16 @@ void CropScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) {
|
||||
prevButtons = Qt::NoButton;
|
||||
}
|
||||
|
||||
void CropScene::mousePressEvent(QGraphicsSceneMouseEvent *e) {
|
||||
if (e->modifiers() & Qt::AltModifier) {
|
||||
QTransform stupidThing = views()[0]->transform();
|
||||
auto item = itemAt(e->screenPos(), stupidThing);
|
||||
if (item && item != polyItem && item != rect && item->zValue() != -1) {
|
||||
removeItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CropScene::wheelEvent(QGraphicsSceneWheelEvent *event) {
|
||||
int pixCnt = settings::settings().value("magnifierPixelCount", 11).toInt();
|
||||
if (pixCnt % 2 == 0) pixCnt++;
|
||||
|
@ -41,6 +41,7 @@ signals:
|
||||
protected:
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *e) override;
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *e) override;
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *e) override;
|
||||
void wheelEvent(QGraphicsSceneWheelEvent *event) override; // WHEEEEEEL
|
||||
void contextMenuEvent(QGraphicsSceneContextMenuEvent *e) override;
|
||||
|
||||
|
@ -25,9 +25,14 @@ BrushPenSelection::BrushPenSelection(CropScene *scene) : QDialog(), ui(new Ui::B
|
||||
ui->widthSpinner->setValue(scene->pen().widthF());
|
||||
ui->brushStyle->setCurrentIndex(settings::settings().value("brushStyle", 1).toInt());
|
||||
ui->pathItemHasBrush->setChecked(settings::settings().value("brushPath", false).toBool());
|
||||
|
||||
this->setFocus();
|
||||
pen = scene->pen().color();
|
||||
ui->penAlphaSlider->setValue(pen.alpha());
|
||||
ui->penAlphaSpin->setValue(pen.alpha());
|
||||
brush = scene->brush().color();
|
||||
ui->alphaSlider->setValue(brush.alpha());
|
||||
ui->alphaSpin->setValue(brush.alpha());
|
||||
this->scene = scene;
|
||||
}
|
||||
|
||||
@ -37,10 +42,12 @@ BrushPenSelection::~BrushPenSelection() {
|
||||
|
||||
void BrushPenSelection::on_penColor_clicked(bool) {
|
||||
pen = QColorDialog::getColor(pen, this, "Pen Color");
|
||||
pen.setAlpha(ui->penAlphaSpin->value());
|
||||
}
|
||||
|
||||
void BrushPenSelection::on_brushColor_clicked(bool) {
|
||||
brush = QColorDialog::getColor(brush, this, "Brush Color");
|
||||
brush.setAlpha(ui->alphaSpin->value());
|
||||
}
|
||||
|
||||
void BrushPenSelection::on_buttonBox_accepted() {
|
||||
@ -82,3 +89,11 @@ void BrushPenSelection::on_radSpinner_valueChanged(double arg1) {
|
||||
void BrushPenSelection::on_radSlider_sliderMoved(int position) {
|
||||
ui->radSpinner->setValue(position / 100.);
|
||||
}
|
||||
|
||||
void BrushPenSelection::on_alphaSpin_valueChanged(int arg1) {
|
||||
brush.setAlpha(arg1);
|
||||
}
|
||||
|
||||
void BrushPenSelection::on_penAlphaSpin_valueChanged(int arg1) {
|
||||
pen.setAlpha(arg1);
|
||||
}
|
||||
|
@ -15,7 +15,8 @@ public:
|
||||
explicit BrushPenSelection(CropScene *scene);
|
||||
~BrushPenSelection();
|
||||
|
||||
public slots:
|
||||
private slots:
|
||||
void on_alphaSpin_valueChanged(int arg1);
|
||||
void on_radSlider_sliderMoved(int position);
|
||||
void on_radSpinner_valueChanged(double arg1);
|
||||
void on_penColor_clicked(bool);
|
||||
@ -24,6 +25,7 @@ public slots:
|
||||
void on_buttonBox_rejected();
|
||||
void on_widthSlider_sliderMoved(int position);
|
||||
void on_widthSpinner_valueChanged(double arg1);
|
||||
void on_penAlphaSpin_valueChanged(int arg1);
|
||||
|
||||
private:
|
||||
Ui::BrushPenSelection *ui;
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>449</width>
|
||||
<height>367</height>
|
||||
<height>489</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
@ -23,13 +23,30 @@
|
||||
<string>Pen settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="3" column="0" colspan="2">
|
||||
<item row="1" column="0">
|
||||
<widget class="QSlider" name="widthSlider">
|
||||
<property name="maximum">
|
||||
<number>2500</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QPushButton" name="penColor">
|
||||
<property name="text">
|
||||
<string>Choose pen color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="cosmetic">
|
||||
<property name="text">
|
||||
<string>Cosmetic</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
@ -37,26 +54,33 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="widthSpinner"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="cosmetic">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Cosmetic</string>
|
||||
<string>Pen alpha</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QSlider" name="widthSlider">
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="widthSpinner"/>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QSlider" name="penAlphaSlider">
|
||||
<property name="maximum">
|
||||
<number>2500</number>
|
||||
<number>255</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QSpinBox" name="penAlphaSpin">
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -66,14 +90,7 @@
|
||||
<string>Brush settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="brushColor">
|
||||
<property name="text">
|
||||
<string>Choose brush color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QComboBox" name="brushStyle">
|
||||
<item>
|
||||
<property name="text">
|
||||
@ -152,13 +169,44 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="pathItemHasBrush">
|
||||
<property name="text">
|
||||
<string>Path item has brush</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="alphaSpin">
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QSlider" name="alphaSlider">
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QPushButton" name="brushColor">
|
||||
<property name="text">
|
||||
<string>Choose brush color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Brush alpha</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -261,5 +309,70 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>alphaSlider</sender>
|
||||
<signal>sliderMoved(int)</signal>
|
||||
<receiver>alphaSpin</receiver>
|
||||
<slot>setValue(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>91</x>
|
||||
<y>292</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>196</x>
|
||||
<y>292</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>alphaSpin</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>alphaSlider</receiver>
|
||||
<slot>setValue(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>196</x>
|
||||
<y>292</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>91</x>
|
||||
<y>292</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>penAlphaSpin</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>penAlphaSlider</receiver>
|
||||
<slot>setValue(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>191</x>
|
||||
<y>211</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>86</x>
|
||||
<y>211</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>penAlphaSlider</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>penAlphaSpin</receiver>
|
||||
<slot>setValue(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>86</x>
|
||||
<y>211</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>191</x>
|
||||
<y>211</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
Loading…
Reference in New Issue
Block a user