src/eric7/WebBrowser/ClosedTabsManager.py

branch
eric7
changeset 9500
5771348ded12
parent 9473
3f23dbf37dbe
child 9653
e67609152c5e
--- a/src/eric7/WebBrowser/ClosedTabsManager.py	Wed Nov 09 11:32:13 2022 +0100
+++ b/src/eric7/WebBrowser/ClosedTabsManager.py	Wed Nov 09 15:05:06 2022 +0100
@@ -7,38 +7,20 @@
 Module implementing a class to manage closed tabs.
 """
 
+from dataclasses import dataclass, field
+
 from PyQt6.QtCore import QObject, QUrl, pyqtSignal
 
 
+@dataclass
 class ClosedTab:
     """
     Class implementing a structure to store data about a closed tab.
     """
 
-    def __init__(self, url=None, title="", position=-1):
-        """
-        Constructor
-
-        @param url URL of the closed tab (QUrl)
-        @param title title of the closed tab (string)
-        @param position index of the closed tab (integer)
-        """
-        self.url = QUrl() if url is None else QUrl(url)
-        self.title = title
-        self.position = position
-
-    def __eq__(self, other):
-        """
-        Special method implementing the equality operator.
-
-        @param other reference to the object to compare against (ClosedTab)
-        @return flag indicating equality of the tabs (boolean)
-        """
-        return (
-            self.url == other.url
-            and self.title == other.title
-            and self.position == other.position
-        )
+    url: QUrl = field(default_factory=QUrl)
+    title: str = ""
+    position: int = -1
 
 
 class ClosedTabsManager(QObject):

eric ide

mercurial