Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Konsole
Commits
001aaf5c
Commit
001aaf5c
authored
Sep 15, 2020
by
Tomaz Canabrava
Committed by
Kurt Hindenburg
Sep 15, 2020
Browse files
Remove the first item as default
parent
9d8e4729
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/profile/ProfileModel.cpp
View file @
001aaf5c
...
...
@@ -66,11 +66,14 @@ QVariant ProfileModel::data(const QModelIndex& idx, int role) const
}
auto
profile
=
m_profiles
.
at
(
idx
.
row
());
switch
(
idx
.
column
())
{
case
NAME
:
{
switch
(
role
)
{
case
Qt
::
DisplayRole
:
{
return
QStringLiteral
(
"%1%2"
).
arg
(
profile
->
name
(),
(
idx
.
row
()
==
0
?
i18n
(
"(Default)"
)
:
QString
()));
return
QStringLiteral
(
"%1%2"
).
arg
(
profile
->
name
(),
ProfileManager
::
instance
()
->
defaultProfile
()
==
profile
?
i18n
(
"(Default)"
)
:
QString
());
}
case
Qt
::
DecorationRole
:
return
QIcon
::
fromTheme
(
profile
->
icon
());
case
Qt
::
FontRole
:
{
...
...
@@ -146,7 +149,6 @@ void ProfileModel::populate()
beginResetModel
();
m_profiles
=
ProfileManager
::
instance
()
->
allProfiles
();
ProfileManager
::
instance
()
->
sortProfiles
(
m_profiles
);
m_profiles
.
prepend
(
ProfileManager
::
instance
()
->
defaultProfile
());
endResetModel
();
}
...
...
@@ -166,10 +168,6 @@ void ProfileModel::remove(QExplicitlySharedDataPointer<Profile> profile)
void
ProfileModel
::
setDefault
(
QExplicitlySharedDataPointer
<
Profile
>
profile
)
{
if
(
m_profiles
.
count
())
{
m_profiles
.
removeFirst
();
m_profiles
.
prepend
(
profile
);
}
emit
dataChanged
(
index
(
0
,
0
),
index
(
0
,
COLUMNS
-
1
),
{
Qt
::
DisplayRole
});
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment