documented Plasma::CheckBox, removed methods now implemented in Plasma::Widget for this widget.
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=696084
This commit is contained in:
parent
a53be5affe
commit
23fe05689a
@ -93,11 +93,6 @@ CheckBox::~CheckBox()
|
||||
delete d;
|
||||
}
|
||||
|
||||
QRectF CheckBox::boundingRect() const
|
||||
{
|
||||
return QRectF(0, 0, d->width, d->height);
|
||||
}
|
||||
|
||||
void CheckBox::paintWidget(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
{
|
||||
Q_UNUSED(option)
|
||||
@ -150,51 +145,6 @@ QString CheckBox::text() const
|
||||
{
|
||||
return d->labelText;
|
||||
}
|
||||
int CheckBox::height() const
|
||||
{
|
||||
return d->height;
|
||||
}
|
||||
|
||||
int CheckBox::width() const
|
||||
{
|
||||
return d->width;
|
||||
}
|
||||
|
||||
void CheckBox::setHeight(int h)
|
||||
{
|
||||
prepareGeometryChange ();
|
||||
d->height = h;
|
||||
update();
|
||||
}
|
||||
|
||||
void CheckBox::setWidth(int w)
|
||||
{
|
||||
if (!(w >= d->maxWidth)) {
|
||||
prepareGeometryChange ();
|
||||
d->width = w;
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
QSize CheckBox::size() const
|
||||
{
|
||||
return QSize(d->width,d->height);
|
||||
}
|
||||
|
||||
void CheckBox::setSize(const QSize &s)
|
||||
{
|
||||
prepareGeometryChange ();
|
||||
if (!d->maxWidth >= s.width() ) {
|
||||
d->width = s.width();
|
||||
}
|
||||
d->height = s.height();
|
||||
update();
|
||||
}
|
||||
|
||||
void CheckBox::setMaximumWidth(int w)
|
||||
{
|
||||
d->maxWidth= w;
|
||||
}
|
||||
|
||||
Qt::CheckState CheckBox::checkState() const
|
||||
{
|
||||
@ -206,6 +156,11 @@ void CheckBox::setChecked(bool checked)
|
||||
d->state = checked ? Qt::Checked : Qt::Unchecked;
|
||||
}
|
||||
|
||||
bool CheckBox::isChecked() const
|
||||
{
|
||||
return (d->state == Qt::Checked);
|
||||
}
|
||||
|
||||
void CheckBox::setCheckState(Qt::CheckState state)
|
||||
{
|
||||
d->state = state;
|
||||
@ -224,7 +179,6 @@ void CheckBox::mousePressEvent(QGraphicsSceneMouseEvent * event)
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
void CheckBox::mouseReleaseEvent(QGraphicsSceneMouseEvent * event)
|
||||
{
|
||||
event->accept();
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2007 by Siraj Razick siraj@kdemail.net
|
||||
* Copyright (C) 2007 by Siraj Razick <siraj@kdemail.net>
|
||||
* Copyright (C) 2007 by Matt Broadstone <mbroadst@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License version 2 as
|
||||
@ -26,47 +27,83 @@
|
||||
#include <plasma/dataengine.h>
|
||||
#include <plasma/widgets/widget.h>
|
||||
|
||||
//TODO
|
||||
//Please Document this class
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
/**
|
||||
* Class that emulates a QCheckBox inside plasma
|
||||
* This class provides a QCheckBox available as a Plasma::Widget, so it can be used
|
||||
* within Plasma::Applet's.
|
||||
*
|
||||
* @author Siraj Razick <siraj@kde.org>
|
||||
*/
|
||||
class PLASMA_EXPORT CheckBox : public Plasma::Widget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
* Creates a new Plasma::CheckBox.
|
||||
* @param parent the QGraphicsItem this icon is parented to.
|
||||
*/
|
||||
explicit CheckBox(QGraphicsItem *parent = 0);
|
||||
|
||||
/**
|
||||
* Creates a new Plasma::Icon with default text.
|
||||
* @param text the text to display next to the checkbox.
|
||||
* @param parent the QGraphicsItem this icon is parented to.
|
||||
*/
|
||||
explicit CheckBox(const QString &text, QGraphicsItem *parent = 0);
|
||||
|
||||
/**
|
||||
* Destroys a Plasma::Icon.
|
||||
*/
|
||||
virtual ~CheckBox();
|
||||
|
||||
void paintWidget(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
|
||||
QRectF boundingRect() const;
|
||||
/**
|
||||
* @return whether this checkbox is currently checked.
|
||||
*/
|
||||
bool isChecked() const;
|
||||
|
||||
Qt::CheckState checkState() const;
|
||||
/**
|
||||
* Sets the checked state of this Plasma::CheckBox.
|
||||
* @param checked whether the Plasma::CheckBox is checked or not.
|
||||
*/
|
||||
void setChecked(bool checked);
|
||||
|
||||
/**
|
||||
* @return the checkstate of this Plasma::CheckBox.
|
||||
*/
|
||||
Qt::CheckState checkState() const;
|
||||
|
||||
/**
|
||||
* Sets the checkstate of this Plasma::CheckBox
|
||||
* @see <qt.h> for definition of Qt::CheckState
|
||||
* @param state the checkstate of this Plasma::CheckBox
|
||||
*/
|
||||
void setCheckState(Qt::CheckState state);
|
||||
|
||||
void setText(const QString&) ;
|
||||
/**
|
||||
* @return the text associated with this Plasma::CheckBox
|
||||
*/
|
||||
QString text() const;
|
||||
|
||||
QSize size() const;
|
||||
void setSize(const QSize &size);
|
||||
/**
|
||||
* Sets the text associated with this Plasma::CheckBox
|
||||
* @param text the text to associate with this Plasma::CheckBox.
|
||||
*/
|
||||
void setText(const QString &text);
|
||||
|
||||
int height() const;
|
||||
void setHeight(int height);
|
||||
|
||||
int width() const;
|
||||
void setWidth(int width);
|
||||
void setMaximumWidth(int maxwidth);
|
||||
/*
|
||||
bool isTristate() const;
|
||||
void setTristate(bool triState = true);
|
||||
*/
|
||||
|
||||
public Q_SLOTS:
|
||||
void updated(const QString&, const DataEngine::Data&);
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* Indicates that this Plasma::CheckBox has been clicked, changing its state.
|
||||
*/
|
||||
void clicked();
|
||||
|
||||
protected:
|
||||
@ -78,6 +115,8 @@ protected:
|
||||
void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
|
||||
void hoverEnterEvent ( QGraphicsSceneHoverEvent * event );
|
||||
|
||||
void paintWidget(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
|
||||
|
||||
private:
|
||||
void init();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user