diff options
author | hjk <hjk121@nokiamail.com> | 2014-07-17 17:22:37 +0200 |
---|---|---|
committer | hjk <hjk121@nokiamail.com> | 2014-07-18 08:31:39 +0200 |
commit | aef20d43e1dd309470ea3297df496ef97f10d5aa (patch) | |
tree | e0f963bb30215034a6101a154bf867a696223c41 /src/plugins/debugger | |
parent | 3ed30f09cf779c5b50533f460b4ee522c9d0bf3f (diff) | |
download | qt-creator-aef20d43e1dd309470ea3297df496ef97f10d5aa.tar.gz |
Debugger: More robust approach for DebuggerToolTipTreeView::computeSize
model() == 0 should not happen, but the bugreport indicates there
was something wrong at a time.
Task-number: QTCREATORBUG-12692
Change-Id: Ie850dfc1177d968c39ffae74af89ae1bab44703c
Reviewed-by: hjk <hjk121@nokiamail.com>
Diffstat (limited to 'src/plugins/debugger')
-rw-r--r-- | src/plugins/debugger/debuggertooltipmanager.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/plugins/debugger/debuggertooltipmanager.cpp b/src/plugins/debugger/debuggertooltipmanager.cpp index b4034c522f..2b5afab64a 100644 --- a/src/plugins/debugger/debuggertooltipmanager.cpp +++ b/src/plugins/debugger/debuggertooltipmanager.cpp @@ -999,14 +999,14 @@ int DebuggerToolTipTreeView::computeHeight(const QModelIndex &index) const void DebuggerToolTipTreeView::computeSize() { - WatchTreeView::reexpand(this, model()->index(0, 0)); int columns = 30; // Decoration int rows = 0; bool rootDecorated = false; - if (model()) { - const int columnCount = model()->columnCount(); - rootDecorated = model()->rowCount() > 0; + if (QAbstractItemModel *m = model()) { + WatchTreeView::reexpand(this, m->index(0, 0)); + const int columnCount = m->columnCount(); + rootDecorated = m->rowCount() > 0; if (rootDecorated) for (int i = 0; i < columnCount; ++i) { resizeColumnToContents(i); @@ -1020,6 +1020,7 @@ void DebuggerToolTipTreeView::computeSize() // Add a bit of space to account for tooltip border, and not // touch the border of the screen. QPoint pos(x(), y()); + QTC_ASSERT(QApplication::desktop(), return); QRect desktopRect = QApplication::desktop()->availableGeometry(pos); const int maxWidth = desktopRect.right() - pos.x() - 5 - 5; const int maxHeight = desktopRect.bottom() - pos.y() - 5 - 5; |