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
Marco Bubke
flatpak-qt-creator
Commits
4214193d
Commit
4214193d
authored
Jun 24, 2010
by
Tobias Hunger
Browse files
Add method to get a task from the taskmodel
* Add a method to get a task from the taskmodel. * Use it.
parent
aa41af8c
Changes
1
Show whitespace changes
Inline
Side-by-side
src/plugins/projectexplorer/taskwindow.cpp
View file @
4214193d
...
...
@@ -111,6 +111,7 @@ public:
int
rowCount
(
const
QModelIndex
&
parent
=
QModelIndex
())
const
;
int
columnCount
(
const
QModelIndex
&
parent
=
QModelIndex
())
const
;
QVariant
data
(
const
QModelIndex
&
index
,
int
role
=
Qt
::
DisplayRole
)
const
;
Task
task
(
const
QModelIndex
&
index
)
const
;
QStringList
categoryIds
()
const
;
QString
categoryDisplayName
(
const
QString
&
categoryId
)
const
;
...
...
@@ -391,11 +392,16 @@ QVariant TaskModel::data(const QModelIndex &index, int role) const
}
else
if
(
role
==
TaskModel
::
Icon
)
{
return
taskTypeIcon
(
m_tasks
.
at
(
index
.
row
()).
type
);
}
else
if
(
role
==
TaskModel
::
Task_t
)
{
return
QVariant
::
fromValue
(
m_
task
s
.
at
(
index
.
row
()
));
return
QVariant
::
fromValue
(
task
(
index
));
}
return
QVariant
();
}
Task
TaskModel
::
task
(
const
QModelIndex
&
index
)
const
{
return
m_tasks
.
at
(
index
.
row
());
}
QStringList
TaskModel
::
categoryIds
()
const
{
return
m_categories
.
keys
();
...
...
@@ -634,7 +640,7 @@ void TaskWindow::triggerDefaultHandler(const QModelIndex &index)
}
}
Q_ASSERT
(
d
->
m_defaultHandler
);
Task
task
(
index
.
data
(
Internal
::
TaskModel
::
Task_t
).
value
<
Task
>
(
));
Task
task
(
d
->
m_model
->
task
(
index
));
if
(
d
->
m_defaultHandler
->
canHandle
(
task
))
{
d
->
m_defaultHandler
->
handle
(
task
);
}
else
{
...
...
@@ -651,7 +657,7 @@ void TaskWindow::showContextMenu(const QPoint &position)
d
->
m_contextMenuIndex
=
index
;
cleanContextMenu
();
Task
task
=
index
.
data
(
Internal
::
TaskModel
::
Task_t
).
value
<
Task
>
(
);
Task
task
=
d
->
m_model
->
task
(
index
);
QList
<
ITaskHandler
*>
handlers
=
ExtensionSystem
::
PluginManager
::
instance
()
->
getObjects
<
ITaskHandler
>
();
foreach
(
ITaskHandler
*
handler
,
handlers
)
{
...
...
@@ -668,7 +674,7 @@ void TaskWindow::showContextMenu(const QPoint &position)
void
TaskWindow
::
contextMenuEntryTriggered
(
QAction
*
action
)
{
if
(
action
->
isEnabled
())
{
Task
task
=
d
->
m_
contextMenuIndex
.
data
(
Internal
::
TaskModel
::
Task_t
).
value
<
Task
>
(
);
Task
task
=
d
->
m_
model
->
task
(
d
->
m_contextMenuIndex
);
ITaskHandler
*
handler
=
qobject_cast
<
ITaskHandler
*>
(
action
->
data
().
value
<
QObject
*>
());
if
(
!
handler
)
return
;
...
...
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