V2.5.2 — Selection redimensionnable + fix crop + bouton Effacer

- Rectangle de selection redimensionnable par les 8 poignees (angles + cotes)
- Curseurs adaptes selon la poignee survolee
- Deplacement du rectangle entier en cliquant a l'interieur
- Zone sombre en dehors, cadre cyan, poignees blanches
- Bouton Effacer dans le dialogue recadrage
- Fix remontee des valeurs de selection dans les spinbox

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jules
2026-03-21 14:59:06 +01:00
parent e94158aae8
commit c6d3ddcf9d
4 changed files with 209 additions and 99 deletions

View File

@@ -39,14 +39,24 @@ class CropDialog(QDialog):
self.btn_select = QPushButton("Selectionner sur l'apercu")
self.btn_select.setCheckable(True)
self.btn_select.setStyleSheet("""
QPushButton { background: #0066cc; color: white; padding: 8px 16px;
border-radius: 4px; font-weight: bold; }
QPushButton:checked { background: #cc3300; }
QPushButton:hover { background: #0055aa; }
QPushButton:checked:hover { background: #aa2200; }
QPushButton { background: #00b4d8; color: white; padding: 6px 14px;
border-radius: 6px; font-weight: bold; font-size: 11px; }
QPushButton:checked { background: #e74c3c; }
QPushButton:hover { background: #0096b7; }
QPushButton:checked:hover { background: #c0392b; }
""")
self.btn_select.toggled.connect(self._toggle_select_mode)
sel_layout.addWidget(self.btn_select)
self.btn_clear = QPushButton("Effacer")
self.btn_clear.setStyleSheet("""
QPushButton { background: #e8e8e8; color: #555; padding: 6px 14px;
border-radius: 6px; font-size: 11px; border: 1px solid #ccc; }
QPushButton:hover { background: #ddd; }
""")
self.btn_clear.clicked.connect(self._clear_selection)
sel_layout.addWidget(self.btn_clear)
sel_layout.addStretch()
layout.addLayout(sel_layout)
@@ -173,10 +183,19 @@ class CropDialog(QDialog):
if self._viewer:
self._viewer.set_select_mode(checked)
if checked:
self.btn_select.setText("Cliquez et tracez sur l'apercu...")
self.btn_select.setText("Mode selection actif")
else:
self.btn_select.setText("Selectionner sur l'apercu")
def _clear_selection(self):
if self._viewer:
self._viewer.clear_selection()
for spin in self.margin_spins.values():
spin.blockSignals(True)
spin.setValue(0)
spin.blockSignals(False)
self._update_preview()
def _on_selection_changed(self, left, top, right, bottom):
"""Recoit les ratios de selection du viewer et met a jour les marges."""
if not self.rb_margins.isChecked():