Title: Add a vertical separator between icons and text in a menu
Tags: python;qt;menu;pyqt;pyqt5
Question: I have a question about how to add a separator between icons and text in menu. If you have any ideas, it would be really helpful. Here is exactly what I need to do:

.

From a button, open a menu and add separators like in the image.

Comment: Looks more like a Menubar to me [docs](http://pyqt.sourceforge.net/Docs/PyQt4/qmenubar.html). In menu you can add icons and text, usually done through QAction.

Comment: Yes you were right ! it's a QMenubar :) Thanks

Here is the accepted answer: if you are using a QMenu() object you can use addSeparator():

```menu = QMenu()
add_action = menu.addAction("Add")
menu.addSeparator()
rename_action = menu.addAction("Rename")
```

Comment for this answer: I tried but it's only horizontal separator, is it possible to make it vertical. Here is the result I got : http://www.zupmage.eu/i/ZjvAjLmSFx.jpg

Here is another answer: If you create the menu yourself by using a ```QWidget``` it's easy. Just implement the ```paintEvent``` and draw the lines where you need them.

Comment for this answer: In fact, I'm dynamically changing the menu (adding and removing actions) so it will be complicated if I draw lines every time items has been added or removed
Comment for this answer: That depends on how generic you implement the drawing .. as the menu will call the `paintEvent` whenever something changes. If you know the number of entries it should be an easy thing to do.

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 2, 'CommentCount': 2, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2015:00:11/25/15', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<python><qt><menu><pyqt><pyqt5>', 'Title': 'Add a vertical separator between icons and text in a menu', 'ViewCount': 6625, 'id': 33924768, 'user_AboutMe': '<p>A simple developer.</p>\n', 'user_AccountId': 6026090.0, 'user_DisplayName': 'syedelec', 'user_Reputation': 1265.0, 'user_Views': 132.0, 'user_id': 4997158.0}}