Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qt-creator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias Hunger
qt-creator
Commits
611df80e
Commit
611df80e
authored
14 years ago
by
hjk
Browse files
Options
Downloads
Patches
Plain Diff
code cosmetics
parent
5f5d6c20
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/libs/utils/historycompleter.cpp
+10
-8
10 additions, 8 deletions
src/libs/utils/historycompleter.cpp
src/libs/utils/historycompleter.h
+6
-1
6 additions, 1 deletion
src/libs/utils/historycompleter.h
with
16 additions
and
9 deletions
src/libs/utils/historycompleter.cpp
+
10
−
8
View file @
611df80e
...
@@ -40,10 +40,10 @@ class HistoryListModel : public QAbstractListModel
...
@@ -40,10 +40,10 @@ class HistoryListModel : public QAbstractListModel
public:
public:
HistoryListModel
(
HistoryCompleter
*
parent
);
HistoryListModel
(
HistoryCompleter
*
parent
);
void
fetchHistory
();
void
fetchHistory
();
int
rowCount
(
const
QModelIndex
&
parent
=
QModelIndex
())
const
;
int
rowCount
(
const
QModelIndex
&
parent
=
QModelIndex
())
const
;
QVariant
data
(
const
QModelIndex
&
index
,
int
role
=
Qt
::
DisplayRole
)
const
;
QVariant
data
(
const
QModelIndex
&
index
,
int
role
=
Qt
::
DisplayRole
)
const
;
void
clearHistory
();
void
clearHistory
();
void
saveEntry
(
const
QString
&
str
);
void
saveEntry
(
const
QString
&
str
);
QStringList
list
;
QStringList
list
;
HistoryCompleter
*
q
;
HistoryCompleter
*
q
;
...
@@ -76,7 +76,7 @@ void HistoryListModel::fetchHistory()
...
@@ -76,7 +76,7 @@ void HistoryListModel::fetchHistory()
reset
();
reset
();
}
}
int
HistoryListModel
::
rowCount
(
const
QModelIndex
&
parent
)
const
int
HistoryListModel
::
rowCount
(
const
QModelIndex
&
parent
)
const
{
{
if
(
lastSeenWidget
!=
q
->
widget
())
{
if
(
lastSeenWidget
!=
q
->
widget
())
{
if
(
qobject_cast
<
QLineEdit
*>
(
lastSeenWidget
))
if
(
qobject_cast
<
QLineEdit
*>
(
lastSeenWidget
))
...
@@ -94,11 +94,13 @@ int HistoryListModel::rowCount(const QModelIndex & parent) const
...
@@ -94,11 +94,13 @@ int HistoryListModel::rowCount(const QModelIndex & parent) const
return
list
.
count
();
return
list
.
count
();
}
}
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
();
return
list
.
at
(
index
.
row
());
if
(
role
==
Qt
::
DisplayRole
||
role
==
Qt
::
EditRole
)
return
list
.
at
(
index
.
row
());
return
QVariant
();
}
}
void
HistoryListModel
::
clearHistory
()
void
HistoryListModel
::
clearHistory
()
...
@@ -107,7 +109,7 @@ void HistoryListModel::clearHistory()
...
@@ -107,7 +109,7 @@ void HistoryListModel::clearHistory()
reset
();
reset
();
}
}
void
HistoryListModel
::
saveEntry
(
const
QString
&
str
)
void
HistoryListModel
::
saveEntry
(
const
QString
&
str
)
{
{
if
(
list
.
contains
(
str
))
if
(
list
.
contains
(
str
))
return
;
return
;
...
...
This diff is collapsed.
Click to expand it.
src/libs/utils/historycompleter.h
+
6
−
1
View file @
611df80e
...
@@ -39,20 +39,25 @@ QT_FORWARD_DECLARE_CLASS(QSettings)
...
@@ -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
);
};
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment