0
self.menuBar = self.menuBar()
self.action1 = QAction('This is\nAction Button', self)
self.menuBar.addAction(self.action1)

This makes the menuBar multiple lines, but new line doesn't apply.

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Mineral
  • 1
  • 1
  • 2
  • 4
  • Can you try to be more clear? The two phrases you're using seem to say opposite things. Note that the multiple lines in QActions and menu are not guaranteed to work (most styles just ignore the new line character). – musicamante Jul 18 '21 at 20:20
  • Also, you should not do `self.menuBar = self.menuBar()`, as overwriting a dynamic function with a static value is not a good idea. – musicamante Jul 18 '21 at 20:21
  • thanks comment, But I really want to accept newline.. – Mineral Jul 18 '21 at 20:27
  • 1
    consider that: 1. it's partially supported only on some styles on Linux; 2. it's not directly supported on Windows; 3. it's completely unsupported on MacOs using the default native menu bar; 4. partial support can be done but would require thorough testing for all the three major platforms and consider lots of aspects, at best, would show inconsistent display results or, at worst, potentially break normal usage even after completely reimplementing the paint of the menu by hand (which isn't easy). – musicamante Jul 18 '21 at 20:58

0 Answers0