Clang: Clean up diagnostic widget

* Use a single QLabel - No need for all the QLabels we used. Also, a
  single QLabel enables selecting and copying all the diagnostics, which
  is handy when displayed in the info bar.
* Avoid call to Utils::ToolTip::hideImmediately() if the location is
  clicked from the info bar.
* Simplify code and API

Change-Id: Ib991364e4d6f40ef02dada8ebbb90fe6ff8ae1a1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Nikolai Kosjar
2016-10-18 18:01:57 +02:00
parent 75ff9a6fdc
commit 07c5cf3a83
5 changed files with 285 additions and 182 deletions

View File

@@ -34,15 +34,13 @@ QT_END_NAMESPACE
namespace ClangCodeModel {
namespace Internal {
struct DisplayHints {
bool showMainDiagnosticHeader = true;
bool showFileNameInMainDiagnostic = false;
bool enableClickableFixits = true;
};
class ClangDiagnosticWidget {
public:
enum Destination { ToolTip, InfoBar };
void addToolTipToLayout(const ClangBackEnd::DiagnosticContainer &diagnostic,
QLayout *target,
const DisplayHints &displayHints = DisplayHints());
static QWidget *create(const QVector<ClangBackEnd::DiagnosticContainer> &diagnostics,
const Destination &destination);
};
} // namespace Internal
} // namespace ClangCodeModel