Commit eaa55ce3 authored by Pierre Lamot's avatar Pierre Lamot Committed by Jean-Baptiste Kempf

qt: restore compatibility for Qt 5.5

This is notably what Ubuntu LTS 16.04 has
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 1f9a24aa
......@@ -3655,7 +3655,7 @@ AC_ARG_ENABLE(qt, [
])
have_qt5_x11="no"
AS_IF([test "${enable_qt}" != "no"], [
PKG_CHECK_MODULES([QT], [Qt5Core >= 5.6.0 Qt5Widgets Qt5Gui Qt5Svg], [
PKG_CHECK_MODULES([QT], [Qt5Core >= 5.5.0 Qt5Widgets Qt5Gui Qt5Svg], [
PKG_CHECK_MODULES([QT5_X11], [Qt5X11Extras], [
have_qt5_x11="yes"
],[
......
......@@ -643,8 +643,14 @@ QFrame *AbstractController::telexFrame()
QSignalMapper *contextButtonMapper = new QSignalMapper( this );
QToolButton *contextButton = NULL;
int i_iconminsize = __MAX( 16, telexOn->minimumHeight() );
#if HAS_QT56
qreal f_ratio = QApplication::primaryScreen()->devicePixelRatio();
QPixmap iconPixmap( i_iconminsize * f_ratio, i_iconminsize * f_ratio );
#else
QPixmap iconPixmap( i_iconminsize, i_iconminsize );
#endif
iconPixmap.fill( Qt::transparent );
QPainter iconPixmapPainter( &iconPixmap );
QLinearGradient iconPixmapPainterGradient( iconPixmap.rect().center() / 2,
......
......@@ -1157,8 +1157,12 @@ void Equalizer::build()
for( i = 0 ; i < NB_PRESETS ; i ++ )
{
QGraphicsScene scene;
#if HAS_QT56
qreal f_ratio = QApplication::primaryScreen()->devicePixelRatio();
QPixmap icon( 40 * f_ratio, 40 * f_ratio );
#else
QPixmap icon( 40, 40 );
#endif
icon.fill( Qt::transparent );
QPainter painter( &icon );
for ( int j = 0; j < eqz_preset_10b[i].i_band; j++ )
......
......@@ -560,14 +560,22 @@ bool StandardPLPanel::eventFilter ( QObject *obj, QEvent * event )
QStylePainter painter( viewport );
QPixmap dropzone = ImageHelper::loadSvgToPixmap(":/dropzone.svg", DROPZONE_SIZE, DROPZONE_SIZE);
qreal scale = dropzone.devicePixelRatio();
QRect rect = viewport->geometry();
#if HAS_QT56
qreal scale = dropzone.devicePixelRatio();
QSize size = rect.size() / 2 - dropzone.size() / (2 * scale);
#else
QSize size = rect.size() / 2 - dropzone.size() / 2;
#endif
rect.adjust( 0, size.height(), 0 , 0 );
painter.drawItemPixmap( rect, Qt::AlignHCenter, dropzone );
/* now select the zone just below the drop zone and let Qt center
the text by itself */
#if HAS_QT56
rect.adjust( 0, dropzone.height() / scale + 10, 0, 0 );
#else
rect.adjust( 0, dropzone.height() + 10, 0, 0 );
#endif
rect.setRight( viewport->geometry().width() );
rect.setLeft( 0 );
painter.drawItemText( rect,
......
......@@ -21,17 +21,27 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "qt.hpp"
#include <QApplication>
#include <QPainter>
#include <QScreen>
#include <QSvgRenderer>
#include "imagehelper.hpp"
QPixmap ImageHelper::loadSvgToPixmap( const QString &path, qint32 i_width, qint32 i_height )
{
#if HAS_QT56
qreal ratio = QApplication::primaryScreen()->devicePixelRatio();
QPixmap pixmap( QSize( i_width, i_height ) * ratio );
#else
QPixmap pixmap( QSize( i_width, i_height ) );
#endif
pixmap.fill( Qt::transparent );
......@@ -42,6 +52,9 @@ QPixmap ImageHelper::loadSvgToPixmap( const QString &path, qint32 i_width, qint3
renderer.render( &painter );
painter.end();
#if HAS_QT56
pixmap.setDevicePixelRatio( ratio );
#endif
return pixmap;
}
......@@ -601,9 +601,11 @@ SoundSlider::SoundSlider( QWidget *_parent, float _i_step,
const QBitmap mask( temp.createHeuristicMask() );
pixGradient = QPixmap( pixOutside.size() );
pixGradient.setDevicePixelRatio(QApplication::primaryScreen()->devicePixelRatio());
pixGradient2 = QPixmap( pixOutside.size() );
#if HAS_QT56
pixGradient.setDevicePixelRatio(QApplication::primaryScreen()->devicePixelRatio());
pixGradient2.setDevicePixelRatio(QApplication::primaryScreen()->devicePixelRatio());
#endif
/* Gradient building from the preferences */
QLinearGradient gradient( PADDINGL, 2, width() - PADDINGR, 2 );
......
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