tools/pixeltool/qpixeltool.cpp File Reference

#include "qpixeltool.h"
#include <QtAssistant/QAssistantClient>
#include <qapplication.h>
#include <qdesktopwidget.h>
#include <qclipboard.h>
#include <qpainter.h>
#include <qevent.h>
#include <qfiledialog.h>
#include <qsettings.h>
#include <qmenu.h>
#include <qactiongroup.h>
#include <QtCore/QLibraryInfo>
#include <qdebug.h>

Include dependency graph for qpixeltool.cpp:

Go to the source code of this file.

Functions

void render_string (QPainter *p, int w, int h, const QString &text, int flags)


Function Documentation

void render_string ( QPainter p,
int  w,
int  h,
const QString text,
int  flags 
)

Definition at line 98 of file qpixeltool.cpp.

References QRect::adjust(), Qt::black, p, Qt::TextDontPrint, QRect::x(), and QRect::y().

Referenced by QPixelTool::paintEvent().

00099 {
00100     p->setBrush(QColor(255, 255, 255, 191));
00101     p->setPen(Qt::black);
00102     QRect bounds;
00103     p->drawText(0, 0, w, h, Qt::TextDontPrint | flags, text, &bounds);
00104 
00105     if (bounds.x() == 0) bounds.adjust(0, 0, 10, 0);
00106     else bounds.adjust(-10, 0, 0, 0);
00107 
00108     if (bounds.y() == 0) bounds.adjust(0, 0, 0, 10);
00109     else bounds.adjust(0, -10, 0, 0);
00110 
00111     p->drawRect(bounds);
00112     p->drawText(bounds, flags, text);
00113 }

Here is the call graph for this function:


Generated on Thu Mar 15 14:30:36 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1