如何在PyQt5的URL栏中使用特定关键字进行搜索



我是Python的新手,我需要帮助所以,我用PyQt5做了一个web浏览器,它运行得很好。但是,我想让代码看起来好像我们可以在URL栏中输入任何东西它会显示各种链接。我将附加一个代码和浏览器的图像

我通过观看Programming Hero的视频做到了这一点。请帮帮我。

视频链接:https://www.youtube.com/watch?v=z-5bZ8EoKu4

line_edit = QLineEdit()
complete_list = ['yahoo.com', 'google.com', 'google.co.uk'] #This will be the only strings used for the auto complete
completer = QCompleter(complete_list)
line_edit.setCompleter(completer)

您也可以使用QStandardItemModel来代替使用列表

最新更新