1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
/***************************************************************************
* Copyright (C) 2003-2005 by liuspider *
* liuspider@users.sourceforge.net *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#include "scimstringlistitem.h"
#include <qpainter.h>
class ScimStringListItemPrivate
{
public:
QString text;
scim::AttributeList attrs;
QSize storedSizeHint;
};
ScimStringListItem::ScimStringListItem(QWidget *parent, const char *name)
: QFrame(parent, name), ScimStringRender(this), d(new ScimStringListItemPrivate())
{
}
void ScimStringListItem::drawContents ( QPainter * p )
{
drawString(p, contentsRect());
}
void ScimStringListItem::setText(const QString & text, const scim::AttributeList & attrlist )
{
ScimStringRender::setText(text, attrlist);
updateGeometry();
//notify Qt to repaint this widget
update();
}
QSize ScimStringListItem::sizeHint() const
{
return minimumSizeHint ();
}
QSize ScimStringListItem::minimumSizeHint () const
{
int w = 2*frameWidth();
return ScimStringRender::minimumSizeHint() + QSize(w, w);
}
ScimStringListItem::~ScimStringListItem()
{
delete d;
}
#include "scimstringlistitem.moc"
|