Fixed: Click different tabs without leaving the menu. The old one will not close the editing mode
parent
c6bdbc639c
commit
07530794f6
|
@ -186,9 +186,9 @@ class MainWindow(QMainWindow):
|
|||
self.labelList = EditInList()
|
||||
labelListContainer = QWidget()
|
||||
labelListContainer.setLayout(listLayout)
|
||||
# self.labelList.itemActivated.connect(self.labelSelectionChanged)
|
||||
self.labelList.itemSelectionChanged.connect(self.labelSelectionChanged)
|
||||
self.labelList.clicked.connect(self.labelList.item_clicked)
|
||||
|
||||
# Connect to itemChanged to detect checkbox changes.
|
||||
self.labelList.itemChanged.connect(self.labelItemChanged)
|
||||
self.labelListDock = QDockWidget(getStr('recognitionResult'), self)
|
||||
|
@ -1888,7 +1888,10 @@ class MainWindow(QMainWindow):
|
|||
self.canvas.isInTheSameImage = False
|
||||
self.setDirty()
|
||||
elif len(self.result_dic) == len(self.canvas.shapes) and rec_flag == 0:
|
||||
QMessageBox.information(self, "Information", "The recognition result remains unchanged!")
|
||||
if self.lang == 'ch':
|
||||
QMessageBox.information(self, "Information", "识别结果保持一致!")
|
||||
else:
|
||||
QMessageBox.information(self, "Information", "The recognition result remains unchanged!")
|
||||
else:
|
||||
print('Can not recgonise in ', self.filePath)
|
||||
else:
|
||||
|
|
|
@ -1,31 +1,29 @@
|
|||
import sys, time
|
||||
from PyQt5 import QtWidgets
|
||||
from PyQt5.QtGui import *
|
||||
from PyQt5.QtCore import *
|
||||
from PyQt5.QtWidgets import *
|
||||
# !/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
from PyQt5.QtCore import QModelIndex
|
||||
from PyQt5.QtWidgets import QListWidget
|
||||
|
||||
|
||||
class EditInList(QListWidget):
|
||||
def __init__(self):
|
||||
super(EditInList,self).__init__()
|
||||
# click to edit
|
||||
self.clicked.connect(self.item_clicked)
|
||||
super(EditInList, self).__init__()
|
||||
self.edited_item = None
|
||||
|
||||
def item_clicked(self, modelindex: QModelIndex) -> None:
|
||||
self.edited_item = self.currentItem()
|
||||
self.closePersistentEditor(self.edited_item)
|
||||
item = self.item(modelindex.row())
|
||||
# time.sleep(0.2)
|
||||
self.edited_item = item
|
||||
self.openPersistentEditor(item)
|
||||
# time.sleep(0.2)
|
||||
self.editItem(item)
|
||||
def item_clicked(self, modelindex: QModelIndex):
|
||||
try:
|
||||
if self.edited_item is not None:
|
||||
self.closePersistentEditor(self.edited_item)
|
||||
except:
|
||||
self.edited_item = self.currentItem()
|
||||
|
||||
self.edited_item = self.item(modelindex.row())
|
||||
self.openPersistentEditor(self.edited_item)
|
||||
self.editItem(self.edited_item)
|
||||
|
||||
def mouseDoubleClickEvent(self, event):
|
||||
# close edit
|
||||
for i in range(self.count()):
|
||||
self.closePersistentEditor(self.item(i))
|
||||
pass
|
||||
|
||||
def leaveEvent(self, event):
|
||||
# close edit
|
||||
for i in range(self.count()):
|
||||
self.closePersistentEditor(self.item(i))
|
||||
self.closePersistentEditor(self.item(i))
|
||||
|
|
Loading…
Reference in New Issue