Commit 99648053 authored by Maik Qualmann's avatar Maik Qualmann
Browse files

apply patch #94422 to scale the overlay action icons accordingly with thumb size

BUGS: 261568
FIXED-IN: 4.14.0
parent 5c730548
......@@ -7,5 +7,6 @@ General : Add support of OpenCV 3.x
BUGFIXES FROM KDE BUGZILLA (https://www.digikam.org/changelog):
001 ==> 349601] digikam compile fine with OpenCV 2.X but not with 3.x.
002 ==>
\ No newline at end of file
001 ==> 349601 - digikam compile fine with OpenCV 2.X but not with 3.x.
002 ==> 261568 - ICONVIEW : scale overlay action icons accordingly with thumb size [patch].
003 ==>
......@@ -46,18 +46,18 @@ ImageRotateOverlayButton::ImageRotateOverlayButton(ImageRotateOverlayDirection d
QSize ImageRotateOverlayButton::sizeHint() const
{
return QSize(16, 16);
return QSize(32, 32);
}
QPixmap ImageRotateOverlayButton::icon()
{
if (m_direction == ImageRotateOverlayLeft)
{
return KIconLoader::global()->loadIcon("object-rotate-left", KIconLoader::NoGroup, KIconLoader::SizeSmall);
return KIconLoader::global()->loadIcon("object-rotate-left", KIconLoader::NoGroup, KIconLoader::SizeMedium);
}
else
{
return KIconLoader::global()->loadIcon("object-rotate-right", KIconLoader::NoGroup, KIconLoader::SizeSmall);
return KIconLoader::global()->loadIcon("object-rotate-right", KIconLoader::NoGroup, KIconLoader::SizeMedium);
}
}
......@@ -102,9 +102,11 @@ ItemViewHoverButton* ImageRotateOverlay::createButton()
void ImageRotateOverlay::updateButton(const QModelIndex& index)
{
const QRect rect = m_view->visualRect(index);
const int size = qBound(16, rect.width() / 8 - 2, 48);
const int gap = 5;
const int x = rect.right() - 2*gap - (isLeft() ? KIconLoader::SizeSmall*3 + 2 : KIconLoader::SizeSmall*2 +2);
const int x = rect.right() - 2*gap - (isLeft() ? size*3 + 2 : size*2 + 2);
const int y = rect.top() + gap;
button()->resize(size, size);
button()->move(QPoint(x, y));
}
......
......@@ -44,14 +44,14 @@ ImageSelectionOverlayButton::ImageSelectionOverlayButton(QAbstractItemView* pare
QSize ImageSelectionOverlayButton::sizeHint() const
{
return QSize(16, 16);
return QSize(32, 32);
}
QPixmap ImageSelectionOverlayButton::icon()
{
return KIconLoader::global()->loadIcon(isChecked() ? "list-remove" : "list-add",
KIconLoader::NoGroup,
KIconLoader::SizeSmall);
KIconLoader::SizeMedium);
}
void ImageSelectionOverlayButton::updateToolTip()
......@@ -99,9 +99,11 @@ ItemViewHoverButton* ImageSelectionOverlay::createButton()
void ImageSelectionOverlay::updateButton(const QModelIndex& index)
{
const QRect rect = m_view->visualRect(index);
const int size = qBound(16, rect.width() / 8 - 2, 48);
const int gap = 5;
const int x = rect.left() + gap;
const int y = rect.top() + gap;
button()->resize(size, size);
button()->move(QPoint(x, y));
QItemSelectionModel* selModel = m_view->selectionModel();
......
......@@ -154,28 +154,29 @@ void ItemViewHoverButton::paintEvent(QPaintEvent* event)
painter.drawEllipse(0, 0, width(), height());
// draw the icon overlay
QPixmap icon = m_icon.scaled(width() - 2, height() - 2, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
if (m_isHovered)
{
KIconEffect iconEffect;
QPixmap activeIcon = iconEffect.apply(m_icon, KIconLoader::Desktop, KIconLoader::ActiveState);
painter.drawPixmap(0, 0, activeIcon);
QPixmap activeIcon = iconEffect.apply(icon, KIconLoader::Desktop, KIconLoader::ActiveState);
painter.drawPixmap(1, 1, activeIcon);
}
else
{
if (m_fadingValue < 255)
{
// apply an alpha mask respecting the fading value to the icon
QPixmap icon = m_icon;
QPixmap alphaMask(icon.width(), icon.height());
const QColor color(m_fadingValue, m_fadingValue, m_fadingValue);
alphaMask.fill(color);
icon.setAlphaChannel(alphaMask);
painter.drawPixmap(0, 0, icon);
painter.drawPixmap(1, 1, icon);
}
else
{
// no fading is required
painter.drawPixmap(0, 0, m_icon);
painter.drawPixmap(1, 1, icon);
}
}
}
......
......@@ -416,18 +416,18 @@ ImportRotateOverlayButton::ImportRotateOverlayButton(ImportRotateOverlayDirectio
QSize ImportRotateOverlayButton::sizeHint() const
{
return QSize(16, 16);
return QSize(32, 32);
}
QPixmap ImportRotateOverlayButton::icon()
{
if (m_direction == ImportRotateOverlayLeft)
{
return KIconLoader::global()->loadIcon("object-rotate-left", KIconLoader::NoGroup, KIconLoader::SizeSmall);
return KIconLoader::global()->loadIcon("object-rotate-left", KIconLoader::NoGroup, KIconLoader::SizeMedium);
}
else
{
return KIconLoader::global()->loadIcon("object-rotate-right", KIconLoader::NoGroup, KIconLoader::SizeSmall);
return KIconLoader::global()->loadIcon("object-rotate-right", KIconLoader::NoGroup, KIconLoader::SizeMedium);
}
}
......@@ -470,9 +470,11 @@ ItemViewHoverButton* ImportRotateOverlay::createButton()
void ImportRotateOverlay::updateButton(const QModelIndex& index)
{
const QRect rect = m_view->visualRect(index);
const int size = qBound(16, rect.width() / 8 - 2, 48);
const int gap = 5;
const int x = rect.right() - 2*gap - (isLeft() ? KIconLoader::SizeSmall*5 + 2 : KIconLoader::SizeSmall*4 +2);
const int x = rect.right() - 2*gap - (isLeft() ? size*5 + 2 : size*4 + 2);
const int y = rect.top() + gap;
button()->resize(size, size);
button()->move(QPoint(x, y));
}
......
Supports Markdown
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