digiKam Developer Documentation
Professional Photo Management with the Power of Open Source
Loading...
Searching...
No Matches
Digikam::StayPoppedUpComboBox Class Referenceabstract
+ Inheritance diagram for Digikam::StayPoppedUpComboBox:

Public Member Functions

 StayPoppedUpComboBox (QWidget *const parent=nullptr)
 This class provides an abstract QComboBox with a custom view (which is created by implementing subclasses) instead of the usual QListView.
 
- Public Member Functions inherited from Digikam::ModelIndexBasedComboBox
 ModelIndexBasedComboBox (QWidget *const parent=nullptr)
 QComboBox has a current index based on a single integer.
 
QModelIndex currentIndex () const
 
void hidePopup () override
 
void setCurrentIndex (const QModelIndex &index)
 
void showPopup () override
 

Protected Member Functions

bool eventFilter (QObject *watched, QEvent *event) override
 
void installView (QAbstractItemView *view)
 Replace the standard combo box list view with the given view.
 
virtual void sendViewportEventToView (QEvent *e)=0
 Implement in subclass: Send the given event to the viewportEvent() method of m_view.
 

Protected Attributes

QAbstractItemView * m_view = nullptr
 
- Protected Attributes inherited from Digikam::ModelIndexBasedComboBox
QPersistentModelIndex m_currentIndex
 

Constructor & Destructor Documentation

◆ StayPoppedUpComboBox()

Digikam::StayPoppedUpComboBox::StayPoppedUpComboBox ( QWidget *const  parent = nullptr)
explicit

The Pop-up of the combo box will stay open after selecting an item; it will be closed by clicking outside, but not inside the widget. You need three steps: Construct the object, call setModel() with an appropriate QAbstractItemModel, then call installView() to replace the standard combo box view with a view.

Member Function Documentation

◆ installView()

void Digikam::StayPoppedUpComboBox::installView ( QAbstractItemView *  view)
protected

The view will be set as the view of the combo box (including re-parenting) and be stored in the m_view variable.

◆ sendViewportEventToView()

virtual void Digikam::StayPoppedUpComboBox::sendViewportEventToView ( QEvent *  e)
protectedpure virtual

This method is protected for a usual QAbstractItemView. You can override, pass a view, and call parent implementation. The existing view will be used. You must then also reimplement sendViewportEventToView.

Implemented in Digikam::AbstractAlbumTreeViewSelectComboBox, Digikam::TreeViewComboBox, and Digikam::ListViewComboBox.