diff --git a/bin/gdbmacros/gdbmacros.cpp b/bin/gdbmacros/gdbmacros.cpp index 0d6575db5b7..199b783f45d 100644 --- a/bin/gdbmacros/gdbmacros.cpp +++ b/bin/gdbmacros/gdbmacros.cpp @@ -1674,7 +1674,10 @@ static void qDumpQObjectSignal(QDumper &d) d.beginHash(); P(d, "name", "[" << i << "] slot"); P(d, "type", ""); - P(d, "value", conn.receiver->metaObject()->method(conn.method).signature()); + if (conn.receiver) + P(d, "value", conn.receiver->metaObject()->method(conn.method).signature()); + else + P(d, "value", ""); P(d, "numchild", "0"); d.endHash(); d.beginHash(); @@ -1861,17 +1864,25 @@ static void qDumpQSet(QDumper &d) n = 100; d << ",children=["; int i = 0; - for (int bucket = 0; bucket != hd->numBuckets; ++bucket) { + for (int bucket = 0; bucket != hd->numBuckets && i <= 10000; ++bucket) { for (node = hd->buckets[bucket]; node->next; node = node->next) { d.beginHash(); P(d, "name", "[" << i << "]"); P(d, "type", d.innertype); - P(d, "exp", "(('QHashNode<" << d.innertype - << ",QHashDummyValue>'*)" + P(d, "exp", "(('"NS"QHashNode<" << d.innertype + << ","NS"QHashDummyValue>'*)" << static_cast(node) << ")->key" ); d.endHash(); ++i; + if (i > 10000) { + d.beginHash(); + P(d, "name", "Warning:"); + P(d, "value", ""); + P(d, "type", ""); + d.endHash(); + break; + } } } d << "]"; diff --git a/doc/qtcreator.qch b/doc/qtcreator.qch index 00473f3458d..c728e43245e 100644 Binary files a/doc/qtcreator.qch and b/doc/qtcreator.qch differ diff --git a/doc/qtcreator.qdoc b/doc/qtcreator.qdoc index 4521b7e2fa4..021fe4a9999 100644 --- a/doc/qtcreator.qdoc +++ b/doc/qtcreator.qdoc @@ -69,7 +69,7 @@ \image qtcreator-breakdown.png - \seection1 The Mode Selectors + \section1 The Mode Selectors When working in Qt Creator, you can be in one of five modes: \bold Project, \bold Edit, \bold Debug, \bold Help, and \bold Output. @@ -613,7 +613,7 @@ \page creator-debugging.html \nextpage creator-tips.html - \title Debugging With Qt Creator + \title Debugging with Qt Creator \table \row @@ -677,9 +677,9 @@ \list \o At a particular line you want the program to stop -- click on the - left margin or press \key F9 (\key F8 for Mac Os X). - \o At the name of a function that you want the program to stop -- enter - the function's name in \gui{Set Breakpoint at Function...} under the + left margin or press \key F9 (\key F8 for Mac OS X). + \o At a function that you want the program to stop -- enter the + function's name in \gui{Set Breakpoint at Function...} under the \gui Debug menu. \endlist @@ -744,7 +744,7 @@ When the program being debugged is stopped, Qt Creator displays the nested function calls leading to the current position as a \e call stack trace. - This stack trace is built up from \e call stack frames, each representing a + This stack trace is built up from \e{call stack frames}, each representing a particular function. For each function, Qt Creator will try to retrieve the file name and line number of the corresponding source files. This data is shown in the \gui Stack view. @@ -765,11 +765,10 @@ \section2 Threads - The \gui Thread view displays the state of the program being debugged one - thread at a time. If a multi-threaded program is stopped, the \gui Thread - view or the combobox named \gui Thread in the debugger's status bar can - be used to switch from one thread to another. The \gui Stack view will - adjust itself accordingly. + If a multi-threaded program is stopped, the \gui Thread view or the + combobox named \gui Thread in the debugger's status bar can be used to + switch from one thread to another. The \gui Stack view will adjust itself + accordingly. \section2 Locals and Watchers @@ -851,8 +850,7 @@ function, the latter the current state of the CPU registers. Both views are mainly useful in connection with the low-level \gui{Step single instruction} and \gui{Step over single instruction} - commands - + commands. \section1 A Walkthrough for the Debugger Frontend @@ -947,27 +945,27 @@ \bold{Running Qt Creator from the Command Line} - You can start Qt Creator from a command prompt with an existing session or - \c{.pro} file by giving the name as argument on the command line. + You can start Qt Creator from a command prompt with the name of an existing + session or \c{.pro} file by giving the name as argument on the command + line. - \bold{Sidebar} + \bold{Show and Hide the Sidebar} - You can hide/unhide the sidebar in the edit and debug mode - by clicking on the corresponding icon on the left bottom. - Keyboard shortcut is \key{Alt+0}. + You can show and hide the the sidebar in \gui Edit and \gui Debug mode by + clicking on the corresponding icon, or by pressing \key{Alt+0}. - \bold{Display signals and slots} + \bold{Display Signals and Slots} - If you have an instance of a class derived from QObject and - want to find all other objects connected to one of its - slots by Qt's signals-and-slots mechanism, enable - \gui{Debug} and \gui{Use Custom Display for Qt Objects}. - In the \gui{Locals and Watchers View}, expand the object's - entry and open the wanted slot in the "slots" subitem. The - objects connect to this slot are exposed as children of - this slot. The same works with signals. + If you have an instance of a class that is derived from QObject, and you + you would like to find all other objects connected to one of your object's + slots using Qt's signals and slots mechanism -- you can enable + \gui{Use Custom Display for Qt Objects} feature under the \gui Debug menu. - \bold{Low level display} + In the \gui{Locals and Watchers} view, expand the object's entry and open + the slot in the \e slots subitem. The objects connected to this slot are + exposed as children of the slot. This method works with signals too. + + \bold{Display Low Level Data} If the special debugging of Qt objects fails due to data corruption within the debugged objects, you can switch the @@ -983,33 +981,38 @@ \title Glossary - \bold{System Qt} + \table + \header + \o Term + \o Meaning - \target glossary-system-qt - The version of Qt installed on your system. - This is the one whose \c qmake command is found in the \c PATH. + \row + \o System Qt \target glossary-system-qt + \o The version of Qt installed on your system. This is the Qt + version for the \c qmake command found in your \c PATH. - \bold{Default Qt} + \row + \o Default Qt \target glossary-default-qt + \o The version of Qt configured in \gui{Tools -> Options -> Qt 4 + -> Default Qt Version}. This is the Qt version used by your + new projects. It defaults to System Qt. - \target glossary-default-qt - The version of Qt configured in \gui{Tools - -> Options -> Qt 4 -> Default Qt Version}. This is the version - used by new projects. It defaults to the System Qt. + \row + \o Project Qt \target glossary-project-qt + \o The version of Qt configured in \gui{Build&Run -> Build + Settings -> Build Configurations}. This is the Qt version that + is actually used by a particular project. It defaults to + Default Qt. - \bold{Project Qt} - - \target glossary-project-qt - The version of Qt configured in \gui{Build&Run - -> Build Settings -> Build Configurations}. This is the version - actually used by the project. It defaults to the Default Qt. - - \bold{Shadow Build} - - \target glossary-shadow-build - Shadow building means building the project not in the source directory, - but in a seperate \bold{build directory}. This has the benefit of keeping - the source directory clean. It is also considered "best practice" if - you need many build configurations for a single set of sources. + \row + \o Shadow Build \target glossary-shadow-build + \o Shadow building means building a project in a separate + directory, the \e{build directory}. The build directory is + different from the source directory. One of the benefits of + shadow building is that it keeps your source directory clean. + Shadow building is the best practice if you need many build + configurations for a single set of source. + \endtable */ diff --git a/shared/help/bookmarkmanager.h b/shared/help/bookmarkmanager.h index a8afa867e65..c40d8672db0 100644 --- a/shared/help/bookmarkmanager.h +++ b/shared/help/bookmarkmanager.h @@ -95,8 +95,10 @@ private: QSortFilterProxyModel *proxyModel; }; -class TreeView : public QTreeView { +class TreeView : public QTreeView +{ Q_OBJECT + public: TreeView(QWidget* parent = 0) : QTreeView(parent) {} void subclassKeyPressEvent(QKeyEvent* event) @@ -159,18 +161,18 @@ class BookmarkManager : public QObject Q_OBJECT public: - BookmarkManager(QHelpEngineCore* helpEngine); + BookmarkManager(QHelpEngineCore *helpEngine); ~BookmarkManager(); - BookmarkModel* treeBookmarkModel(); - BookmarkModel* listBookmarkModel(); + BookmarkModel *treeBookmarkModel(); + BookmarkModel *listBookmarkModel(); void saveBookmarks(); QStringList bookmarkFolders() const; - QModelIndex addNewFolder(const QModelIndex& index); + QModelIndex addNewFolder(const QModelIndex &index); void removeBookmarkItem(QTreeView *treeView, const QModelIndex& index); - void showBookmarkDialog(QWidget* parent, const QString &name, const QString &url); - void addNewBookmark(const QModelIndex& index, const QString &name, const QString &url); + void showBookmarkDialog(QWidget *parent, const QString &name, const QString &url); + void addNewBookmark(const QModelIndex &index, const QString &name, const QString &url); void setupBookmarkModels(); private slots: diff --git a/src/app/main.cpp b/src/app/main.cpp index 68dfa3e3b23..ad61ab0c750 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -212,9 +212,9 @@ int main(int argc, char **argv) pluginManager.setPluginPaths(pluginPaths); const QStringList arguments = app.arguments(); - QMap foundAppOptions; + QMap foundAppOptions; if (arguments.size() > 1) { - QMap appOptions; + QMap appOptions; appOptions.insert(QLatin1String(HELP_OPTION1), false); appOptions.insert(QLatin1String(HELP_OPTION2), false); appOptions.insert(QLatin1String(HELP_OPTION3), false); diff --git a/src/libs/cplusplus/CppDocument.cpp b/src/libs/cplusplus/CppDocument.cpp index 3a280416d9b..45ad1f569a5 100644 --- a/src/libs/cplusplus/CppDocument.cpp +++ b/src/libs/cplusplus/CppDocument.cpp @@ -138,19 +138,9 @@ void Document::addIncludeFile(const QString &fileName) _includedFiles.append(fileName); } -QByteArray Document::definedMacros() const +void Document::appendMacro(const Macro ¯o) { - return _definedMacros; -} - -void Document::appendMacro(const QByteArray ¯oName, const QByteArray &text) -{ - int index = macroName.indexOf('('); - if (index == -1) - _macroNames.insert(macroName); - else - _macroNames.insert(macroName.left(index)); - _definedMacros += text; + _definedMacros.append(macro); } void Document::addMacroUse(unsigned offset, unsigned length) @@ -251,11 +241,6 @@ void Document::stopSkippingBlocks(unsigned stop) _skippedBlocks.back() = Block(start, stop); } -QSet Document::macroNames() const -{ - return _macroNames; -} - bool Document::parse(ParseMode mode) { TranslationUnit::ParseMode m = TranslationUnit::ParseTranlationUnit; diff --git a/src/libs/cplusplus/CppDocument.h b/src/libs/cplusplus/CppDocument.h index e952913a07b..d289c579e9c 100644 --- a/src/libs/cplusplus/CppDocument.h +++ b/src/libs/cplusplus/CppDocument.h @@ -36,6 +36,8 @@ #include +#include "pp-macro.h" + #include #include #include @@ -45,6 +47,8 @@ namespace CPlusPlus { +class Macro; + class CPLUSPLUS_EXPORT Document { Document(const Document &other); @@ -63,10 +67,7 @@ public: QStringList includedFiles() const; void addIncludeFile(const QString &fileName); - QByteArray definedMacros() const; - QSet macroNames() const; - - void appendMacro(const QByteArray ¯oName, const QByteArray &text); + void appendMacro(const Macro ¯o); void addMacroUse(unsigned offset, unsigned length); @@ -81,6 +82,9 @@ public: Scope *globalSymbols() const; // ### deprecate? Namespace *globalNamespace() const; + QList definedMacros() const + { return _definedMacros; } + Symbol *findSymbolAt(unsigned line, unsigned column) const; void setSource(const QByteArray &source); @@ -191,8 +195,7 @@ private: TranslationUnit *_translationUnit; Namespace *_globalNamespace; QList _diagnosticMessages; - QByteArray _definedMacros; - QSet _macroNames; + QList _definedMacros; QList _skippedBlocks; QList _macroUses; }; diff --git a/src/libs/cplusplus/Icons.cpp b/src/libs/cplusplus/Icons.cpp index 94b6469ea46..3b7ee24da3c 100644 --- a/src/libs/cplusplus/Icons.cpp +++ b/src/libs/cplusplus/Icons.cpp @@ -61,11 +61,11 @@ Icons::Icons() { } -QIcon Icons::iconForSymbol(Symbol *symbol) const +QIcon Icons::iconForSymbol(const Symbol *symbol) const { if (symbol->isFunction() || (symbol->isDeclaration() && symbol->type()->isFunction())) { - Function *function = symbol->asFunction(); + const Function *function = symbol->asFunction(); if (!function) function = symbol->type()->asFunction(); diff --git a/src/libs/cplusplus/Icons.h b/src/libs/cplusplus/Icons.h index c49bcde12d1..6d4e0bb25d6 100644 --- a/src/libs/cplusplus/Icons.h +++ b/src/libs/cplusplus/Icons.h @@ -47,7 +47,7 @@ class CPLUSPLUS_EXPORT Icons public: Icons(); - QIcon iconForSymbol(Symbol *symbol) const; + QIcon iconForSymbol(const Symbol *symbol) const; QIcon keywordIcon() const; QIcon macroIcon() const; diff --git a/src/libs/cplusplus/OverviewModel.cpp b/src/libs/cplusplus/OverviewModel.cpp index 38456d8fa7d..20658778905 100644 --- a/src/libs/cplusplus/OverviewModel.cpp +++ b/src/libs/cplusplus/OverviewModel.cpp @@ -74,10 +74,10 @@ Symbol *OverviewModel::globalSymbolAt(unsigned index) const QModelIndex OverviewModel::index(int row, int column, const QModelIndex &parent) const { - if (! hasDocument()) { - return QModelIndex(); - } else if (! parent.isValid()) { - Symbol *symbol = globalSymbolAt(row); + if (!parent.isValid()) { + if (row == 0) // account for no symbol item + return createIndex(row, column); + Symbol *symbol = globalSymbolAt(row-1); // account for no symbol item return createIndex(row, column, symbol); } else { Symbol *parentSymbol = static_cast(parent.internalPointer()); @@ -96,12 +96,20 @@ QModelIndex OverviewModel::index(int row, int column, const QModelIndex &parent) QModelIndex OverviewModel::parent(const QModelIndex &child) const { Symbol *symbol = static_cast(child.internalPointer()); - Q_ASSERT(symbol != 0); + if (!symbol) // account for no symbol item + return QModelIndex(); if (Scope *scope = symbol->scope()) { Symbol *parentSymbol = scope->owner(); - if (parentSymbol && parentSymbol->scope()) - return createIndex(parentSymbol->index(), 0, parentSymbol); + if (parentSymbol && parentSymbol->scope()) { + QModelIndex index; + if (parentSymbol->scope() && parentSymbol->scope()->owner() + && parentSymbol->scope()->owner()->scope()) // the parent doesn't have a parent + index = createIndex(parentSymbol->index(), 0, parentSymbol); + else //+1 to account for no symbol item + index = createIndex(parentSymbol->index() + 1, 0, parentSymbol); + return index; + } } return QModelIndex(); @@ -110,22 +118,27 @@ QModelIndex OverviewModel::parent(const QModelIndex &child) const int OverviewModel::rowCount(const QModelIndex &parent) const { if (hasDocument()) { - if (! parent.isValid()) { - return globalSymbolCount(); + if (!parent.isValid()) { + return globalSymbolCount()+1; // account for no symbol item } else { + if (!parent.parent().isValid() && parent.row() == 0) // account for no symbol item + return 0; Symbol *parentSymbol = static_cast(parent.internalPointer()); Q_ASSERT(parentSymbol != 0); if (ScopedSymbol *scopedSymbol = parentSymbol->asScopedSymbol()) { - if (! scopedSymbol->isFunction()) { + if (!scopedSymbol->isFunction()) { Scope *parentScope = scopedSymbol->members(); Q_ASSERT(parentScope != 0); return parentScope->symbolCount(); } } + return 0; } } + if (!parent.isValid()) + return 1; // account for no symbol item return 0; } @@ -136,6 +149,19 @@ int OverviewModel::columnCount(const QModelIndex &) const QVariant OverviewModel::data(const QModelIndex &index, int role) const { + // account for no symbol item + if (!index.parent().isValid() && index.row() == 0) { + switch (role) { + case Qt::DisplayRole: + if (rowCount() > 1) + return tr("