Widgets.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef GUI_WIDGETS_H
00025 #define GUI_WIDGETS_H
00026
00027 #include <Gui/ui_DlgTreeWidget.h>
00028 #include <QListWidget>
00029 #include <QLabel>
00030 #include <QLineEdit>
00031 #include <QPointer>
00032 #include <QBasicTimer>
00033 #include <QTime>
00034
00035 namespace Gui {
00036 class PrefCheckBox;
00037 class CommandViewItemPrivate;
00038
00045 class CommandIconView : public QListWidget
00046 {
00047 Q_OBJECT
00048
00049 public:
00050 CommandIconView (QWidget * parent = 0);
00051 virtual ~CommandIconView ();
00052
00053 protected:
00054 void startDrag ( Qt::DropActions supportedActions );
00055
00056 protected Q_SLOTS:
00057 void onSelectionChanged( QListWidgetItem * item, QListWidgetItem * );
00058
00059 Q_SIGNALS:
00061 void emitSelectionChanged( const QString& );
00062 };
00063
00064
00065
00070 class GuiExport AccelLineEdit : public QLineEdit
00071 {
00072 Q_OBJECT
00073
00074 public:
00075 AccelLineEdit ( QWidget * parent=0 );
00076
00077 protected:
00078 void keyPressEvent ( QKeyEvent * e);
00079 };
00080
00081
00082
00083 typedef QPair<QString, bool> CheckListItem;
00084
00090 class GuiExport CheckListDialog : public QDialog
00091 {
00092
00093 Q_OBJECT
00094
00095 public:
00096 CheckListDialog( QWidget* parent = 0, Qt::WFlags fl = 0 );
00097 ~CheckListDialog();
00098
00099 void setCheckableItems( const QStringList& items );
00100 void setCheckableItems( const QList<CheckListItem>& items );
00101 QStringList getCheckedItems() const;
00102
00103 void accept ();
00104
00105 private:
00106 QStringList checked;
00107 Ui_DlgTreeWidget ui;
00108 };
00109
00110
00111
00116 class GuiExport ColorButton : public QPushButton
00117 {
00118 Q_OBJECT
00119
00120 Q_PROPERTY( QColor color READ color WRITE setColor )
00121 Q_PROPERTY( bool allowChangeColor READ allowChangeColor WRITE setAllowChangeColor )
00122 Q_PROPERTY( bool drawFrame READ drawFrame WRITE setDrawFrame )
00123
00124 public:
00125 ColorButton(QWidget* parent = 0);
00126 ~ColorButton();
00127
00128 void setColor(const QColor&);
00129 QColor color() const;
00130
00131 void setAllowChangeColor(bool);
00132 bool allowChangeColor() const;
00133
00134 void setDrawFrame(bool);
00135 bool drawFrame() const;
00136
00137 void setModal(bool);
00138 bool isModal() const;
00139
00140 public Q_SLOTS:
00141 void onChooseColor();
00142
00143 private Q_SLOTS:
00144 void onColorChosen(const QColor&);
00145 void onRejected();
00146
00147 Q_SIGNALS:
00149 void changed();
00150
00151 protected:
00152 void paintEvent (QPaintEvent*);
00153
00154 private:
00155 struct ColorButtonP *d;
00156 };
00157
00158
00159
00168 class GuiExport UrlLabel : public QLabel
00169 {
00170 Q_OBJECT
00171 Q_PROPERTY( QString url READ url WRITE setUrl)
00172
00173 public:
00174 UrlLabel ( QWidget * parent = 0, Qt::WFlags f = 0 );
00175 virtual ~UrlLabel();
00176
00177 QString url() const;
00178
00179 public Q_SLOTS:
00180 void setUrl( const QString &u );
00181
00182 protected:
00183 void enterEvent ( QEvent * );
00184 void leaveEvent ( QEvent * );
00185 void mouseReleaseEvent ( QMouseEvent * );
00186
00187 private:
00188 QString _url;
00189 };
00190
00191
00192
00197 class GuiExport LabelButton : public QWidget
00198 {
00199 Q_OBJECT
00200
00201 Q_PROPERTY(QVariant value READ value WRITE setValue)
00202
00203 public:
00204 LabelButton (QWidget * parent = 0);
00205 virtual ~LabelButton();
00206
00207 QVariant value() const;
00208
00209 QLabel *getLabel() const;
00210 QPushButton *getButton() const;
00211
00212 public Q_SLOTS:
00213 void setValue(const QVariant&);
00214
00215 protected:
00216 virtual void showValue(const QVariant&) = 0;
00217 void resizeEvent(QResizeEvent*);
00218
00219 protected Q_SLOTS:
00220 virtual void browse() = 0;
00221
00222 Q_SIGNALS:
00223 void valueChanged(const QVariant &);
00224
00225 private:
00226 QLabel *label;
00227 QPushButton *button;
00228 QVariant _val;
00229 };
00230
00231
00232
00240 class GuiExport ToolTip : public QObject
00241 {
00242 public:
00243 static void showText(const QPoint & pos, const QString & text, QWidget * w = 0);
00244
00245 protected:
00246 static ToolTip* instance();
00247
00248 ToolTip();
00249 virtual ~ToolTip();
00250
00251 void timerEvent(QTimerEvent *e);
00252 bool eventFilter(QObject* o, QEvent*e);
00253
00254 void installEventFilter();
00255 void removeEventFilter();
00256
00257 private:
00258 bool installed, hidden;
00259 static ToolTip* inst;
00260 QString text;
00261 QPoint pos;
00262 QPointer<QWidget> w;
00263 QBasicTimer tooltipTimer;
00264 QTime displayTime;
00265 };
00266
00267
00268
00269 class GuiExport StatusWidget : public QWidget
00270 {
00271 Q_OBJECT
00272
00273 public:
00274 StatusWidget(QWidget* parent);
00275 ~StatusWidget();
00276 void setStatusText(const QString&);
00277 QSize sizeHint () const;
00278
00279 protected:
00280 void showEvent(QShowEvent*);
00281 void hideEvent(QHideEvent*);
00282 void adjustPosition(QWidget* w);
00283
00284 private:
00285 QLabel* label;
00286 };
00287
00288
00289
00290 class GuiExport LabelEditor : public QWidget
00291 {
00292 Q_OBJECT
00293
00294 Q_PROPERTY(QString text READ text WRITE setText )
00295 Q_PROPERTY(QString buttonText READ buttonText WRITE setButtonText)
00296
00297 public:
00298 LabelEditor (QWidget * parent = 0);
00299 virtual ~LabelEditor();
00300
00304 QString text() const;
00305
00309 QString buttonText() const;
00310
00311 public Q_SLOTS:
00312 virtual void setText(const QString &);
00313 virtual void setButtonText (const QString &);
00314
00315 Q_SIGNALS:
00316 void textChanged(const QString &);
00317
00318 private Q_SLOTS:
00319 void changeText();
00320
00321 private:
00322 QLineEdit *lineEdit;
00323 QPushButton *button;
00324 };
00325
00326 }
00327
00328 #endif // GUI_WIDGETS_H