We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
QLayoutWidget Add Label Error: No method AddItem
The code in QLayoutWidget looks something like:

```
    def addLabel(self, text=' ', row=None, col=None, rowspan=1, colspan=1, **kargs):
        """
        Create a QLabel with *text* and place it in the next available cell (or in the cell specified)
        All extra keyword arguments are passed to QLabel().
        Returns the created widget.
        """
        text = QtGui.QLabel(text, **kargs)
        self.addItem(text, row, col, rowspan, colspan)
        return text
```

I think it should have `self.addWidget` instead of `self.addItem` as addItem method is missing.

Error:

```
AttributeError: 'LayoutWidget' object has no attribute 'addItem'
```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `pyqtgraph/widgets/LayoutWidget.py`
Content:
```
1 from ..Qt import QtGui, QtCore
2 
3 __all__ = ['LayoutWidget']
4 class LayoutWidget(QtGui.QWidget):
5     """
6     Convenience class used for laying out QWidgets in a grid.
7     (It's just a little less effort to use than QGridLayout)
8     """
9 
10     def __init__(self, parent=None):
11         QtGui.QWidget.__init__(self, parent)
12         self.layout = QtGui.QGridLayout()
13         self.setLayout(self.layout)
14         self.items = {}
15         self.rows = {}
16         self.currentRow = 0
17         self.currentCol = 0
18     
19     def nextRow(self):
20         """Advance to next row for automatic widget placement"""
21         self.currentRow += 1
22         self.currentCol = 0
23         
24     def nextColumn(self, colspan=1):
25         """Advance to next column, while returning the current column number 
26         (generally only for internal use--called by addWidget)"""
27         self.currentCol += colspan
28         return self.currentCol-colspan
29         
30     def nextCol(self, *args, **kargs):
31         """Alias of nextColumn"""
32         return self.nextColumn(*args, **kargs)
33         
34         
35     def addLabel(self, text=' ', row=None, col=None, rowspan=1, colspan=1, **kargs):
36         """
37         Create a QLabel with *text* and place it in the next available cell (or in the cell specified)
38         All extra keyword arguments are passed to QLabel().
39         Returns the created widget.
40         """
41         text = QtGui.QLabel(text, **kargs)
42         self.addItem(text, row, col, rowspan, colspan)
43         return text
44         
45     def addLayout(self, row=None, col=None, rowspan=1, colspan=1, **kargs):
46         """
47         Create an empty LayoutWidget and place it in the next available cell (or in the cell specified)
48         All extra keyword arguments are passed to :func:`LayoutWidget.__init__ <pyqtgraph.LayoutWidget.__init__>`
49         Returns the created widget.
50         """
51         layout = LayoutWidget(**kargs)
52         self.addItem(layout, row, col, rowspan, colspan)
53         return layout
54         
55     def addWidget(self, item, row=None, col=None, rowspan=1, colspan=1):
56         """
57         Add a widget to the layout and place it in the next available cell (or in the cell specified).
58         """
59         if row == 'next':
60             self.nextRow()
61             row = self.currentRow
62         elif row is None:
63             row = self.currentRow
64             
65         
66         if col is None:
67             col = self.nextCol(colspan)
68             
69         if row not in self.rows:
70             self.rows[row] = {}
71         self.rows[row][col] = item
72         self.items[item] = (row, col)
73         
74         self.layout.addWidget(item, row, col, rowspan, colspan)
75 
76     def getWidget(self, row, col):
77         """Return the widget in (*row*, *col*)"""
78         return self.row[row][col]
79 
80     #def itemIndex(self, item):
81         #for i in range(self.layout.count()):
82             #if self.layout.itemAt(i).graphicsItem() is item:
83                 #return i
84         #raise Exception("Could not determine index of item " + str(item))
85     
86     #def removeItem(self, item):
87         #"""Remove *item* from the layout."""
88         #ind = self.itemIndex(item)
89         #self.layout.removeAt(ind)
90         #self.scene().removeItem(item)
91         #r,c = self.items[item]
92         #del self.items[item]
93         #del self.rows[r][c]
94         #self.update()
95     
96     #def clear(self):
97         #items = []
98         #for i in list(self.items.keys()):
99             #self.removeItem(i)
100 
101 
102
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/pyqtgraph/widgets/LayoutWidget.py b/pyqtgraph/widgets/LayoutWidget.py
--- a/pyqtgraph/widgets/LayoutWidget.py
+++ b/pyqtgraph/widgets/LayoutWidget.py
@@ -39,7 +39,7 @@
         Returns the created widget.
         """
         text = QtGui.QLabel(text, **kargs)
-        self.addItem(text, row, col, rowspan, colspan)
+        self.addWidget(text, row, col, rowspan, colspan)
         return text
         
     def addLayout(self, row=None, col=None, rowspan=1, colspan=1, **kargs):
@@ -49,7 +49,7 @@
         Returns the created widget.
         """
         layout = LayoutWidget(**kargs)
-        self.addItem(layout, row, col, rowspan, colspan)
+        self.addWidget(layout, row, col, rowspan, colspan)
         return layout
         
     def addWidget(self, item, row=None, col=None, rowspan=1, colspan=1):

{"golden_diff": "diff --git a/pyqtgraph/widgets/LayoutWidget.py b/pyqtgraph/widgets/LayoutWidget.py\n--- a/pyqtgraph/widgets/LayoutWidget.py\n+++ b/pyqtgraph/widgets/LayoutWidget.py\n@@ -39,7 +39,7 @@\n         Returns the created widget.\n         \"\"\"\n         text = QtGui.QLabel(text, **kargs)\n-        self.addItem(text, row, col, rowspan, colspan)\n+        self.addWidget(text, row, col, rowspan, colspan)\n         return text\n         \n     def addLayout(self, row=None, col=None, rowspan=1, colspan=1, **kargs):\n@@ -49,7 +49,7 @@\n         Returns the created widget.\n         \"\"\"\n         layout = LayoutWidget(**kargs)\n-        self.addItem(layout, row, col, rowspan, colspan)\n+        self.addWidget(layout, row, col, rowspan, colspan)\n         return layout\n         \n     def addWidget(self, item, row=None, col=None, rowspan=1, colspan=1):\n", "issue": "QLayoutWidget Add Label Error: No method AddItem\nThe code in QLayoutWidget looks something like:\n\n```\n    def addLabel(self, text=' ', row=None, col=None, rowspan=1, colspan=1, **kargs):\n        \"\"\"\n        Create a QLabel with *text* and place it in the next available cell (or in the cell specified)\n        All extra keyword arguments are passed to QLabel().\n        Returns the created widget.\n        \"\"\"\n        text = QtGui.QLabel(text, **kargs)\n        self.addItem(text, row, col, rowspan, colspan)\n        return text\n```\n\nI think it should have `self.addWidget` instead of `self.addItem` as addItem method is missing.\n\nError:\n\n```\nAttributeError: 'LayoutWidget' object has no attribute 'addItem'\n```\n\n", "before_files": [{"content": "from ..Qt import QtGui, QtCore\n\n__all__ = ['LayoutWidget']\nclass LayoutWidget(QtGui.QWidget):\n    \"\"\"\n    Convenience class used for laying out QWidgets in a grid.\n    (It's just a little less effort to use than QGridLayout)\n    \"\"\"\n\n    def __init__(self, parent=None):\n        QtGui.QWidget.__init__(self, parent)\n        self.layout = QtGui.QGridLayout()\n        self.setLayout(self.layout)\n        self.items = {}\n        self.rows = {}\n        self.currentRow = 0\n        self.currentCol = 0\n    \n    def nextRow(self):\n        \"\"\"Advance to next row for automatic widget placement\"\"\"\n        self.currentRow += 1\n        self.currentCol = 0\n        \n    def nextColumn(self, colspan=1):\n        \"\"\"Advance to next column, while returning the current column number \n        (generally only for internal use--called by addWidget)\"\"\"\n        self.currentCol += colspan\n        return self.currentCol-colspan\n        \n    def nextCol(self, *args, **kargs):\n        \"\"\"Alias of nextColumn\"\"\"\n        return self.nextColumn(*args, **kargs)\n        \n        \n    def addLabel(self, text=' ', row=None, col=None, rowspan=1, colspan=1, **kargs):\n        \"\"\"\n        Create a QLabel with *text* and place it in the next available cell (or in the cell specified)\n        All extra keyword arguments are passed to QLabel().\n        Returns the created widget.\n        \"\"\"\n        text = QtGui.QLabel(text, **kargs)\n        self.addItem(text, row, col, rowspan, colspan)\n        return text\n        \n    def addLayout(self, row=None, col=None, rowspan=1, colspan=1, **kargs):\n        \"\"\"\n        Create an empty LayoutWidget and place it in the next available cell (or in the cell specified)\n        All extra keyword arguments are passed to :func:`LayoutWidget.__init__ <pyqtgraph.LayoutWidget.__init__>`\n        Returns the created widget.\n        \"\"\"\n        layout = LayoutWidget(**kargs)\n        self.addItem(layout, row, col, rowspan, colspan)\n        return layout\n        \n    def addWidget(self, item, row=None, col=None, rowspan=1, colspan=1):\n        \"\"\"\n        Add a widget to the layout and place it in the next available cell (or in the cell specified).\n        \"\"\"\n        if row == 'next':\n            self.nextRow()\n            row = self.currentRow\n        elif row is None:\n            row = self.currentRow\n            \n        \n        if col is None:\n            col = self.nextCol(colspan)\n            \n        if row not in self.rows:\n            self.rows[row] = {}\n        self.rows[row][col] = item\n        self.items[item] = (row, col)\n        \n        self.layout.addWidget(item, row, col, rowspan, colspan)\n\n    def getWidget(self, row, col):\n        \"\"\"Return the widget in (*row*, *col*)\"\"\"\n        return self.row[row][col]\n\n    #def itemIndex(self, item):\n        #for i in range(self.layout.count()):\n            #if self.layout.itemAt(i).graphicsItem() is item:\n                #return i\n        #raise Exception(\"Could not determine index of item \" + str(item))\n    \n    #def removeItem(self, item):\n        #\"\"\"Remove *item* from the layout.\"\"\"\n        #ind = self.itemIndex(item)\n        #self.layout.removeAt(ind)\n        #self.scene().removeItem(item)\n        #r,c = self.items[item]\n        #del self.items[item]\n        #del self.rows[r][c]\n        #self.update()\n    \n    #def clear(self):\n        #items = []\n        #for i in list(self.items.keys()):\n            #self.removeItem(i)\n\n\n", "path": "pyqtgraph/widgets/LayoutWidget.py"}], "after_files": [{"content": "from ..Qt import QtGui, QtCore\n\n__all__ = ['LayoutWidget']\nclass LayoutWidget(QtGui.QWidget):\n    \"\"\"\n    Convenience class used for laying out QWidgets in a grid.\n    (It's just a little less effort to use than QGridLayout)\n    \"\"\"\n\n    def __init__(self, parent=None):\n        QtGui.QWidget.__init__(self, parent)\n        self.layout = QtGui.QGridLayout()\n        self.setLayout(self.layout)\n        self.items = {}\n        self.rows = {}\n        self.currentRow = 0\n        self.currentCol = 0\n    \n    def nextRow(self):\n        \"\"\"Advance to next row for automatic widget placement\"\"\"\n        self.currentRow += 1\n        self.currentCol = 0\n        \n    def nextColumn(self, colspan=1):\n        \"\"\"Advance to next column, while returning the current column number \n        (generally only for internal use--called by addWidget)\"\"\"\n        self.currentCol += colspan\n        return self.currentCol-colspan\n        \n    def nextCol(self, *args, **kargs):\n        \"\"\"Alias of nextColumn\"\"\"\n        return self.nextColumn(*args, **kargs)\n        \n        \n    def addLabel(self, text=' ', row=None, col=None, rowspan=1, colspan=1, **kargs):\n        \"\"\"\n        Create a QLabel with *text* and place it in the next available cell (or in the cell specified)\n        All extra keyword arguments are passed to QLabel().\n        Returns the created widget.\n        \"\"\"\n        text = QtGui.QLabel(text, **kargs)\n        self.addWidget(text, row, col, rowspan, colspan)\n        return text\n        \n    def addLayout(self, row=None, col=None, rowspan=1, colspan=1, **kargs):\n        \"\"\"\n        Create an empty LayoutWidget and place it in the next available cell (or in the cell specified)\n        All extra keyword arguments are passed to :func:`LayoutWidget.__init__ <pyqtgraph.LayoutWidget.__init__>`\n        Returns the created widget.\n        \"\"\"\n        layout = LayoutWidget(**kargs)\n        self.addWidget(layout, row, col, rowspan, colspan)\n        return layout\n        \n    def addWidget(self, item, row=None, col=None, rowspan=1, colspan=1):\n        \"\"\"\n        Add a widget to the layout and place it in the next available cell (or in the cell specified).\n        \"\"\"\n        if row == 'next':\n            self.nextRow()\n            row = self.currentRow\n        elif row is None:\n            row = self.currentRow\n            \n        \n        if col is None:\n            col = self.nextCol(colspan)\n            \n        if row not in self.rows:\n            self.rows[row] = {}\n        self.rows[row][col] = item\n        self.items[item] = (row, col)\n        \n        self.layout.addWidget(item, row, col, rowspan, colspan)\n\n    def getWidget(self, row, col):\n        \"\"\"Return the widget in (*row*, *col*)\"\"\"\n        return self.row[row][col]\n\n    #def itemIndex(self, item):\n        #for i in range(self.layout.count()):\n            #if self.layout.itemAt(i).graphicsItem() is item:\n                #return i\n        #raise Exception(\"Could not determine index of item \" + str(item))\n    \n    #def removeItem(self, item):\n        #\"\"\"Remove *item* from the layout.\"\"\"\n        #ind = self.itemIndex(item)\n        #self.layout.removeAt(ind)\n        #self.scene().removeItem(item)\n        #r,c = self.items[item]\n        #del self.items[item]\n        #del self.rows[r][c]\n        #self.update()\n    \n    #def clear(self):\n        #items = []\n        #for i in list(self.items.keys()):\n            #self.removeItem(i)\n\n\n", "path": "pyqtgraph/widgets/LayoutWidget.py"}]}