digiKam
Digikam::TreeViewLineEditComboBox Class Reference
+ Inheritance diagram for Digikam::TreeViewLineEditComboBox:

Public Member Functions

QModelIndex currentIndex () const
 
void hidePopup () override
 
void installView (QAbstractItemView *view=nullptr) override
 
void setCurrentIndex (const QModelIndex &index)
 
void setLineEdit (QLineEdit *edit)
 
void setLineEditText (const QString &text)
 
void showPopup () override
 
 TreeViewLineEditComboBox (QWidget *const parent=nullptr)
 
QTreeView * view () const
 

Protected Member Functions

bool eventFilter (QObject *watched, QEvent *event) override
 
virtual void installLineEdit ()
 
void sendViewportEventToView (QEvent *e) override
 

Protected Attributes

QLineEdit * m_comboLineEdit
 
QPersistentModelIndex m_currentIndex
 
QAbstractItemView * m_view
 

Constructor & Destructor Documentation

◆ TreeViewLineEditComboBox()

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

This class provides a TreeViewComboBox with a read-only line edit. The text in the line edit can be adjusted. The combo box will open on a click on the line edit. 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 QTreeView.

Member Function Documentation

◆ currentIndex()

QModelIndex Digikam::ModelIndexBasedComboBox::currentIndex ( ) const
inherited

◆ eventFilter()

bool Digikam::StayPoppedUpComboBox::eventFilter ( QObject *  watched,
QEvent *  event 
)
overrideprotectedinherited

◆ hidePopup()

void Digikam::ModelIndexBasedComboBox::hidePopup ( )
overrideinherited

◆ installLineEdit()

void Digikam::TreeViewLineEditComboBox::installLineEdit ( )
protectedvirtual

Sets a line edit. Called by installView(). The default implementation is described above. An empty implementation will keep the default QComboBox line edit.

References m_comboLineEdit, and setLineEdit().

Referenced by installView().

◆ installView()

void Digikam::TreeViewLineEditComboBox::installView ( QAbstractItemView *  view = nullptr)
overridevirtual

Replace the standard combo box list view with a QTreeView. Call this after installing an appropriate model.

Reimplemented from Digikam::TreeViewComboBox.

References installLineEdit(), Digikam::TreeViewComboBox::installView(), and Digikam::TreeViewComboBox::view().

Referenced by Digikam::AlbumSelectComboBox::installView().

◆ sendViewportEventToView()

void Digikam::TreeViewComboBox::sendViewportEventToView ( QEvent *  e)
overrideprotectedvirtualinherited

Implement in subclass: Send the given event to the viewportEvent() method of m_view. 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.

Implements Digikam::StayPoppedUpComboBox.

References Digikam::StayPoppedUpComboBox::m_view.

◆ setCurrentIndex()

void Digikam::ModelIndexBasedComboBox::setCurrentIndex ( const QModelIndex &  index)
inherited

◆ setLineEdit()

void Digikam::TreeViewLineEditComboBox::setLineEdit ( QLineEdit *  edit)

◆ setLineEditText()

void Digikam::TreeViewLineEditComboBox::setLineEditText ( const QString &  text)

Set the text of the line edit (the text that is visible if the popup is not opened). Applicable only for default installLineEdit() implementation.

References m_comboLineEdit.

Referenced by Digikam::AlbumSelectComboBox::updateText().

◆ showPopup()

void Digikam::ModelIndexBasedComboBox::showPopup ( )
overrideinherited

◆ view()

QTreeView * Digikam::TreeViewComboBox::view ( ) const
inherited

Member Data Documentation

◆ m_comboLineEdit

QLineEdit* Digikam::TreeViewLineEditComboBox::m_comboLineEdit
protected

◆ m_currentIndex

◆ m_view


The documentation for this class was generated from the following files: