forked from qt-creator/qt-creator
AnalyzerBase: Return base sizeHint() for invalid indices
DetailedErrorDelegate::sizeHint() calls createDetailsWidget() even for
invalid indices, which does not make any sense.
With this change the following messages will not be displayed anymore
when switching to the the Clang Static Analyzer:
QWidget::setMinimumSize: (/QWidget) Negative sizes (636,-1) are not possible
QWidget::setMaximumSize: (/QWidget) Negative sizes (636,-1) are not possible
Task-number: QCE-28
Change-Id: I7d45b2625ad94ddccfbb2c22ff5c07ee0bdd1256
Reviewed-by: Robert Loehning <robert.loehning@theqtcompany.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -51,6 +51,9 @@ DetailedErrorDelegate::DetailedErrorDelegate(QListView *parent)
|
||||
QSize DetailedErrorDelegate::sizeHint(const QStyleOptionViewItem &opt,
|
||||
const QModelIndex &index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return QStyledItemDelegate::sizeHint(opt, index);
|
||||
|
||||
const QListView *view = qobject_cast<const QListView *>(parent());
|
||||
const int viewportWidth = view->viewport()->width();
|
||||
const bool isSelected = view->selectionModel()->currentIndex() == index;
|
||||
|
||||
@@ -154,9 +154,13 @@ static QString errorLocation(const QModelIndex &index, const Error &error,
|
||||
link, linkAttr));
|
||||
}
|
||||
|
||||
QWidget *MemcheckErrorDelegate::createDetailsWidget(const QFont & font, const QModelIndex &errorIndex, QWidget *parent) const
|
||||
QWidget *MemcheckErrorDelegate::createDetailsWidget(const QFont & font,
|
||||
const QModelIndex &errorIndex,
|
||||
QWidget *parent) const
|
||||
{
|
||||
QWidget *widget = new QWidget(parent);
|
||||
QTC_ASSERT(errorIndex.isValid(), return widget);
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
// code + white-space:pre so the padding (see below) works properly
|
||||
// don't include frameName here as it should wrap if required and pre-line is not supported
|
||||
|
||||
Reference in New Issue
Block a user