ComboBoxModel: coding style fixes

This commit is contained in:
Tobias Doerffel
2014-03-24 19:19:18 +01:00
parent 2ab5b1da0c
commit d32377845b
2 changed files with 25 additions and 24 deletions

View File

@@ -1,7 +1,7 @@
/*
* ComboBoxModel.h - declaration of class ComboBoxModel
*
* Copyright (c) 2008-2011 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2008-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -38,11 +38,10 @@ class EXPORT ComboBoxModel : public IntModel
{
Q_OBJECT
public:
ComboBoxModel( Model * _parent = NULL,
const QString & _display_name = QString(),
bool _default_constructed = false ) :
IntModel( 0, 0, 0, _parent, _display_name,
_default_constructed )
ComboBoxModel( Model* parent = NULL,
const QString& displayName = QString(),
bool isDefaultConstructed = false ) :
IntModel( 0, 0, 0, parent, displayName, isDefaultConstructed )
{
}
@@ -51,37 +50,38 @@ public:
clear();
}
void addItem( const QString & _item, PixmapLoader * _loader = NULL );
void addItem( const QString& item, PixmapLoader* loader = NULL );
void clear();
int findText( const QString & _txt ) const;
int findText( const QString& txt ) const;
inline QString currentText() const
QString currentText() const
{
return ( size() > 0 && value() < size() ) ? m_items[value()].first : QString();
}
inline const PixmapLoader * currentData() const
const PixmapLoader* currentData() const
{
return m_items[value()].second;
}
inline const QString & itemText( int _i ) const
const QString & itemText( int i ) const
{
return m_items[tLimit<int>( _i, minValue(), maxValue() )].first;
return m_items[qBound<int>( minValue(), i, maxValue() )].first;
}
inline const PixmapLoader * itemPixmap( int _i ) const
const PixmapLoader* itemPixmap( int i ) const
{
return m_items[tLimit<int>( _i, minValue(), maxValue() )].second;
return m_items[qBound<int>( minValue(), i, maxValue() )].second;
}
inline int size() const
int size() const
{
return m_items.size();
}
private:
typedef QPair<QString, PixmapLoader *> Item;