Made CrumblePath API a bit more consistent/generic

Was a bit confusing to pass QVariant data in and get an int back.

Change-Id: I613d2eb88ade45baee85a4f84d7db6d3ce7fb923
Reviewed-on: http://codereview.qt.nokia.com/205
Reviewed-by: Christiaan Janssen <christiaan.janssen@nokia.com>
This commit is contained in:
Thorbjørn Lindeijer
2011-05-30 11:20:06 +02:00
committed by Christiaan Janssen
parent 61fc11b9c0
commit 38c798a642
5 changed files with 27 additions and 21 deletions

View File

@@ -52,10 +52,10 @@ void ContextCrumblePath::updateContextPath(const QStringList &path, const QList<
m_isEmpty = path.isEmpty();
if (m_isEmpty) {
pushElement(tr("[no context]"),QVariant(-1));
pushElement(tr("[no context]"), -1);
} else {
for (int i = 0; i < path.count(); i++)
pushElement(path[i], QVariant(debugIds[i]));
pushElement(path[i], debugIds[i]);
}
}
@@ -63,7 +63,7 @@ void ContextCrumblePath::addChildren(const QStringList &childrenNames, const QLi
{
Q_ASSERT(childrenNames.count() == childrenDebugIds.count());
for (int i = 0; i < childrenNames.count(); i++)
addChild(childrenNames[i], QVariant(childrenDebugIds[i]));
addChild(childrenNames[i], childrenDebugIds[i]);
}
void ContextCrumblePath::clear()

View File

@@ -726,7 +726,7 @@ void InspectorUi::setupDockWidgets()
m_crumblePath = new ContextCrumblePath;
m_crumblePath->setObjectName("QmlContextPath");
m_crumblePath->setWindowTitle(tr("Context Path"));
connect(m_crumblePath, SIGNAL(elementClicked(int)), SLOT(crumblePathElementClicked(int)));
connect(m_crumblePath, SIGNAL(elementClicked(QVariant)), SLOT(crumblePathElementClicked(QVariant)));
m_propertyInspector = new QmlJSPropertyInspector;
@@ -759,9 +759,11 @@ void InspectorUi::setupDockWidgets()
dock->setTitleBarWidget(new QWidget(dock));
}
void InspectorUi::crumblePathElementClicked(int debugId)
void InspectorUi::crumblePathElementClicked(const QVariant &data)
{
if (debugId == -1)
bool ok;
const int debugId = data.toInt(&ok);
if (!ok || debugId == -1)
return;
QList<int> debugIds;

View File

@@ -129,7 +129,7 @@ private slots:
QmlJSLiveTextPreview *createPreviewForEditor(Core::IEditor *newEditor);
void disableLivePreview();
void crumblePathElementClicked(int);
void crumblePathElementClicked(const QVariant &data);
void currentDebugProjectRemoved();
void updatePendingPreviewDocuments(QmlJS::Document::Ptr doc);