Bring DataVisualization and widget together

svn path=/trunk/KDE/kdebase/workspace/plasma/lib/; revision=638571
This commit is contained in:
Alexander Wiedenbruch 2007-03-02 14:34:41 +00:00
parent b321a91d3d
commit 239e2afb87
7 changed files with 63 additions and 6 deletions

View File

@ -9,6 +9,7 @@ set(plasma_LIB_SRCS
runner.cpp
theme.cpp
dataengine.cpp
datavisualization.cpp
widgets/widget.cpp
widgets/lineedit.cpp

45
datavisualization.cpp Normal file
View File

@ -0,0 +1,45 @@
/*
* Copyright (C) 2007 Alexander Wiedenbruch <mail@wiedenbruch.de>
*
* 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
* published by the Free Software Foundation
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "datavisualization.h"
namespace Plasma
{
class DataVisualization::Private
{
};
DataVisualization::DataVisualization(QObject *parent)
: QObject(parent),
d(new Private)
{
}
DataVisualization::~DataVisualization()
{
delete d;
}
#include "datavisualization.moc"
} // Plasma namespace

View File

@ -27,12 +27,12 @@ namespace Plasma
{
// this will end up being multiple-inherited?
class DataVisualization : QObject
class DataVisualization : public QObject
{
Q_OBJECT
public:
DataVisualization(QObject* parent);
DataVisualization(QObject* parent = 0);
virtual ~DataVisualization();
public slots:

View File

@ -79,6 +79,10 @@ LineEdit::~LineEdit()
delete d;
}
void LineEdit::data(const DataSource::Data&)
{
}
/*
Some code in this method is copied from QLineEdit.
Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.

View File

@ -32,7 +32,7 @@
namespace Plasma
{
class KDE_EXPORT LineEdit : public QObject, public Widget
class KDE_EXPORT LineEdit : public Widget
{
Q_OBJECT
@ -49,6 +49,9 @@ class KDE_EXPORT LineEdit : public QObject, public Widget
void keyPressEvent(QKeyEvent *event);
void mousePressEvent(QGraphicsSceneMouseEvent *event);
public Q_SLOTS:
void data(const DataSource::Data&);
protected:
void focusOutEvent(QFocusEvent *event);

View File

@ -22,8 +22,9 @@ namespace Plasma
{
Widget::Widget(QGraphicsItem *parent, QPointF pos, QSizeF size)
: QGraphicsItem(parent)
{
: QGraphicsItem(parent),
DataVisualization()
{
m_boundingBox = QRectF(0, 0, size.width(), size.height());
setPos(pos);
}

View File

@ -23,10 +23,13 @@
#include <kdemacros.h>
#include "datavisualization.h"
namespace Plasma
{
class KDE_EXPORT Widget : public QGraphicsItem
class KDE_EXPORT Widget : public QGraphicsItem,
public DataVisualization
{
public:
Widget(QGraphicsItem *parent, QPointF pos, QSizeF size);