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:
parent
c11cb16f3f
commit
c42a969b2f
@ -468,7 +468,7 @@ void QItemDelegate::paint(QPainter *painter,
|
|||||||
value = index.data(Qt::CheckStateRole);
|
value = index.data(Qt::CheckStateRole);
|
||||||
if (value.isValid()) {
|
if (value.isValid()) {
|
||||||
checkState = static_cast<Qt::CheckState>(value.toInt());
|
checkState = static_cast<Qt::CheckState>(value.toInt());
|
||||||
checkRect = check(opt, opt.rect, value);
|
checkRect = doCheck(opt, opt.rect, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// do the layout
|
// do the layout
|
||||||
@ -625,7 +625,7 @@ void QItemDelegate::updateEditorGeometry(QWidget *editor,
|
|||||||
QString text = QItemDelegatePrivate::replaceNewLine(index.data(Qt::DisplayRole).toString());
|
QString text = QItemDelegatePrivate::replaceNewLine(index.data(Qt::DisplayRole).toString());
|
||||||
QRect pixmapRect = QRect(QPoint(0, 0), option.decorationSize).intersected(pixmap.rect());
|
QRect pixmapRect = QRect(QPoint(0, 0), option.decorationSize).intersected(pixmap.rect());
|
||||||
QRect textRect = textRectangle(0, option.rect, option.font, text);
|
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;
|
QStyleOptionViewItem opt = option;
|
||||||
opt.showDecorationSelected = true; // let the editor take up all available space
|
opt.showDecorationSelected = true; // let the editor take up all available space
|
||||||
doLayout(opt, &checkRect, &pixmapRect, &textRect, false);
|
doLayout(opt, &checkRect, &pixmapRect, &textRect, false);
|
||||||
@ -1079,7 +1079,7 @@ QRect QItemDelegate::rect(const QStyleOptionViewItem &option,
|
|||||||
Q_D(const QItemDelegate);
|
Q_D(const QItemDelegate);
|
||||||
QVariant value = index.data(role);
|
QVariant value = index.data(role);
|
||||||
if (role == Qt::CheckStateRole)
|
if (role == Qt::CheckStateRole)
|
||||||
return check(option, option.rect, value);
|
return doCheck(option, option.rect, value);
|
||||||
if (value.isValid() && !value.isNull()) {
|
if (value.isValid() && !value.isNull()) {
|
||||||
switch (value.type()) {
|
switch (value.type()) {
|
||||||
case QVariant::Invalid:
|
case QVariant::Invalid:
|
||||||
@ -1109,20 +1109,8 @@ QRect QItemDelegate::rect(const QStyleOptionViewItem &option,
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
\internal
|
\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
|
const QRect &bounding, const QVariant &value) const
|
||||||
{
|
{
|
||||||
if (value.isValid()) {
|
if (value.isValid()) {
|
||||||
@ -1280,7 +1268,7 @@ bool QItemDelegate::editorEvent(QEvent *event,
|
|||||||
if ((event->type() == QEvent::MouseButtonRelease)
|
if ((event->type() == QEvent::MouseButtonRelease)
|
||||||
|| (event->type() == QEvent::MouseButtonDblClick)
|
|| (event->type() == QEvent::MouseButtonDblClick)
|
||||||
|| (event->type() == QEvent::MouseButtonPress)) {
|
|| (event->type() == QEvent::MouseButtonPress)) {
|
||||||
QRect checkRect = check(option, option.rect, Qt::Checked);
|
QRect checkRect = doCheck(option, option.rect, Qt::Checked);
|
||||||
QRect emptyRect;
|
QRect emptyRect;
|
||||||
doLayout(option, &checkRect, &emptyRect, &emptyRect, false);
|
doLayout(option, &checkRect, &emptyRect, &emptyRect, false);
|
||||||
QMouseEvent *me = static_cast<QMouseEvent*>(event);
|
QMouseEvent *me = static_cast<QMouseEvent*>(event);
|
||||||
|
@ -120,7 +120,7 @@ protected:
|
|||||||
QPixmap decoration(const QStyleOptionViewItem &option, const QVariant &variant) const;
|
QPixmap decoration(const QStyleOptionViewItem &option, const QVariant &variant) const;
|
||||||
QPixmap *selected(const QPixmap &pixmap, const QPalette &palette, bool enabled) 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;
|
const QVariant &variant) const;
|
||||||
QRect textRectangle(QPainter *painter, const QRect &rect,
|
QRect textRectangle(QPainter *painter, const QRect &rect,
|
||||||
const QFont &font, const QString &text) const;
|
const QFont &font, const QString &text) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user