KDEUI
kcolorhelpers.cpp
Go to the documentation of this file.
00001 /* 00002 * This file is part of the KDE project. 00003 * Copyright © 2010 Christoph Feck <christoph@maxiom.de> 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License version 2 as published by the Free Software Foundation. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Library General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Library General Public License 00015 * along with this library; see the file COPYING.LIB. If not, write to 00016 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 * Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #include "kcolorhelpers_p.h" 00021 00022 #include <QtGui/QColor> 00023 #include <QtGui/QPainter> 00024 #include <QtGui/QPixmap> 00025 00026 namespace KDEPrivate { 00027 00028 void fillOpaqueRect(QPainter *painter, const QRect &rect, const QBrush &brush) 00029 { 00030 if (!brush.isOpaque()) { 00031 QPixmap chessboardPattern(16, 16); 00032 QPainter patternPainter(&chessboardPattern); 00033 patternPainter.fillRect(0, 0, 8, 8, Qt::black); 00034 patternPainter.fillRect(8, 8, 8, 8, Qt::black); 00035 patternPainter.fillRect(0, 8, 8, 8, Qt::white); 00036 patternPainter.fillRect(8, 0, 8, 8, Qt::white); 00037 patternPainter.end(); 00038 painter->fillRect(rect, QBrush(chessboardPattern)); 00039 } 00040 painter->fillRect(rect, brush); 00041 } 00042 00043 } // namespace KDEPrivate
KDE 4.6 API Reference