Rename internal method check to doCheck

Mac OSX has a check macro in /usr/include/AssertMacros.h which can
conflict with this API if used together.

http://boost.2283326.n4.nabble.com/Boost-with-Darwin-Mac-gcc-4-0-1-td2580330.html

Change-Id: I93ddd08fa2b51b198bbc02ce501d79ed97a32c34
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This commit is contained in:
Stephen Kelly 2012-01-09 13:01:23 +01:00 committed by Qt by Nokia
parent c11cb16f3f
commit c42a969b2f
2 changed files with 6 additions and 18 deletions

View File

@ -468,7 +468,7 @@ void QItemDelegate::paint(QPainter *painter,
value = index.data(Qt::CheckStateRole);
if (value.isValid()) {
checkState = static_cast<Qt::CheckState>(value.toInt());
checkRect = check(opt, opt.rect, value);
checkRect = doCheck(opt, opt.rect, value);
}
// do the layout
@ -625,7 +625,7 @@ void QItemDelegate::updateEditorGeometry(QWidget *editor,
QString text = QItemDelegatePrivate::replaceNewLine(index.data(Qt::DisplayRole).toString());
QRect pixmapRect = QRect(QPoint(0, 0), option.decorationSize).intersected(pixmap.rect());
QRect textRect = textRectangle(0, option.rect, option.font, text);
QRect checkRect = check(option, textRect, index.data(Qt::CheckStateRole));
QRect checkRect = doCheck(option, textRect, index.data(Qt::CheckStateRole));
QStyleOptionViewItem opt = option;
opt.showDecorationSelected = true; // let the editor take up all available space
doLayout(opt, &checkRect, &pixmapRect, &textRect, false);
@ -1079,7 +1079,7 @@ QRect QItemDelegate::rect(const QStyleOptionViewItem &option,
Q_D(const QItemDelegate);
QVariant value = index.data(role);
if (role == Qt::CheckStateRole)
return check(option, option.rect, value);
return doCheck(option, option.rect, value);
if (value.isValid() && !value.isNull()) {
switch (value.type()) {
case QVariant::Invalid:
@ -1109,20 +1109,8 @@ QRect QItemDelegate::rect(const QStyleOptionViewItem &option,
/*!
\internal
Note that on Mac, if /usr/include/AssertMacros.h is included prior
to QItemDelegate, and the application is building in debug mode, the
check(assertion) will conflict with QItemDelegate::check.
To avoid this problem, add
#ifdef check
#undef check
#endif
after including AssertMacros.h
*/
QRect QItemDelegate::check(const QStyleOptionViewItem &option,
QRect QItemDelegate::doCheck(const QStyleOptionViewItem &option,
const QRect &bounding, const QVariant &value) const
{
if (value.isValid()) {
@ -1280,7 +1268,7 @@ bool QItemDelegate::editorEvent(QEvent *event,
if ((event->type() == QEvent::MouseButtonRelease)
|| (event->type() == QEvent::MouseButtonDblClick)
|| (event->type() == QEvent::MouseButtonPress)) {
QRect checkRect = check(option, option.rect, Qt::Checked);
QRect checkRect = doCheck(option, option.rect, Qt::Checked);
QRect emptyRect;
doLayout(option, &checkRect, &emptyRect, &emptyRect, false);
QMouseEvent *me = static_cast<QMouseEvent*>(event);

View File

@ -120,7 +120,7 @@ protected:
QPixmap decoration(const QStyleOptionViewItem &option, const QVariant &variant) const;
QPixmap *selected(const QPixmap &pixmap, const QPalette &palette, bool enabled) const;
QRect check(const QStyleOptionViewItem &option, const QRect &bounding,
QRect doCheck(const QStyleOptionViewItem &option, const QRect &bounding,
const QVariant &variant) const;
QRect textRectangle(QPainter *painter, const QRect &rect,
const QFont &font, const QString &text) const;