Skip to content

Commit

Permalink
Use QWidget::grab() instead of deprecated QPixmap::grabWidget() on Qt5
Browse files Browse the repository at this point in the history
  • Loading branch information
PhysSong committed Oct 24, 2017
1 parent 370982b commit 4dc06f6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions include/StringPairDrag.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,10 @@ class EXPORT StringPairDrag : public QDrag

} ;

#if QT_VERSION >= 0x050000
#define GRAB(x) x->grab()
#else
#define GRAB(x) QPixmap::grabWidget(x)
#endif

#endif
6 changes: 3 additions & 3 deletions src/core/Track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ void TrackContentObjectView::mousePressEvent( QMouseEvent * me )
QVector<TrackContentObjectView *> tcoViews;
tcoViews.push_back( this );
DataFile dataFile = createTCODataFiles( tcoViews );
QPixmap thumbnail = QPixmap::grabWidget( this ).scaled(
QPixmap thumbnail = GRAB( this ).scaled(
128, 128,
Qt::KeepAspectRatio,
Qt::SmoothTransformation );
Expand Down Expand Up @@ -839,7 +839,7 @@ void TrackContentObjectView::mouseMoveEvent( QMouseEvent * me )
DataFile dataFile = createTCODataFiles( tcoViews );

// TODO -- thumbnail for all selected
QPixmap thumbnail = QPixmap::grabWidget( this ).scaled(
QPixmap thumbnail = GRAB( this ).scaled(
128, 128,
Qt::KeepAspectRatio,
Qt::SmoothTransformation );
Expand Down Expand Up @@ -1763,7 +1763,7 @@ void TrackOperationsWidget::mousePressEvent( QMouseEvent * me )
m_trackView->getTrack()->saveState( dataFile, dataFile.content() );
new StringPairDrag( QString( "track_%1" ).arg(
m_trackView->getTrack()->type() ),
dataFile.toString(), QPixmap::grabWidget(
dataFile.toString(), GRAB(
m_trackView->getTrackSettingsWidget() ),
this );
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui/StringPairDrag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ StringPairDrag::StringPairDrag( const QString & _key, const QString & _value,
{
if( _icon.isNull() && _w )
{
setPixmap( QPixmap::grabWidget( _w ).scaled(
setPixmap( GRAB( _w ).scaled(
64, 64,
Qt::KeepAspectRatio,
Qt::SmoothTransformation ) );
Expand Down

0 comments on commit 4dc06f6

Please sign in to comment.