Skip to content

Commit

Permalink
Fix cast in KviTalIconAndRichTextItemDelegate (used by both QListWidg…
Browse files Browse the repository at this point in the history
…et and QTreeWidget)
  • Loading branch information
ctrlaltca committed Jan 26, 2024
1 parent 2ce6c65 commit d24624c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/kvilib/tal/KviTalIconAndRichTextItemDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <QAbstractItemView>
#include <QAbstractTextDocumentLayout>
#include <QApplication>
#include <QListWidget>
#include <QPainter>

#define LVI_AFTER_ICON (LVI_BORDER + LVI_ICON_SIZE + LVI_SPACING)
Expand Down Expand Up @@ -102,15 +101,15 @@ QSize KviTalIconAndRichTextItemDelegate::sizeHint(const QStyleOptionViewItem & o
QTextDocument doc;
doc.setHtml(szText);
doc.setDefaultFont(option.font);
doc.setTextWidth(((QListWidget *)parent())->viewport()->width() - LVI_AFTER_ICON - LVI_BORDER);
doc.setTextWidth(((QAbstractItemView *)parent())->viewport()->width() - LVI_AFTER_ICON - LVI_BORDER);
int iHeight = doc.documentLayout()->documentSize().toSize().height();

//qDebug("Size hint (%d,%d)",((QListWidget *)parent())->minimumWidth(), iHeight + (2 * LVI_BORDER));
//qDebug("Size hint (%d,%d)",((QAbstractItemView *)parent())->minimumWidth(), iHeight + (2 * LVI_BORDER));

int iIconWidth = m_oIconSize.width() + (2 * LVI_BORDER);
int iIconHeight = m_oIconSize.height() + (2 * LVI_BORDER);

int w = ((QListWidget *)parent())->minimumWidth();
int w = ((QAbstractItemView *)parent())->minimumWidth();
if(w < iIconWidth)
w = iIconWidth;
if(w < m_oMinimumSize.width())
Expand Down

0 comments on commit d24624c

Please sign in to comment.