Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yjg30737/pyqt-search-bar-menu
PyQt QMenu which contains search bar as first item
https://github.com/yjg30737/pyqt-search-bar-menu
pyqt pyqt-examples pyqt5 pyqt5-examples pyqt5-tutorial python python3 python37 qaction qmenu qt qwidget qwidgetaction
Last synced: about 2 months ago
JSON representation
PyQt QMenu which contains search bar as first item
- Host: GitHub
- URL: https://github.com/yjg30737/pyqt-search-bar-menu
- Owner: yjg30737
- License: mit
- Created: 2022-02-25T01:09:13.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-19T00:04:13.000Z (about 2 years ago)
- Last Synced: 2024-12-27T05:30:15.830Z (about 2 months ago)
- Topics: pyqt, pyqt-examples, pyqt5, pyqt5-examples, pyqt5-tutorial, python, python3, python37, qaction, qmenu, qt, qwidget, qwidgetaction
- Language: Python
- Homepage:
- Size: 26.4 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pyqt-search-bar-menu
PyQt QMenu which contains auto search bar as first item## Requirements
* PyQt5 >= 5.8## Setup
`python -m pip install pyqt-search-bar-menu`## Included Packages
* pyqt-instant-search-bar - Search bar at the top## Feature
* Search bar is at the very top of the menu, let user search `QAction`'s text. At this time menu list works like a completer.## Examples
### Simple Code Sample
```python
searchBarMenu = SearchBarMenu('Menu', self)
searchBarMenu.addAction('Action')
```
### Executable Code Sample
```python
from PyQt5.QtWidgets import QMainWindow, QApplication
from pyqt_search_bar_menu import SearchBarMenuclass MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.__initUi()def __initUi(self):
menubar = self.menuBar()
filemenu = menubar.addMenu('File')searchBarMenu = SearchBarMenu('A Bunch of Actions', self)
for i in range(5):
searchBarMenu.addAction(f'Action{i+1}')filemenu.addMenu(searchBarMenu)
menubar.addMenu(filemenu)
self.setMenuBar(menubar)if __name__ == "__main__":
import sysapp = QApplication(sys.argv)
ex = MainWindow()
ex.show()
app.exec_()
```### Result
