File indexing completed on 2024-12-22 04:17:35
0001 /*************************************************************************** 0002 * * 0003 * copyright : (C) 2011 Joshua Netterfield * 0004 * joshua.netterfield@gmail.com * 0005 * * 0006 * This program is free software; you can redistribute it and/or modify * 0007 * it under the terms of the GNU General Public License as published by * 0008 * the Free Software Foundation; either version 2 of the License, or * 0009 * (at your option) any later version. * 0010 * * 0011 ***************************************************************************/ 0012 0013 #ifndef LINEEDITITEM_H 0014 #define LINEEDITITEM_H 0015 0016 #include "viewitem.h" 0017 #include "graphicsfactory.h" 0018 #include <QLocalSocket> 0019 0020 class QLineEdit; 0021 0022 namespace Kst { 0023 0024 /** For scripting, a line edit which sends via a socket on edit. */ 0025 0026 class LineEditItem : public ViewItem 0027 { 0028 Q_OBJECT 0029 protected: 0030 QList<QLocalSocket*> _sockets; 0031 QLineEdit* _lineEdit; 0032 QGraphicsProxyWidget* _proxy; 0033 public: 0034 explicit LineEditItem(View *parent); 0035 virtual ~LineEditItem(); 0036 0037 const QString defaultsGroupName() const {return LineEditItem::staticDefaultsGroupName();} 0038 static QString staticDefaultsGroupName() { return QString("lineEdit");} 0039 0040 // for view item dialogs 0041 virtual bool hasStroke() const {return true;} 0042 virtual bool hasBrush() const {return true;} 0043 0044 virtual void save(QXmlStreamWriter &xml); 0045 virtual void paint(QPainter *painter); 0046 0047 public slots: 0048 void setText(QString); 0049 void addSocket(QLocalSocket* s); 0050 void notifyScripts(); 0051 0052 friend class LineEditItemFactory; 0053 }; 0054 0055 class LineEditItemFactory : public GraphicsFactory { 0056 public: 0057 LineEditItemFactory(); 0058 ~LineEditItemFactory(); 0059 ViewItem* generateGraphics(QXmlStreamReader& stream, ObjectStore *store, View *view, ViewItem *parent = 0); 0060 }; 0061 0062 } 0063 0064 #endif 0065 0066 // vim: ts=2 sw=2 et