mirror of
				https://github.com/qgis/QGIS.git
				synced 2025-11-04 00:04:25 -05:00 
			
		
		
		
	create helper method QgsCheckableComboBox::addItemWithCheckState
This commit is contained in:
		
							parent
							
								
									4fe3d2f4e6
								
							
						
					
					
						commit
						b516a49b9e
					
				@ -62,6 +62,15 @@ no items selected.
 | 
			
		||||
:param text: default text
 | 
			
		||||
 | 
			
		||||
.. seealso:: :py:func:`defaultText`
 | 
			
		||||
%End
 | 
			
		||||
 | 
			
		||||
    void addItemWithCheckState( const QString &text, Qt::CheckState state, const QVariant &userData = QVariant() );
 | 
			
		||||
%Docstring
 | 
			
		||||
Adds an item to the combobox with the given ``text``, check ``state``
 | 
			
		||||
and containing the specified ``userData`` (stored in the Qt.UserRole).
 | 
			
		||||
The item is appended to the list of existing items.
 | 
			
		||||
 | 
			
		||||
.. versionadded:: 3.16
 | 
			
		||||
%End
 | 
			
		||||
 | 
			
		||||
    QStringList checkedItems() const;
 | 
			
		||||
 | 
			
		||||
@ -134,6 +134,12 @@ void QgsCheckableComboBox::setDefaultText( const QString &text )
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void QgsCheckableComboBox::addItemWithCheckState( const QString &text, Qt::CheckState state, const QVariant &userData )
 | 
			
		||||
{
 | 
			
		||||
  QComboBox::addItem( text, userData );
 | 
			
		||||
  setItemCheckState( count(), state );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QStringList QgsCheckableComboBox::checkedItems() const
 | 
			
		||||
{
 | 
			
		||||
  QStringList items;
 | 
			
		||||
 | 
			
		||||
@ -163,6 +163,14 @@ class GUI_EXPORT QgsCheckableComboBox : public QComboBox
 | 
			
		||||
     */
 | 
			
		||||
    void setDefaultText( const QString &text );
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Adds an item to the combobox with the given \a text, check \a state
 | 
			
		||||
     * and containing the specified \a userData (stored in the Qt::UserRole).
 | 
			
		||||
     * The item is appended to the list of existing items.
 | 
			
		||||
     * \since QGIS 3.16
 | 
			
		||||
     */
 | 
			
		||||
    void addItemWithCheckState( const QString &text, Qt::CheckState state, const QVariant &userData = QVariant() );
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns currently checked items.
 | 
			
		||||
     * \see setCheckedItems()
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user