Commit c7f8fdd2 authored by Gilles Caulier's avatar Gilles Caulier 🗼
Browse files

backport commit #9b3957aa from git/master to frameworks branch

CCBUGS: 341241
parent da4fbbf9
......@@ -119,6 +119,7 @@ find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE COMPONENTS
Gui
Sql
Xml
PrintSupport
Test
WebKitWidgets
)
......@@ -966,7 +967,6 @@ if(DIGIKAM_CAN_BE_COMPILED)
${CMAKE_CURRENT_SOURCE_DIR}/libs/widgets/common/dfontselect.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libs/widgets/common/dgradientslider.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libs/widgets/common/dragdropimplementations.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libs/widgets/common/filesaveoptionsbox.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libs/widgets/common/fullscreensettings.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libs/widgets/common/modelcompletion.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libs/widgets/common/searchtextbar.cpp
......@@ -975,6 +975,7 @@ if(DIGIKAM_CAN_BE_COMPILED)
${CMAKE_CURRENT_SOURCE_DIR}/libs/widgets/common/visibilitycontroller.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libs/widgets/common/workingwidget.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libs/widgets/common/workingpixmap.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libs/widgets/common/filesaveoptionsbox.cpp
)
set(libnotificationmanager_SRCS
......@@ -1145,10 +1146,10 @@ if(DIGIKAM_CAN_BE_COMPILED)
${CMAKE_CURRENT_SOURCE_DIR}/libs/dialogs/dbusydlg.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libs/dialogs/filesaveoptionsdlg.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libs/dialogs/iccprofileinfodlg.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libs/dialogs/imagedialog.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libs/dialogs/infodlg.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libs/dialogs/libsinfodlg.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libs/dialogs/rawcameradlg.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libs/dialogs/imagedialog.cpp
)
set(libdeletedialog_SRCS
......
......@@ -68,9 +68,11 @@ add_dependencies(digikamcore digikam-gitversion)
target_link_libraries(digikamcore
Qt5::Sql
Qt5::Concurrent
Qt5::PrintSupport
KF5::KIOCore
KF5::KIOWidgets
KF5::Notifications
KF5::NotifyConfig
KF5::KDELibs4Support
......
......@@ -42,8 +42,10 @@
namespace Digikam
{
ImageDelegateOverlay::ImageDelegateOverlay(QObject* parent)
: QObject(parent), m_view(0), m_delegate(0)
ImageDelegateOverlay::ImageDelegateOverlay(QObject* const parent)
: QObject(parent),
m_view(0),
m_delegate(0)
{
}
......@@ -114,7 +116,7 @@ QAbstractItemDelegate* ImageDelegateOverlay::delegate() const
bool ImageDelegateOverlay::affectsMultiple(const QModelIndex& index) const
{
// note how selectionModel->selectedIndexes().contains() can scale badly
QItemSelectionModel* selectionModel = view()->selectionModel();
QItemSelectionModel* const selectionModel = view()->selectionModel();
if (!selectionModel->hasSelection())
{
......@@ -162,10 +164,12 @@ int ImageDelegateOverlay::numberOfAffectedIndexes(const QModelIndex& index) cons
// scales better than selectedIndexes().count()
int count = 0;
foreach(const QItemSelectionRange& range, view()->selectionModel()->selection())
{
count += range.height();
}
return count;
}
......@@ -405,7 +409,7 @@ bool AbstractWidgetDelegateOverlay::eventFilter(QObject* obj, QEvent* event)
// ------------------------------------------------------------------------------------------
HoverButtonDelegateOverlay::HoverButtonDelegateOverlay(QObject* parent)
HoverButtonDelegateOverlay::HoverButtonDelegateOverlay(QObject* const parent)
: AbstractWidgetDelegateOverlay(parent)
{
}
......@@ -462,11 +466,11 @@ void HoverButtonDelegateOverlay::slotEntered(const QModelIndex& index)
// -----------------------------------------------------------------------------------
class PersistentWidgetDelegateOverlay::PersistentWidgetDelegateOverlayPriv
class PersistentWidgetDelegateOverlay::Private
{
public:
PersistentWidgetDelegateOverlayPriv()
Private()
: persistent(false),
restoreFocus(false)
{
......@@ -479,9 +483,9 @@ public:
QPersistentModelIndex enteredIndex;
};
PersistentWidgetDelegateOverlay::PersistentWidgetDelegateOverlay(QObject* parent)
PersistentWidgetDelegateOverlay::PersistentWidgetDelegateOverlay(QObject* const parent)
: AbstractWidgetDelegateOverlay(parent),
d(new PersistentWidgetDelegateOverlayPriv)
d(new Private)
{
}
......@@ -529,7 +533,7 @@ void PersistentWidgetDelegateOverlay::setPersistent(bool persistent)
return;
}
d->persistent = persistent;
d->persistent = persistent;
if (d->persistent && d->index.isValid())
{
......@@ -594,6 +598,7 @@ void PersistentWidgetDelegateOverlay::slotReset()
void PersistentWidgetDelegateOverlay::slotViewportEntered()
{
d->enteredIndex = QModelIndex();
if (!d->persistent)
{
AbstractWidgetDelegateOverlay::slotViewportEntered();
......@@ -623,15 +628,16 @@ void PersistentWidgetDelegateOverlay::hide()
{
if (!d->restoreFocus && m_widget->isVisible())
{
QWidget* f = QApplication::focusWidget();
d->restoreFocus = f && m_widget->isAncestorOf(f);
QWidget* const f = QApplication::focusWidget();
d->restoreFocus = f && m_widget->isAncestorOf(f);
}
AbstractWidgetDelegateOverlay::hide();
}
void PersistentWidgetDelegateOverlay::showOnIndex(const QModelIndex& index)
{
d->index = index;
d->index = QPersistentModelIndex(index);
restoreFocus();
}
......@@ -697,7 +703,7 @@ void ImageDelegateOverlayContainer::removeOverlay(ImageDelegateOverlay* overlay)
void ImageDelegateOverlayContainer::setAllOverlaysActive(bool active)
{
foreach(ImageDelegateOverlay* overlay, m_overlays)
foreach(ImageDelegateOverlay* const overlay, m_overlays)
{
overlay->setActive(active);
}
......@@ -705,7 +711,7 @@ void ImageDelegateOverlayContainer::setAllOverlaysActive(bool active)
void ImageDelegateOverlayContainer::setViewOnAllOverlays(QAbstractItemView* view)
{
foreach(ImageDelegateOverlay* overlay, m_overlays)
foreach(ImageDelegateOverlay* const overlay, m_overlays)
{
overlay->setView(view);
}
......@@ -713,18 +719,20 @@ void ImageDelegateOverlayContainer::setViewOnAllOverlays(QAbstractItemView* view
void ImageDelegateOverlayContainer::removeAllOverlays()
{
foreach(ImageDelegateOverlay* overlay, m_overlays)
foreach(ImageDelegateOverlay* const overlay, m_overlays)
{
overlay->setActive(false);
overlay->setDelegate(0);
overlay->setView(0);
}
m_overlays.clear();
}
void ImageDelegateOverlayContainer::overlayDestroyed(QObject* o)
{
ImageDelegateOverlay* overlay = qobject_cast<ImageDelegateOverlay*>(o);
ImageDelegateOverlay* const overlay = qobject_cast<ImageDelegateOverlay*>(o);
if (overlay)
{
removeOverlay(overlay);
......@@ -733,7 +741,7 @@ void ImageDelegateOverlayContainer::overlayDestroyed(QObject* o)
void ImageDelegateOverlayContainer::mouseMoved(QMouseEvent* e, const QRect& visualRect, const QModelIndex& index)
{
foreach(ImageDelegateOverlay* overlay, m_overlays)
foreach(ImageDelegateOverlay* const overlay, m_overlays)
{
overlay->mouseMoved(e, visualRect, index);
}
......@@ -742,7 +750,7 @@ void ImageDelegateOverlayContainer::mouseMoved(QMouseEvent* e, const QRect& visu
void ImageDelegateOverlayContainer::drawOverlays(QPainter* p, const QStyleOptionViewItem& option,
const QModelIndex& index) const
{
foreach(ImageDelegateOverlay* overlay, m_overlays)
foreach(ImageDelegateOverlay* const overlay, m_overlays)
{
overlay->paint(p, option, index);
}
......
......@@ -43,7 +43,7 @@ class DIGIKAM_EXPORT ImageDelegateOverlay : public QObject
public:
explicit ImageDelegateOverlay(QObject* parent = 0);
explicit ImageDelegateOverlay(QObject* const parent = 0);
~ImageDelegateOverlay();
/** Called when the overlay was installed and shall begin working,
......@@ -125,7 +125,7 @@ public:
* You must reimplement at least createWidget to return your widget.
* Per default it will be shown when the cursor enters an index and hidden when left.
* Reimplement slotEntered() and mouseMove() for more fine grained control. */
explicit AbstractWidgetDelegateOverlay(QObject* parent);
explicit AbstractWidgetDelegateOverlay(QObject* const parent);
/** If active is true, this will call createWidget(), initialize the widget for use,
* and setup connections for the virtual slots.
......@@ -199,7 +199,7 @@ class DIGIKAM_EXPORT HoverButtonDelegateOverlay : public AbstractWidgetDelegateO
public:
explicit HoverButtonDelegateOverlay(QObject* parent);
explicit HoverButtonDelegateOverlay(QObject* const parent);
/** Will call createButton(). */
virtual void setActive(bool active);
......@@ -239,7 +239,7 @@ class DIGIKAM_EXPORT PersistentWidgetDelegateOverlay : public AbstractWidgetDele
public:
explicit PersistentWidgetDelegateOverlay(QObject* parent);
explicit PersistentWidgetDelegateOverlay(QObject* const parent);
~PersistentWidgetDelegateOverlay();
virtual void setActive(bool active);
......@@ -288,8 +288,8 @@ protected:
private:
class PersistentWidgetDelegateOverlayPriv;
PersistentWidgetDelegateOverlayPriv* const d;
class Private;
Private* const d;
};
// -------------------------------------------------------------------------------------------
......
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