Commit 6b88089b authored by Francois Cartegnie's avatar Francois Cartegnie

Qt: Queue toolbar rebuild as event instead of delaying popups's deletion

(fix #7016)

This reverts commit 6f1af24d.
This reverts commit e5462dbd.
parent d5c46557
......@@ -75,6 +75,9 @@ static int IntfRaiseMainCB( vlc_object_t *p_this, const char *psz_variable,
vlc_value_t old_val, vlc_value_t new_val,
void *param );
const QEvent::Type MainInterface::ToolbarsNeedRebuild =
(QEvent::Type)QEvent::registerEventType();
MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
{
/* Variables initialisation */
......@@ -217,7 +220,8 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
this, setVideoFullScreen( bool ) );
}
CONNECT( THEDP, toolBarConfUpdated(), this, recreateToolbars() );
CONNECT( THEDP, toolBarConfUpdated(), this, toolBarConfUpdated() );
installEventFilter( this );
CONNECT( this, askToQuit(), THEDP, quit() );
......@@ -1337,6 +1341,22 @@ void MainInterface::closeEvent( QCloseEvent *e )
e->accept();
}
bool MainInterface::eventFilter( QObject *obj, QEvent *event )
{
if ( event->type() == MainInterface::ToolbarsNeedRebuild ) {
event->accept();
recreateToolbars();
return true;
} else {
return QObject::eventFilter( obj, event );
}
}
void MainInterface::toolBarConfUpdated()
{
QApplication::postEvent( this, new QEvent( MainInterface::ToolbarsNeedRebuild ) );
}
void MainInterface::setInterfaceFullScreen( bool fs )
{
if( fs )
......
......@@ -61,7 +61,6 @@ enum {
CONTROLS_ADVANCED = 0x4,
};
class MainInterface : public QVLCMW
{
Q_OBJECT
......@@ -73,6 +72,8 @@ public:
MainInterface( intf_thread_t *);
virtual ~MainInterface();
static const QEvent::Type ToolbarsNeedRebuild;
/* Video requests from core */
WId getVideo( int *pi_x, int *pi_y,
unsigned int *pi_width, unsigned int *pi_height );
......@@ -101,6 +102,7 @@ protected:
virtual void closeEvent( QCloseEvent *);
virtual void keyPressEvent( QKeyEvent *);
virtual void wheelEvent( QWheelEvent * );
virtual bool eventFilter(QObject *, QEvent *);
private:
/* Main Widgets Creation */
......@@ -205,6 +207,7 @@ public slots:
void emitRaise();
void reloadPrefs();
void toolBarConfUpdated();
private slots:
void debug();
......
......@@ -769,8 +769,7 @@ QMenu *VLCMenuBar::HelpMenu( QWidget *parent )
*****************************************************************************/
#define POPUP_BOILERPLATE \
static QMenu* menu = NULL; \
if ( menu ) menu->deleteLater(); /* Ensure it is deleted after processing events */\
menu = NULL; /* or we might crash on an incoming mouseup event */\
delete menu; menu = NULL; \
if( !show ) \
return; \
QVector<vlc_object_t *> objects; \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment