code cosmetics

This commit is contained in:
hjk
2010-09-16 11:57:37 +02:00
parent 5f5d6c200d
commit 611df80edf
2 changed files with 16 additions and 9 deletions

View File

@@ -96,9 +96,11 @@ int HistoryListModel::rowCount(const QModelIndex & parent) const
QVariant HistoryListModel::data(const QModelIndex &index, int role) const QVariant HistoryListModel::data(const QModelIndex &index, int role) const
{ {
if (index.row() >= list.count() || index.column() != 0 || (role != Qt::DisplayRole && role != Qt::EditRole)) if (index.row() >= list.count() || index.column() != 0)
return QVariant(); return QVariant();
if (role == Qt::DisplayRole || role == Qt::EditRole)
return list.at(index.row()); return list.at(index.row());
return QVariant();
} }
void HistoryListModel::clearHistory() void HistoryListModel::clearHistory()

View File

@@ -39,20 +39,25 @@ QT_FORWARD_DECLARE_CLASS(QSettings)
namespace Utils { namespace Utils {
class HistoryCompleterPrivate; class HistoryCompleterPrivate;
class QTCREATOR_UTILS_EXPORT HistoryCompleter : public QCompleter class QTCREATOR_UTILS_EXPORT HistoryCompleter : public QCompleter
{ {
Q_OBJECT Q_OBJECT
public: public:
HistoryCompleter(QObject *parent = 0); HistoryCompleter(QObject *parent = 0);
QSettings *settings() const; QSettings *settings() const;
int historySize() const; int historySize() const;
int maximalHistorySize() const; int maximalHistorySize() const;
void setMaximalHistorySize(int numberOfEntries); void setMaximalHistorySize(int numberOfEntries);
public Q_SLOTS: public Q_SLOTS:
void clearHistory(); void clearHistory();
void saveHistory(); void saveHistory();
protected: protected:
HistoryCompleterPrivate *d_ptr; HistoryCompleterPrivate *d_ptr;
private: private:
Q_DECLARE_PRIVATE(HistoryCompleter); Q_DECLARE_PRIVATE(HistoryCompleter);
}; };