Commit a403be13 authored by Jean-Philippe Andre's avatar Jean-Philippe Andre

Qt: Add a parent to the CoverArtLabel We should add parents to all QWidgets...

Qt: Add a parent to the CoverArtLabel We should add parents to all QWidgets created, otherwise the widgets are leaked This commit is buggy (can leak input_items), because the whole Qt implementation is leaking QWidgets
parent db44bc22
......@@ -106,7 +106,7 @@ MetaPanel::MetaPanel( QWidget *parent,
line++;
/* ART_URL */
art_cover = new CoverArtLabel( VLC_OBJECT( p_intf ) );
art_cover = new CoverArtLabel( this, VLC_OBJECT( p_intf ) );
metaLayout->addWidget( art_cover, line, 8, 4, 2, Qt::AlignRight );
/* Settings is unused */
......
......@@ -159,13 +159,5 @@ public slots:
void update( input_item_t * );
void clear();
};
class ArtCover : public QLabel
{
Q_OBJECT
void mouseDoubleClickEvent( QMouseEvent *event )
{
fprintf(stderr, "**************************" );
}
};
#endif
......@@ -1467,8 +1467,10 @@ static int downloadCoverCallback( vlc_object_t *p_this,
return VLC_SUCCESS;
}
CoverArtLabel::CoverArtLabel( vlc_object_t *_p_this, input_item_t *_p_input )
: p_this( _p_this), p_input( _p_input ), prevArt()
CoverArtLabel::CoverArtLabel( QWidget *parent,
vlc_object_t *_p_this,
input_item_t *_p_input )
: QLabel( parent ), p_this( _p_this), p_input( _p_input ), prevArt()
{
setContextMenuPolicy( Qt::ActionsContextMenu );
CONNECT( this, updateRequested(), this, doUpdate() );
......
......@@ -380,8 +380,11 @@ class CoverArtLabel : public QLabel
{
Q_OBJECT
public:
CoverArtLabel( vlc_object_t *p_this, input_item_t *p_input = NULL );
virtual ~CoverArtLabel() {};
CoverArtLabel( QWidget *parent,
vlc_object_t *p_this,
input_item_t *p_input = NULL );
virtual ~CoverArtLabel()
{ if( p_input ) vlc_gc_decref( p_input ); };
private:
input_item_t *p_input;
vlc_object_t *p_this;
......
......@@ -64,7 +64,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i,
artContainer->setMaximumHeight( 128 );
/* Art label */
art = new ArtLabel( p_intf );
art = new ArtLabel( artContainer, p_intf );
art->setToolTip( qtr( "Double click to get media information" ) );
artContLay->addWidget( art, 1 );
......
......@@ -70,7 +70,8 @@ class ArtLabel : public CoverArtLabel
{
Q_OBJECT
public:
ArtLabel( intf_thread_t *intf ) : CoverArtLabel( VLC_OBJECT( intf ) ) {};
ArtLabel( QWidget *parent, intf_thread_t *intf )
: CoverArtLabel( parent, VLC_OBJECT( intf ) ) {};
virtual ~ArtLabel() {};
void mouseDoubleClickEvent( QMouseEvent *event )
{
......
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