Choreonoid  1.8
LineEdit.h
Go to the documentation of this file.
1 
5 #ifndef CNOID_BASE_LINE_EDIT_H
6 #define CNOID_BASE_LINE_EDIT_H
7 
8 #include <cnoid/Signal>
9 #include <QLineEdit>
10 #include "exportdecl.h"
11 
12 namespace cnoid {
13 
14 class CNOID_EXPORT LineEdit : public QLineEdit
15 {
16  Q_OBJECT
17 
18 public:
19  LineEdit(QWidget* parent = 0);
20  LineEdit(const QString& contents, QWidget* parent = 0);
21 
22  void setText(const QString& text){
23  QLineEdit::setText(text);
24  }
25  void setText(const char* text) {
26  QLineEdit::setText(text);
27  }
28  void setText(const std::string& text) {
29  QLineEdit::setText(text.c_str());
30  }
31  std::string string() const {
32  return QLineEdit::text().toStdString();
33  }
34  SignalProxy<void(int oldpos, int newpos)> sigCursorPositoinChanged() {
35  return sigCursorPositionChanged_;
36  }
38  return sigEditingFinished_;
39  }
41  return sigReturnPressed_;
42  }
44  return sigSelectionChanged_;
45  }
46  SignalProxy<void(const QString& text)> sigTextChanged() {
47  return sigTextChanged_;
48  }
49  SignalProxy<void(const QString& text)> sigTextEdited() {
50  return sigTextEdited_;
51  }
52 
53 private Q_SLOTS:
54  void onCursorPositionChanged(int oldpos, int newpos);
55  void onEditingFinished();
56  void onReturnPressed();
57  void onSelectionChanged();
58  void onTextChanged(const QString& text);
59  void onTextEdited(const QString& text);
60 
61 private:
62  Signal<void(int oldpos, int newpos)> sigCursorPositionChanged_;
63  Signal<void()> sigEditingFinished_;
64  Signal<void()> sigReturnPressed_;
65  Signal<void()> sigSelectionChanged_;
66  Signal<void(const QString& text)> sigTextChanged_;
67  Signal<void(const QString& text)> sigTextEdited_;
68 
69  void initialize();
70 };
71 
72 }
73 
74 #endif
cnoid::LineEdit::sigEditingFinished
SignalProxy< void()> sigEditingFinished()
Definition: LineEdit.h:37
cnoid::LineEdit::sigReturnPressed
SignalProxy< void()> sigReturnPressed()
Definition: LineEdit.h:40
cnoid::LineEdit::setText
void setText(const QString &text)
Definition: LineEdit.h:22
cnoid::LineEdit
Definition: LineEdit.h:14
cnoid::LineEdit::sigTextChanged
SignalProxy< void(const QString &text)> sigTextChanged()
Definition: LineEdit.h:46
cnoid::LineEdit::sigCursorPositoinChanged
SignalProxy< void(int oldpos, int newpos)> sigCursorPositoinChanged()
Definition: LineEdit.h:34
cnoid::LineEdit::setText
void setText(const std::string &text)
Definition: LineEdit.h:28
cnoid::LineEdit::sigTextEdited
SignalProxy< void(const QString &text)> sigTextEdited()
Definition: LineEdit.h:49
cnoid
Definition: AbstractSceneLoader.h:11
cnoid::Signal
Definition: Signal.h:165
cnoid::LineEdit::sigSelectionChanged
SignalProxy< void()> sigSelectionChanged()
Definition: LineEdit.h:43
cnoid::SignalProxy
Definition: Signal.h:470
cnoid::LineEdit::setText
void setText(const char *text)
Definition: LineEdit.h:25
cnoid::LineEdit::string
std::string string() const
Definition: LineEdit.h:31