diff options
Diffstat (limited to 'examples/declarative/extending/extended/lineedit.cpp')
-rw-r--r-- | examples/declarative/extending/extended/lineedit.cpp | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/examples/declarative/extending/extended/lineedit.cpp b/examples/declarative/extending/extended/lineedit.cpp new file mode 100644 index 0000000..fe4fdc3 --- /dev/null +++ b/examples/declarative/extending/extended/lineedit.cpp @@ -0,0 +1,66 @@ +#include "lineedit.h" +#include <qml.h> + +LineEditExtension::LineEditExtension(QObject *object) +: QObject(object), m_lineedit(static_cast<QLineEdit *>(object)) +{ +} + +int LineEditExtension::leftMargin() const +{ + int l, r, t, b; + m_lineedit->getTextMargins(&l, &t, &r, &b); + return l; +} + +int LineEditExtension::setLeftMargin(int m) +{ + int l, r, t, b; + m_lineedit->getTextMargins(&l, &t, &r, &b); + m_lineedit->setTextMargins(m, t, r, b); +} + +int LineEditExtension::rightMargin() const +{ + int l, r, t, b; + m_lineedit->getTextMargins(&l, &t, &r, &b); + return r; +} + +int LineEditExtension::setRightMargin(int m) +{ + int l, r, t, b; + m_lineedit->getTextMargins(&l, &t, &r, &b); + m_lineedit->setTextMargins(l, t, m, b); +} + +int LineEditExtension::topMargin() const +{ + int l, r, t, b; + m_lineedit->getTextMargins(&l, &t, &r, &b); + return t; +} + +int LineEditExtension::setTopMargin(int m) +{ + int l, r, t, b; + m_lineedit->getTextMargins(&l, &t, &r, &b); + m_lineedit->setTextMargins(l, m, r, b); +} + +int LineEditExtension::bottomMargin() const +{ + int l, r, t, b; + m_lineedit->getTextMargins(&l, &t, &r, &b); + return b; +} + +int LineEditExtension::setBottomMargin(int m) +{ + int l, r, t, b; + m_lineedit->getTextMargins(&l, &t, &r, &b); + m_lineedit->setTextMargins(l, t, r, m); +} + +QML_DECLARE_TYPE(QLineEdit); +QML_DEFINE_EXTENDED_TYPE(QLineEdit, QLineEdit, LineEditExtension); |