Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8417665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:07:10+00:00 2026-06-10T02:07:10+00:00

We have a PyQt4/PySide Qt4 video player app that has QToolButton object in the

  • 0

We have a PyQt4/PySide Qt4 video player app that has QToolButton object in the GUI with an associated QMenu, added with QToolButton#setMenu(). Currently, when the user interacts with the menu, it takes over the event loop and video playback stops. The event loop takeover occurs in the private QToolButtonPrivate::popupTimerDone().

We’d like to rewrite/modify QToolButton to not be modeless, but there doesn’t appear to be any easy choices:

  1. Copy and modify QToolButton in C++ and then use PyQt4 or PySide’s C++ wrapping to wrap the class for Python. Easier, but now our build system needs to compile a C++ class and know which environment it’s running in, PySide or PyQt4.
  2. Completely rewrite QToolButton in Python, so it would subclass QAbstractButton, and make the modifications. A decent amount of code to rewrite and maintain.
  3. In Python, subclass QToolButton and override where necessary. This seems nice, but looking at the internal state that QToolButtonPrivate::popupTimerDone() references, we would be mostly rewriting the entire thing anyway.

Are there any other ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T02:07:12+00:00Added an answer on June 10, 2026 at 2:07 am

    I would recommend looking into using the QToolButton.clicked signal with the QMenu.popup method vs. the setMenu – that may break the modality.

    I tried setting up an example for you – but it doesn’t block the QMovie…so maybe you can use this example to test the different options for a video player vs. a Qmovie and see if it still blocks your event loop:

    from PyQt4 import QtGui, QtCore
    
    MOVIE_FILE = '/path/to/ajax_loader.gif'
    
    class MyDialog(QtGui.QDialog):
        def __init__( self, parent = None ):
            super(MyDialog, self).__init__(parent)
    
            self._menu = QtGui.QMenu(self)
            self._menu.addAction('Action A')
            self._menu.addAction('Action B')
    
            self._menuButton     = QtGui.QToolButton(self)
            self._modalButton    = QtGui.QToolButton(self)
            self._nonModalButton = QtGui.QToolButton(self)
            self._feedbackLabel  = QtGui.QLabel(self)
            self._startTime      = QtCore.QDateTime.currentDateTime()
    
            self._menuButton.setPopupMode(self._menuButton.InstantPopup)
    
            movie = QtGui.QMovie(self)
            movie.setFileName(MOVIE_FILE)
            movie.start()
    
            self._feedbackLabel.setMovie(movie)
    
            hlayout = QtGui.QHBoxLayout()
            hlayout.addWidget(self._menuButton)
            hlayout.addWidget(self._modalButton)
            hlayout.addWidget(self._nonModalButton)
            hlayout.addStretch()
    
            vlayout = QtGui.QVBoxLayout()
            vlayout.addLayout(hlayout)
            vlayout.addWidget(self._feedbackLabel)
    
            self.setLayout(vlayout)
            self.adjustSize()
    
            # setup different menu examples
            self._menuButton.setMenu(self._menu)
            self._modalButton.clicked.connect(self.showModalMenu)
            self._nonModalButton.clicked.connect(self.showNonModalMenu)
    
            self._menu.triggered.connect(self.showAction)
    
        def showModalMenu( self ):
            point = self._modalButton.rect().bottomLeft()
            global_point = self._modalButton.mapToGlobal(point)
            self._menu.exec_(global_point)
    
        def showNonModalMenu( self ):
            point = self._nonModalButton.rect().bottomLeft()
            global_point = self._nonModalButton.mapToGlobal(point)
            self._menu.popup(global_point)
    
        def showAction( self, action ):
            print action.text()
    
    if ( __name__ == '__main__' ):
        app = QtGui.QApplication([])
        dlg = MyDialog()
        dlg.show()
        app.exec_()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Python application (with GUI, using PyQt4) that gets spawned by the
I have a GUI developed using pyqt4 which has a run button. on run
I have the following method in my PyQt4 app. r2 is the number of
I have several QComboBoxes in my PyQt4/Python3 GUI and they are filled with some
I have a fairly simple app built with pyqt4. I wanted to debug one
Hello I have this problem with PyQt4-dev-tools that include: * a user interface compiler
I have a pyqt4 app which should run with arbitrary colorscheme. I would like
I am using pyQt4 and want to have a Browse button in my GUI
I'm using Python 2.6.6 and PyQt4. I have a start QDateTime object and I
I have made a program that has a Toolbar with a few actions on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.