How to disable right-click in PyQt5 and widget issue
<p>I have a simple code that is making a window with toolbars.</p>

<pre><code>from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
import sys

class AnaPencere(QMainWindow):
    def __init__(self):
        super().__init__()
        self.widget = QWidget(self)
        self.setCentralWidget(self.widget)

        self.toolBar = QToolBar(self)
        self.addToolBar(Qt.TopToolBarArea, self.toolBar)

        self.pushButton1 = QPushButton()
        self.pushButton1.setText("Open")
        self.toolBar.addWidget(self.pushButton1)

        self.toolBar.addSeparator()
        self.pushButton2 = QPushButton()
        self.pushButton2.setText("Save")
        self.toolBar.addWidget(self.pushButton2)

        self.pushButton3 = QPushButton()
        self.pushButton3.setText("Save as")
        self.toolBar.addWidget(self.pushButton3)
        #t = QToolBar(self)
        #t.setMovable(False)

uygulama = QApplication(sys.argv)
pencere = AnaPencere()
pencere.show()
uygulama.exec_()
</code></pre>

<p>This will create 3 toolbars. But the problem is, when I right click on a toolbar, a little window pops up, and when I click that little window all toolbars are gone. If I do the same thing again toolbars are back again. I don't want to user is able to do something like that so I thought If I disable right click it'll fixed but I couldn't.
Here that little window</p>

<p><a href="https://i.stack.imgur.com/7PTRK.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7PTRK.jpg" alt="enter image description here"></a></p>