check qwt-5.2, r588 into repository

This commit is contained in:
Sean Rhea
2009-09-20 10:09:15 -07:00
parent e906b76fa5
commit 13bd8a1f52
279 changed files with 57199 additions and 0 deletions

135
qwt/designer/designer.pro Normal file
View File

@@ -0,0 +1,135 @@
# -*- mode: sh -*- ###########################
# Qwt Widget Library
# Copyright (C) 1997 Josef Wilgen
# Copyright (C) 2002 Uwe Rathmann
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the Qwt License, Version 1.0
##############################################
QWT_ROOT = ..
include ( $${QWT_ROOT}/qwtconfig.pri )
contains(CONFIG, QwtDesigner) {
CONFIG += warn_on
SUFFIX_STR =
VVERSION = $$[QT_VERSION]
isEmpty(VVERSION) {
# Qt 3
debug {
SUFFIX_STR = $${DEBUG_SUFFIX}
}
else {
SUFFIX_STR = $${RELEASE_SUFFIX}
}
}
else {
CONFIG(debug, debug|release) {
SUFFIX_STR = $${DEBUG_SUFFIX}
}
else {
SUFFIX_STR = $${RELEASE_SUFFIX}
}
}
TEMPLATE = lib
MOC_DIR = moc
OBJECTS_DIR = obj$${SUFFIX_STR}
DESTDIR = plugins/designer
INCLUDEPATH += $${QWT_ROOT}/src
DEPENDPATH += $${QWT_ROOT}/src
LIBNAME = qwt$${SUFFIX_STR}
contains(CONFIG, QwtDll) {
win32 {
DEFINES += QT_DLL QWT_DLL
LIBNAME = $${LIBNAME}$${VER_MAJ}
}
}
!contains(CONFIG, QwtPlot) {
DEFINES += NO_QWT_PLOT
}
!contains(CONFIG, QwtWidgets) {
DEFINES += NO_QWT_WIDGETS
}
unix:LIBS += -L$${QWT_ROOT}/lib -l$${LIBNAME}
win32-msvc:LIBS += $${QWT_ROOT}/lib/$${LIBNAME}.lib
win32-msvc.net:LIBS += $${QWT_ROOT}/lib/$${LIBNAME}.lib
win32-msvc2002:LIBS += $${QWT_ROOT}/lib/$${LIBNAME}.lib
win32-msvc2003:LIBS += $${QWT_ROOT}/lib/$${LIBNAME}.lib
win32-msvc2005:LIBS += $${QWT_ROOT}/lib/$${LIBNAME}.lib
win32-msvc2008:LIBS += $${QWT_ROOT}/lib/$${LIBNAME}.lib
win32-g++:LIBS += -L$${QWT_ROOT}/lib -l$${LIBNAME}
# isEmpty(QT_VERSION) does not work with Qt-4.1.0/MinGW
VVERSION = $$[QT_VERSION]
isEmpty(VVERSION) {
# Qt 3
TARGET = qwtplugin$${SUFFIX_STR}
CONFIG += qt plugin
UI_DIR = ui
HEADERS += qwtplugin.h
SOURCES += qwtplugin.cpp
target.path = $(QTDIR)/plugins/designer
INSTALLS += target
IMAGES += \
pixmaps/qwtplot.png \
pixmaps/qwtanalogclock.png \
pixmaps/qwtcounter.png \
pixmaps/qwtcompass.png \
pixmaps/qwtdial.png \
pixmaps/qwtknob.png \
pixmaps/qwtscale.png \
pixmaps/qwtslider.png \
pixmaps/qwtthermo.png \
pixmaps/qwtwheel.png \
pixmaps/qwtwidget.png
} else {
# Qt 4
TARGET = qwt_designer_plugin$${SUFFIX_STR}
CONFIG += qt designer plugin
RCC_DIR = resources
HEADERS += \
qwt_designer_plugin.h
SOURCES += \
qwt_designer_plugin.cpp
contains(CONFIG, QwtPlot) {
HEADERS += \
qwt_designer_plotdialog.h
SOURCES += \
qwt_designer_plotdialog.cpp
}
RESOURCES += \
qwt_designer_plugin.qrc
target.path = $$[QT_INSTALL_PLUGINS]/designer
INSTALLS += target
}
}
else {
TEMPLATE = subdirs # do nothing
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 992 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 433 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 807 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 543 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,42 @@
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#include <QLineEdit>
#include <QTabWidget>
#include <QHBoxLayout>
#include <QPushButton>
#include "qwt_designer_plotdialog.h"
using namespace QwtDesignerPlugin;
PlotDialog::PlotDialog(const QString &properties, QWidget *parent):
QDialog(parent)
{
setWindowTitle("Plot Properties");
QLineEdit *lineEdit = new QLineEdit(properties);
connect(lineEdit, SIGNAL(textChanged(const QString &)),
SIGNAL(edited(const QString &)));
QTabWidget *tabWidget = new QTabWidget(this);
tabWidget->addTab(lineEdit, "General");
QPushButton *closeButton = new QPushButton("Close");
connect(closeButton, SIGNAL(clicked()), this, SLOT(accept()));
QHBoxLayout *buttonLayout = new QHBoxLayout;
buttonLayout->addStretch(1);
buttonLayout->addWidget(closeButton);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(tabWidget);
mainLayout->addLayout(buttonLayout);
setLayout(mainLayout);
}

View File

@@ -0,0 +1,39 @@
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_DESIGNER_PLOTDIALOG_H
#define QWT_DESIGNER_PLOTDIALOG_H
#include <qglobal.h>
#if QT_VERSION < 0x040000
#ifdef __GNUC__
#error This code is Qt4 only
#endif
#endif
#include <QDialog>
namespace QwtDesignerPlugin
{
class PlotDialog: public QDialog
{
Q_OBJECT
public:
PlotDialog(const QString &properties, QWidget *parent = NULL);
signals:
void edited(const QString&);
};
}
#endif

View File

@@ -0,0 +1,516 @@
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#if defined(_MSC_VER) /* MSVC Compiler */
#pragma warning ( disable : 4786 )
#endif
#include <qglobal.h>
#include <qaction.h>
#include <QtPlugin>
#include <QDesignerFormEditorInterface>
#include <QDesignerFormWindowInterface>
#include <QDesignerFormWindowCursorInterface>
#include <QExtensionManager>
#include <QErrorMessage>
#include "qwt_designer_plugin.h"
#ifndef NO_QWT_PLOT
#include "qwt_designer_plotdialog.h"
#include "qwt_plot.h"
#include "qwt_scale_widget.h"
#endif
#ifndef NO_QWT_WIDGETS
#include "qwt_counter.h"
#include "qwt_wheel.h"
#include "qwt_thermo.h"
#include "qwt_knob.h"
#include "qwt_slider.h"
#include "qwt_analog_clock.h"
#include "qwt_compass.h"
#endif
#include "qwt_text_label.h"
using namespace QwtDesignerPlugin;
CustomWidgetInterface::CustomWidgetInterface(QObject *parent):
QObject(parent),
d_isInitialized(false)
{
}
bool CustomWidgetInterface::isContainer() const
{
return false;
}
bool CustomWidgetInterface::isInitialized() const
{
return d_isInitialized;
}
QIcon CustomWidgetInterface::icon() const
{
return d_icon;
}
QString CustomWidgetInterface::codeTemplate() const
{
return d_codeTemplate;
}
QString CustomWidgetInterface::domXml() const
{
return d_domXml;
}
QString CustomWidgetInterface::group() const
{
return "Qwt Widgets";
}
QString CustomWidgetInterface::includeFile() const
{
return d_include;
}
QString CustomWidgetInterface::name() const
{
return d_name;
}
QString CustomWidgetInterface::toolTip() const
{
return d_toolTip;
}
QString CustomWidgetInterface::whatsThis() const
{
return d_whatsThis;
}
void CustomWidgetInterface::initialize(
QDesignerFormEditorInterface *formEditor)
{
if ( d_isInitialized )
return;
QExtensionManager *manager = formEditor->extensionManager();
if ( manager )
{
manager->registerExtensions(new TaskMenuFactory(manager),
Q_TYPEID(QDesignerTaskMenuExtension));
}
d_isInitialized = true;
}
#ifndef NO_QWT_PLOT
PlotInterface::PlotInterface(QObject *parent):
CustomWidgetInterface(parent)
{
d_name = "QwtPlot";
d_include = "qwt_plot.h";
d_icon = QPixmap(":/pixmaps/qwtplot.png");
d_domXml =
"<widget class=\"QwtPlot\" name=\"qwtPlot\">\n"
" <property name=\"geometry\">\n"
" <rect>\n"
" <x>0</x>\n"
" <y>0</y>\n"
" <width>400</width>\n"
" <height>200</height>\n"
" </rect>\n"
" </property>\n"
"</widget>\n";
}
QWidget *PlotInterface::createWidget(QWidget *parent)
{
return new QwtPlot(parent);
}
#endif
#ifndef NO_QWT_WIDGETS
AnalogClockInterface::AnalogClockInterface(QObject *parent):
CustomWidgetInterface(parent)
{
d_name = "QwtAnalogClock";
d_include = "qwt_analog_clock.h";
d_icon = QPixmap(":/pixmaps/qwtanalogclock.png");
d_domXml =
"<widget class=\"QwtAnalogClock\" name=\"AnalogClock\">\n"
" <property name=\"geometry\">\n"
" <rect>\n"
" <x>0</x>\n"
" <y>0</y>\n"
" <width>200</width>\n"
" <height>200</height>\n"
" </rect>\n"
" </property>\n"
" <property name=\"lineWidth\">\n"
" <number>4</number>\n"
" </property>\n"
"</widget>\n";
}
QWidget *AnalogClockInterface::createWidget(QWidget *parent)
{
return new QwtAnalogClock(parent);
}
#endif
#ifndef NO_QWT_WIDGETS
CompassInterface::CompassInterface(QObject *parent):
CustomWidgetInterface(parent)
{
d_name = "QwtCompass";
d_include = "qwt_compass.h";
d_icon = QPixmap(":/pixmaps/qwtcompass.png");
d_domXml =
"<widget class=\"QwtCompass\" name=\"Compass\">\n"
" <property name=\"geometry\">\n"
" <rect>\n"
" <x>0</x>\n"
" <y>0</y>\n"
" <width>200</width>\n"
" <height>200</height>\n"
" </rect>\n"
" </property>\n"
" <property name=\"lineWidth\">\n"
" <number>4</number>\n"
" </property>\n"
"</widget>\n";
}
QWidget *CompassInterface::createWidget(QWidget *parent)
{
return new QwtCompass(parent);
}
#endif
#ifndef NO_QWT_WIDGETS
CounterInterface::CounterInterface(QObject *parent):
CustomWidgetInterface(parent)
{
d_name = "QwtCounter";
d_include = "qwt_counter.h";
d_icon = QPixmap(":/pixmaps/qwtcounter.png");
d_domXml =
"<widget class=\"QwtCounter\" name=\"Counter\">\n"
"</widget>\n";
}
QWidget *CounterInterface::createWidget(QWidget *parent)
{
return new QwtCounter(parent);
}
#endif
#ifndef NO_QWT_WIDGETS
DialInterface::DialInterface(QObject *parent):
CustomWidgetInterface(parent)
{
d_name = "QwtDial";
d_include = "qwt_dial.h";
d_icon = QPixmap(":/pixmaps/qwtdial.png");
d_domXml =
"<widget class=\"QwtDial\" name=\"Dial\">\n"
" <property name=\"geometry\">\n"
" <rect>\n"
" <x>0</x>\n"
" <y>0</y>\n"
" <width>200</width>\n"
" <height>200</height>\n"
" </rect>\n"
" </property>\n"
" <property name=\"lineWidth\">\n"
" <number>4</number>\n"
" </property>\n"
"</widget>\n";
}
QWidget *DialInterface::createWidget(QWidget *parent)
{
return new QwtDial(parent);
}
#endif
#ifndef NO_QWT_WIDGETS
KnobInterface::KnobInterface(QObject *parent):
CustomWidgetInterface(parent)
{
d_name = "QwtKnob";
d_include = "qwt_knob.h";
d_icon = QPixmap(":/pixmaps/qwtknob.png");
d_domXml =
"<widget class=\"QwtKnob\" name=\"Knob\">\n"
" <property name=\"geometry\">\n"
" <rect>\n"
" <x>0</x>\n"
" <y>0</y>\n"
" <width>100</width>\n"
" <height>100</height>\n"
" </rect>\n"
" </property>\n"
"</widget>\n";
}
QWidget *KnobInterface::createWidget(QWidget *parent)
{
return new QwtKnob(parent);
}
#endif
#ifndef NO_QWT_PLOT
ScaleWidgetInterface::ScaleWidgetInterface(QObject *parent):
CustomWidgetInterface(parent)
{
d_name = "QwtScaleWidget";
d_include = "qwt_scale_widget.h";
d_icon = QPixmap(":/pixmaps/qwtscale.png");
d_domXml =
"<widget class=\"QwtScaleWidget\" name=\"ScaleWidget\">\n"
"</widget>\n";
}
QWidget *ScaleWidgetInterface::createWidget(QWidget *parent)
{
return new QwtScaleWidget(QwtScaleDraw::LeftScale, parent);
}
#endif
#ifndef NO_QWT_WIDGETS
SliderInterface::SliderInterface(QObject *parent):
CustomWidgetInterface(parent)
{
d_name = "QwtSlider";
d_include = "qwt_slider.h";
d_icon = QPixmap(":/pixmaps/qwtslider.png");
d_domXml =
"<widget class=\"QwtSlider\" name=\"Slider\">\n"
" <property name=\"geometry\">\n"
" <rect>\n"
" <x>0</x>\n"
" <y>0</y>\n"
" <width>200</width>\n"
" <height>60</height>\n"
" </rect>\n"
" </property>\n"
"</widget>\n";
}
QWidget *SliderInterface::createWidget(QWidget *parent)
{
QwtSlider *slider = new QwtSlider(parent);
#if 0
slider->setScalePosition(QwtSlider::Bottom);
slider->setRange(0.0, 10.0, 1.0, 0);
slider->setValue(3.0);
#endif
return slider;
}
#endif
TextLabelInterface::TextLabelInterface(QObject *parent):
CustomWidgetInterface(parent)
{
d_name = "QwtTextLabel";
d_include = "qwt_text_label.h";
#ifdef __GNUC__
#warning QwtTextLabel icon is missing
#endif
d_icon = QPixmap(":/pixmaps/qwtwidget.png");
d_domXml =
"<widget class=\"QwtTextLabel\" name=\"TextLabel\">\n"
" <property name=\"geometry\">\n"
" <rect>\n"
" <x>0</x>\n"
" <y>0</y>\n"
" <width>100</width>\n"
" <height>20</height>\n"
" </rect>\n"
" </property>\n"
"</widget>\n";
}
QWidget *TextLabelInterface::createWidget(QWidget *parent)
{
return new QwtTextLabel(parent);
}
#ifndef NO_QWT_WIDGETS
ThermoInterface::ThermoInterface(QObject *parent):
CustomWidgetInterface(parent)
{
d_name = "QwtThermo";
d_include = "qwt_thermo.h";
d_icon = QPixmap(":/pixmaps/qwtthermo.png");
d_domXml =
"<widget class=\"QwtThermo\" name=\"Thermo\">\n"
"</widget>\n";
}
QWidget *ThermoInterface::createWidget(QWidget *parent)
{
return new QwtThermo(parent);
}
#endif
#ifndef NO_QWT_WIDGETS
WheelInterface::WheelInterface(QObject *parent):
CustomWidgetInterface(parent)
{
d_name = "QwtWheel";
d_include = "qwt_wheel.h";
d_icon = QPixmap(":/pixmaps/qwtwheel.png");
d_domXml =
"<widget class=\"QwtWheel\" name=\"Wheel\">\n"
"</widget>\n";
}
QWidget *WheelInterface::createWidget(QWidget *parent)
{
return new QwtWheel(parent);
}
#endif
CustomWidgetCollectionInterface::CustomWidgetCollectionInterface(
QObject *parent):
QObject(parent)
{
#ifndef NO_QWT_PLOT
d_plugins.append(new PlotInterface(this));
d_plugins.append(new ScaleWidgetInterface(this));
#endif
#ifndef NO_QWT_WIDGETS
d_plugins.append(new AnalogClockInterface(this));
d_plugins.append(new CompassInterface(this));
d_plugins.append(new CounterInterface(this));
d_plugins.append(new DialInterface(this));
d_plugins.append(new KnobInterface(this));
d_plugins.append(new SliderInterface(this));
d_plugins.append(new ThermoInterface(this));
d_plugins.append(new WheelInterface(this));
#endif
d_plugins.append(new TextLabelInterface(this));
}
QList<QDesignerCustomWidgetInterface*>
CustomWidgetCollectionInterface::customWidgets(void) const
{
return d_plugins;
}
TaskMenuFactory::TaskMenuFactory(QExtensionManager *parent):
QExtensionFactory(parent)
{
}
QObject *TaskMenuFactory::createExtension(
QObject *object, const QString &iid, QObject *parent) const
{
if (iid == Q_TYPEID(QDesignerTaskMenuExtension))
{
#ifndef NO_QWT_PLOT
if (QwtPlot *plot = qobject_cast<QwtPlot*>(object))
return new TaskMenuExtension(plot, parent);
#endif
#ifndef NO_QWT_WIDGETS
if (QwtDial *dial = qobject_cast<QwtDial*>(object))
return new TaskMenuExtension(dial, parent);
#endif
}
return QExtensionFactory::createExtension(object, iid, parent);
}
TaskMenuExtension::TaskMenuExtension(QWidget *widget, QObject *parent):
QObject(parent),
d_widget(widget)
{
d_editAction = new QAction(tr("Edit Qwt Attributes ..."), this);
connect(d_editAction, SIGNAL(triggered()),
this, SLOT(editProperties()));
}
QList<QAction *> TaskMenuExtension::taskActions() const
{
QList<QAction *> list;
list.append(d_editAction);
return list;
}
QAction *TaskMenuExtension::preferredEditAction() const
{
return d_editAction;
}
void TaskMenuExtension::editProperties()
{
const QVariant v = d_widget->property("propertiesDocument");
if ( v.type() != QVariant::String )
return;
#ifndef NO_QWT_PLOT
QString properties = v.toString();
if ( qobject_cast<QwtPlot*>(d_widget) )
{
PlotDialog dialog(properties);
connect(&dialog, SIGNAL(edited(const QString&)),
SLOT(applyProperties(const QString &)));
(void)dialog.exec();
return;
}
#endif
static QErrorMessage *errorMessage = NULL;
if ( errorMessage == NULL )
errorMessage = new QErrorMessage();
errorMessage->showMessage("Not implemented yet.");
}
void TaskMenuExtension::applyProperties(const QString &properties)
{
QDesignerFormWindowInterface *formWindow
= QDesignerFormWindowInterface::findFormWindow(d_widget);
if ( formWindow && formWindow->cursor() )
formWindow->cursor()->setProperty("propertiesDocument", properties);
}
Q_EXPORT_PLUGIN2(QwtDesignerPlugin, CustomWidgetCollectionInterface)

View File

@@ -0,0 +1,244 @@
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_DESIGNER_PLUGIN_H
#define QWT_DESIGNER_PLUGIN_H
#include <qglobal.h>
#if QT_VERSION < 0x040000
#ifdef __GNUC__
#error This code is Qt4 only
#endif
#endif
#include <QDesignerCustomWidgetInterface>
#include <QDesignerTaskMenuExtension>
#include <QExtensionFactory>
namespace QwtDesignerPlugin
{
class CustomWidgetInterface: public QObject,
public QDesignerCustomWidgetInterface
{
Q_OBJECT
Q_INTERFACES(QDesignerCustomWidgetInterface)
public:
CustomWidgetInterface(QObject *parent);
virtual bool isContainer() const;
virtual bool isInitialized() const;
virtual QIcon icon() const;
virtual QString codeTemplate() const;
virtual QString domXml() const;
virtual QString group() const;
virtual QString includeFile() const;
virtual QString name() const;
virtual QString toolTip() const;
virtual QString whatsThis() const;
virtual void initialize(QDesignerFormEditorInterface *);
protected:
QString d_name;
QString d_include;
QString d_toolTip;
QString d_whatsThis;
QString d_domXml;
QString d_codeTemplate;
QIcon d_icon;
private:
bool d_isInitialized;
};
class CustomWidgetCollectionInterface: public QObject,
public QDesignerCustomWidgetCollectionInterface
{
Q_OBJECT
Q_INTERFACES(QDesignerCustomWidgetCollectionInterface)
public:
CustomWidgetCollectionInterface(QObject *parent = NULL);
virtual QList<QDesignerCustomWidgetInterface*> customWidgets() const;
private:
QList<QDesignerCustomWidgetInterface*> d_plugins;
};
#ifndef NO_QWT_PLOT
class PlotInterface: public CustomWidgetInterface
{
Q_OBJECT
Q_INTERFACES(QDesignerCustomWidgetInterface)
public:
PlotInterface(QObject *parent);
virtual QWidget *createWidget(QWidget *parent);
};
#endif
#ifndef NO_QWT_WIDGETS
class AnalogClockInterface: public CustomWidgetInterface
{
Q_OBJECT
Q_INTERFACES(QDesignerCustomWidgetInterface)
public:
AnalogClockInterface(QObject *parent);
virtual QWidget *createWidget(QWidget *parent);
};
#endif
#ifndef NO_QWT_WIDGETS
class CompassInterface: public CustomWidgetInterface
{
Q_OBJECT
Q_INTERFACES(QDesignerCustomWidgetInterface)
public:
CompassInterface(QObject *parent);
virtual QWidget *createWidget(QWidget *parent);
};
#endif
#ifndef NO_QWT_WIDGETS
class CounterInterface: public CustomWidgetInterface
{
Q_OBJECT
Q_INTERFACES(QDesignerCustomWidgetInterface)
public:
CounterInterface(QObject *parent);
virtual QWidget *createWidget(QWidget *parent);
};
#endif
#ifndef NO_QWT_WIDGETS
class DialInterface: public CustomWidgetInterface
{
Q_OBJECT
Q_INTERFACES(QDesignerCustomWidgetInterface)
public:
DialInterface(QObject *parent);
virtual QWidget *createWidget(QWidget *parent);
};
#endif
#ifndef NO_QWT_WIDGETS
class KnobInterface: public CustomWidgetInterface
{
Q_OBJECT
Q_INTERFACES(QDesignerCustomWidgetInterface)
public:
KnobInterface(QObject *parent);
virtual QWidget *createWidget(QWidget *parent);
};
#endif
#ifndef NO_QWT_PLOT
class ScaleWidgetInterface: public CustomWidgetInterface
{
Q_OBJECT
Q_INTERFACES(QDesignerCustomWidgetInterface)
public:
ScaleWidgetInterface(QObject *parent);
virtual QWidget *createWidget(QWidget *parent);
};
#endif
#ifndef NO_QWT_WIDGETS
class SliderInterface: public CustomWidgetInterface
{
Q_OBJECT
Q_INTERFACES(QDesignerCustomWidgetInterface)
public:
SliderInterface(QObject *parent);
virtual QWidget *createWidget(QWidget *parent);
};
#endif
class TextLabelInterface: public CustomWidgetInterface
{
Q_OBJECT
Q_INTERFACES(QDesignerCustomWidgetInterface)
public:
TextLabelInterface(QObject *parent);
virtual QWidget *createWidget(QWidget *parent);
};
#ifndef NO_QWT_WIDGETS
class ThermoInterface: public CustomWidgetInterface
{
Q_OBJECT
Q_INTERFACES(QDesignerCustomWidgetInterface)
public:
ThermoInterface(QObject *parent);
virtual QWidget *createWidget(QWidget *parent);
};
#endif
#ifndef NO_QWT_WIDGETS
class WheelInterface: public CustomWidgetInterface
{
Q_OBJECT
Q_INTERFACES(QDesignerCustomWidgetInterface)
public:
WheelInterface(QObject *parent);
virtual QWidget *createWidget(QWidget *parent);
};
#endif
class TaskMenuFactory: public QExtensionFactory
{
Q_OBJECT
public:
TaskMenuFactory(QExtensionManager *parent = 0);
protected:
QObject *createExtension(QObject *object,
const QString &iid, QObject *parent) const;
};
class TaskMenuExtension: public QObject,
public QDesignerTaskMenuExtension
{
Q_OBJECT
Q_INTERFACES(QDesignerTaskMenuExtension)
public:
TaskMenuExtension(QWidget *widget, QObject *parent);
QAction *preferredEditAction() const;
QList<QAction *> taskActions() const;
private slots:
void editProperties();
void applyProperties(const QString &);
private:
QAction *d_editAction;
QWidget *d_widget;
};
};
#endif

View File

@@ -0,0 +1,15 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>pixmaps/qwtplot.png</file>
<file>pixmaps/qwtanalogclock.png</file>
<file>pixmaps/qwtcounter.png</file>
<file>pixmaps/qwtcompass.png</file>
<file>pixmaps/qwtdial.png</file>
<file>pixmaps/qwtknob.png</file>
<file>pixmaps/qwtscale.png</file>
<file>pixmaps/qwtslider.png</file>
<file>pixmaps/qwtthermo.png</file>
<file>pixmaps/qwtwheel.png</file>
<file>pixmaps/qwtwidget.png</file>
</qresource>
</RCC>

202
qwt/designer/qwtplugin.cpp Normal file
View File

@@ -0,0 +1,202 @@
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#if defined(_MSC_VER) /* MSVC Compiler */
#pragma warning ( disable : 4786 )
#endif
#include <qglobal.h>
#include <qvaluelist.h>
#include <qmime.h>
#include <qdragobject.h>
#include "qwtplugin.h"
#include "qwt_text_label.h"
#ifndef NO_QWT_PLOT
#include "qwt_plot.h"
#include "qwt_scale_widget.h"
#endif
#ifndef NO_QWT_WIDGETS
#include "qwt_counter.h"
#include "qwt_wheel.h"
#include "qwt_thermo.h"
#include "qwt_knob.h"
#include "qwt_slider.h"
#include "qwt_analog_clock.h"
#include "qwt_compass.h"
#endif
namespace
{
struct Entry
{
Entry() {}
Entry( QString _classname, QString _header, QString _pixmap,
QString _tooltip, QString _whatshis):
classname(_classname),
header(_header),
pixmap(_pixmap),
tooltip(_tooltip),
whatshis(_whatshis)
{}
QString classname;
QString header;
QString pixmap;
QString tooltip;
QString whatshis;
};
QValueList<Entry> vec;
const Entry *entry(const QString& str)
{
for ( uint i = 0; i < vec.count(); i++ )
{
if (str == vec[i].classname)
return &vec[i];
}
return NULL;
}
}
QwtPlugin::QwtPlugin()
{
#ifndef NO_QWT_PLOT
vec.append(Entry("QwtPlot", "qwt_plot.h",
"qwtplot.png", "QwtPlot", "whatsthis"));
vec.append(Entry("QwtScaleWidget", "qwt_scale_widget.h",
"qwtscale.png", "QwtScaleWidget", "whatsthis"));
#endif
#ifndef NO_QWT_WIDGETS
vec.append(Entry("QwtAnalogClock", "qwt_analog_clock.h",
"qwtanalogclock.png", "QwtAnalogClock", "whatsthis"));
vec.append(Entry("QwtCompass", "qwt_compass.h",
"qwtcompass.png", "QwtCompass", "whatsthis"));
vec.append(Entry("QwtCounter", "qwt_counter.h",
"qwtcounter.png", "QwtCounter", "whatsthis"));
vec.append(Entry("QwtDial", "qwt_dial.h",
"qwtdial.png", "QwtDial", "whatsthis"));
vec.append(Entry("QwtKnob", "qwt_knob.h",
"qwtknob.png", "QwtKnob", "whatsthis"));
vec.append(Entry("QwtSlider", "qwt_slider.h",
"qwtslider.png", "QwtSlider", "whatsthis"));
vec.append(Entry("QwtThermo", "qwt_thermo.h",
"qwtthermo.png", "QwtThermo", "whatsthis"));
vec.append(Entry("QwtWheel", "qwt_wheel.h",
"qwtwheel.png", "QwtWheel", "whatsthis"));
#endif
vec.append(Entry("QwtTextLabel", "qwt_text_label.h",
"qwtwidget.png", "QwtTextLabel", "whatsthis"));
}
QWidget* QwtPlugin::create(const QString &key,
QWidget* parent, const char* name)
{
QWidget *w = NULL;
#ifndef NO_QWT_PLOT
if ( key == "QwtPlot" )
w = new QwtPlot( parent );
else if ( key == "QwtScaleWidget" )
w = new QwtScaleWidget( QwtScaleDraw::LeftScale, parent);
#endif
#ifndef NO_QWT_WIDGETS
if ( key == "QwtAnalogClock" )
w = new QwtAnalogClock( parent);
else if ( key == "QwtCounter" )
w = new QwtCounter( parent);
else if ( key == "QwtCompass" )
w = new QwtCompass( parent);
else if ( key == "QwtDial" )
w = new QwtDial( parent);
else if ( key == "QwtWheel" )
w = new QwtWheel( parent);
else if ( key == "QwtThermo" )
w = new QwtThermo( parent);
else if ( key == "QwtKnob" )
w = new QwtKnob( parent);
else if ( key == "QwtSlider" )
w = new QwtSlider( parent);
#endif
if ( key == "QwtTextLabel" )
w = new QwtTextLabel( parent);
if ( w )
w->setName(name);
return w;
}
QStringList QwtPlugin::keys() const
{
QStringList list;
for (unsigned i = 0; i < vec.count(); i++)
list += vec[i].classname;
return list;
}
QString QwtPlugin::group( const QString& feature ) const
{
if (entry(feature) != NULL )
return QString("Qwt");
return QString::null;
}
QIconSet QwtPlugin::iconSet( const QString& pmap) const
{
QString pixmapKey("qwtwidget.png");
if (entry(pmap) != NULL )
pixmapKey = entry(pmap)->pixmap;
const QMimeSource *ms =
QMimeSourceFactory::defaultFactory()->data(pixmapKey);
QPixmap pixmap;
QImageDrag::decode(ms, pixmap);
return QIconSet(pixmap);
}
QString QwtPlugin::includeFile( const QString& feature ) const
{
if (entry(feature) != NULL)
return entry(feature)->header;
return QString::null;
}
QString QwtPlugin::toolTip( const QString& feature ) const
{
if (entry(feature) != NULL )
return entry(feature)->tooltip;
return QString::null;
}
QString QwtPlugin::whatsThis( const QString& feature ) const
{
if (entry(feature) != NULL)
return entry(feature)->whatshis;
return QString::null;
}
bool QwtPlugin::isContainer( const QString& ) const
{
return false;
}
Q_EXPORT_PLUGIN( QwtPlugin )

42
qwt/designer/qwtplugin.h Normal file
View File

@@ -0,0 +1,42 @@
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_PLUGIN_H
#define QWT_PLUGIN_H
#include <qglobal.h>
#if QT_VERSION >= 0x040000
#ifdef __GNUC__
#error This code is Qt3 only
#endif
This code is Qt3 only
#endif
#include <qwidgetplugin.h>
class QT_WIDGET_PLUGIN_EXPORT QwtPlugin: public QWidgetPlugin
{
public:
QwtPlugin();
QStringList keys() const;
QWidget* create( const QString &classname, QWidget* parent = 0, const char* name = 0 );
QString group( const QString& ) const;
QIconSet iconSet( const QString& ) const;
QString includeFile( const QString& ) const;
QString toolTip( const QString& ) const;
QString whatsThis( const QString& ) const;
bool isContainer( const QString& ) const;
};
#endif