forked from qt-creator/qt-creator
Code cosmetics
This commit is contained in:
@@ -214,7 +214,8 @@ QVariant CrumblePathButton::data() const
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
struct CrumblePathPrivate {
|
struct CrumblePathPrivate
|
||||||
|
{
|
||||||
explicit CrumblePathPrivate(CrumblePath *q);
|
explicit CrumblePathPrivate(CrumblePath *q);
|
||||||
|
|
||||||
QList<CrumblePathButton*> m_buttons;
|
QList<CrumblePathButton*> m_buttons;
|
||||||
@@ -244,18 +245,18 @@ CrumblePath::~CrumblePath()
|
|||||||
|
|
||||||
void CrumblePath::selectIndex(int index)
|
void CrumblePath::selectIndex(int index)
|
||||||
{
|
{
|
||||||
if ((index > -1) && (index < d->m_buttons.length()))
|
if (index > -1 && index < d->m_buttons.length())
|
||||||
d->m_buttons[index]->select(true);
|
d->m_buttons[index]->select(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant CrumblePath::dataForIndex(int index) const
|
QVariant CrumblePath::dataForIndex(int index) const
|
||||||
{
|
{
|
||||||
if ((index > -1) && (index < d->m_buttons.length()))
|
if (index > -1 && index < d->m_buttons.length())
|
||||||
return d->m_buttons[index]->data();
|
return d->m_buttons[index]->data();
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CrumblePath::pushElement(const QString &title, const QVariant data)
|
void CrumblePath::pushElement(const QString &title, const QVariant &data)
|
||||||
{
|
{
|
||||||
CrumblePathButton *newButton = new CrumblePathButton(title, this);
|
CrumblePathButton *newButton = new CrumblePathButton(title, this);
|
||||||
newButton->hide();
|
newButton->hide();
|
||||||
@@ -276,7 +277,7 @@ void CrumblePath::pushElement(const QString &title, const QVariant data)
|
|||||||
resizeButtons();
|
resizeButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CrumblePath::addChild(const QString &title, const QVariant data)
|
void CrumblePath::addChild(const QString &title, const QVariant &data)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(d->m_buttons.count() > 0,return);
|
QTC_ASSERT(d->m_buttons.count() > 0,return);
|
||||||
|
|
||||||
@@ -311,10 +312,9 @@ void CrumblePath::popElement()
|
|||||||
|
|
||||||
void CrumblePath::clear()
|
void CrumblePath::clear()
|
||||||
{
|
{
|
||||||
while (!d->m_buttons.isEmpty()) {
|
while (!d->m_buttons.isEmpty())
|
||||||
popElement();
|
popElement();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void CrumblePath::resizeEvent(QResizeEvent *)
|
void CrumblePath::resizeEvent(QResizeEvent *)
|
||||||
{
|
{
|
||||||
@@ -363,7 +363,6 @@ void CrumblePath::resizeButtons()
|
|||||||
if (i > 0)
|
if (i > 0)
|
||||||
button->stackUnder(d->m_buttons[i - 1]);
|
button->stackUnder(d->m_buttons[i - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ public:
|
|||||||
QVariant dataForIndex(int index) const;
|
QVariant dataForIndex(int index) const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void pushElement(const QString &title, const QVariant data = QVariant());
|
void pushElement(const QString &title, const QVariant &data = QVariant());
|
||||||
void addChild(const QString &title, const QVariant data = QVariant());
|
void addChild(const QString &title, const QVariant &data = QVariant());
|
||||||
void popElement();
|
void popElement();
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
|
|||||||
@@ -39,17 +39,13 @@ namespace QmlJSInspector {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
ContextCrumblePath::ContextCrumblePath(QWidget *parent)
|
ContextCrumblePath::ContextCrumblePath(QWidget *parent)
|
||||||
: CrumblePath(parent), m_isEmpty(true)
|
: CrumblePath(parent)
|
||||||
|
, m_isEmpty(true)
|
||||||
{
|
{
|
||||||
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||||
updateContextPath(QStringList(), QList<int>());
|
updateContextPath(QStringList(), QList<int>());
|
||||||
}
|
}
|
||||||
|
|
||||||
ContextCrumblePath::~ContextCrumblePath()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void ContextCrumblePath::updateContextPath(const QStringList &path, const QList<int> &debugIds)
|
void ContextCrumblePath::updateContextPath(const QStringList &path, const QList<int> &debugIds)
|
||||||
{
|
{
|
||||||
Q_ASSERT(path.count() == debugIds.count());
|
Q_ASSERT(path.count() == debugIds.count());
|
||||||
@@ -60,11 +56,10 @@ void ContextCrumblePath::updateContextPath(const QStringList &path, const QList<
|
|||||||
if (m_isEmpty) {
|
if (m_isEmpty) {
|
||||||
pushElement(tr("[no context]"));
|
pushElement(tr("[no context]"));
|
||||||
} else {
|
} else {
|
||||||
for (int i=0; i<path.count(); i++) {
|
for (int i=0; i<path.count(); i++)
|
||||||
pushElement(path[i], QVariant(debugIds[i]));
|
pushElement(path[i], QVariant(debugIds[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void ContextCrumblePath::addChildren(const QStringList &childrenNames, const QList<int> &childrenDebugIds)
|
void ContextCrumblePath::addChildren(const QStringList &childrenNames, const QList<int> &childrenDebugIds)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -42,9 +42,10 @@ namespace Internal {
|
|||||||
class ContextCrumblePath : public Utils::CrumblePath
|
class ContextCrumblePath : public Utils::CrumblePath
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ContextCrumblePath(QWidget *parent = 0);
|
ContextCrumblePath(QWidget *parent = 0);
|
||||||
virtual ~ContextCrumblePath();
|
|
||||||
bool isEmpty() const;
|
bool isEmpty() const;
|
||||||
int debugIdForIndex(int index) const;
|
int debugIdForIndex(int index) const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user