提交 07530794 编写于 作者: H HinGwenWoong

Fixed: Click different tabs without leaving the menu. The old one will not close the editing mode

上级 c6bdbc63
...@@ -186,9 +186,9 @@ class MainWindow(QMainWindow): ...@@ -186,9 +186,9 @@ class MainWindow(QMainWindow):
self.labelList = EditInList() self.labelList = EditInList()
labelListContainer = QWidget() labelListContainer = QWidget()
labelListContainer.setLayout(listLayout) labelListContainer.setLayout(listLayout)
# self.labelList.itemActivated.connect(self.labelSelectionChanged)
self.labelList.itemSelectionChanged.connect(self.labelSelectionChanged) self.labelList.itemSelectionChanged.connect(self.labelSelectionChanged)
self.labelList.clicked.connect(self.labelList.item_clicked) self.labelList.clicked.connect(self.labelList.item_clicked)
# Connect to itemChanged to detect checkbox changes. # Connect to itemChanged to detect checkbox changes.
self.labelList.itemChanged.connect(self.labelItemChanged) self.labelList.itemChanged.connect(self.labelItemChanged)
self.labelListDock = QDockWidget(getStr('recognitionResult'), self) self.labelListDock = QDockWidget(getStr('recognitionResult'), self)
...@@ -1888,6 +1888,9 @@ class MainWindow(QMainWindow): ...@@ -1888,6 +1888,9 @@ class MainWindow(QMainWindow):
self.canvas.isInTheSameImage = False self.canvas.isInTheSameImage = False
self.setDirty() self.setDirty()
elif len(self.result_dic) == len(self.canvas.shapes) and rec_flag == 0: elif len(self.result_dic) == len(self.canvas.shapes) and rec_flag == 0:
if self.lang == 'ch':
QMessageBox.information(self, "Information", "识别结果保持一致!")
else:
QMessageBox.information(self, "Information", "The recognition result remains unchanged!") QMessageBox.information(self, "Information", "The recognition result remains unchanged!")
else: else:
print('Can not recgonise in ', self.filePath) print('Can not recgonise in ', self.filePath)
......
import sys, time # !/usr/bin/env python
from PyQt5 import QtWidgets # -*- coding: utf-8 -*-
from PyQt5.QtGui import * from PyQt5.QtCore import QModelIndex
from PyQt5.QtCore import * from PyQt5.QtWidgets import QListWidget
from PyQt5.QtWidgets import *
class EditInList(QListWidget): class EditInList(QListWidget):
def __init__(self): def __init__(self):
super(EditInList,self).__init__() super(EditInList, self).__init__()
# click to edit self.edited_item = None
self.clicked.connect(self.item_clicked)
def item_clicked(self, modelindex: QModelIndex) -> None: def item_clicked(self, modelindex: QModelIndex):
self.edited_item = self.currentItem() try:
if self.edited_item is not None:
self.closePersistentEditor(self.edited_item) self.closePersistentEditor(self.edited_item)
item = self.item(modelindex.row()) except:
# time.sleep(0.2) self.edited_item = self.currentItem()
self.edited_item = item
self.openPersistentEditor(item) self.edited_item = self.item(modelindex.row())
# time.sleep(0.2) self.openPersistentEditor(self.edited_item)
self.editItem(item) self.editItem(self.edited_item)
def mouseDoubleClickEvent(self, event): def mouseDoubleClickEvent(self, event):
# close edit pass
for i in range(self.count()):
self.closePersistentEditor(self.item(i))
def leaveEvent(self, event): def leaveEvent(self, event):
# close edit # close edit
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册