Changeset View
Changeset View
Standalone View
Standalone View
kdecoration/config/breezelistmodel.h
Show First 20 Lines • Show All 99 Lines • ▼ Show 20 Line(s) | 39 | { | |||
---|---|---|---|---|---|
100 | { return parent.isValid() ? 0:_values.size(); } | 100 | { return parent.isValid() ? 0:_values.size(); } | ||
101 | 101 | | |||
102 | //@} | 102 | //@} | ||
103 | 103 | | |||
104 | //!@name selection | 104 | //!@name selection | ||
105 | //@{ | 105 | //@{ | ||
106 | 106 | | |||
107 | //! clear internal list selected items | 107 | //! clear internal list selected items | ||
108 | virtual void clearSelectedIndexes( void ) | 108 | virtual void clearSelectedIndexes() | ||
109 | { _selection.clear(); } | 109 | { _selection.clear(); } | ||
110 | 110 | | |||
111 | //! store index internal selection state | 111 | //! store index internal selection state | ||
112 | virtual void setIndexSelected( const QModelIndex& index, bool value ) | 112 | virtual void setIndexSelected( const QModelIndex& index, bool value ) | ||
113 | { | 113 | { | ||
114 | if( value ) _selection.push_back( get(index) ); | 114 | if( value ) _selection.push_back( get(index) ); | ||
115 | else _selection.erase( std::remove( _selection.begin(), _selection.end(), get(index) ), _selection.end() ); | 115 | else _selection.erase( std::remove( _selection.begin(), _selection.end(), get(index) ), _selection.end() ); | ||
116 | } | 116 | } | ||
117 | 117 | | |||
118 | //! get list of internal selected items | 118 | //! get list of internal selected items | ||
119 | virtual QModelIndexList selectedIndexes( void ) const | 119 | virtual QModelIndexList selectedIndexes() const | ||
120 | { | 120 | { | ||
121 | 121 | | |||
122 | QModelIndexList out; | 122 | QModelIndexList out; | ||
123 | for( typename List::const_iterator iter = _selection.begin(); iter != _selection.end(); iter++ ) | 123 | for( typename List::const_iterator iter = _selection.begin(); iter != _selection.end(); iter++ ) | ||
124 | { | 124 | { | ||
125 | QModelIndex index( ListModel::index( *iter ) ); | 125 | QModelIndex index( ListModel::index( *iter ) ); | ||
126 | if( index.isValid() ) out.push_back( index ); | 126 | if( index.isValid() ) out.push_back( index ); | ||
127 | } | 127 | } | ||
▲ Show 20 Lines • Show All 95 Lines • ▼ Show 20 Line(s) | 216 | { | |||
223 | for( typename List::const_iterator iter = values.begin(); iter != values.end(); iter++ ) | 223 | for( typename List::const_iterator iter = values.begin(); iter != values.end(); iter++ ) | ||
224 | { _remove( *iter ); } | 224 | { _remove( *iter ); } | ||
225 | emit layoutChanged(); | 225 | emit layoutChanged(); | ||
226 | return; | 226 | return; | ||
227 | 227 | | |||
228 | } | 228 | } | ||
229 | 229 | | |||
230 | //! clear | 230 | //! clear | ||
231 | virtual void clear( void ) | 231 | virtual void clear() | ||
232 | { set( List() ); } | 232 | { set( List() ); } | ||
233 | 233 | | |||
234 | //! update values from list | 234 | //! update values from list | ||
235 | /*! | 235 | /*! | ||
236 | values that are not found in current are removed | 236 | values that are not found in current are removed | ||
237 | new values are set to the end. | 237 | new values are set to the end. | ||
238 | This is slower than the "set" method, but the selection is not cleared in the process | 238 | This is slower than the "set" method, but the selection is not cleared in the process | ||
239 | */ | 239 | */ | ||
▲ Show 20 Lines • Show All 130 Lines • Show Last 20 Lines |