Subversion Repositories tpanel

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
188 andreas 1
/*
2
 * Copyright (C) 2022 by Andreas Theofilu <andreas@theosys.at>
3
 *
4
 * This program is free software; you can redistribute it and/or modify
5
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation; either version 3 of the License, or
7
 * (at your option) any later version.
8
 *
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program; if not, write to the Free Software Foundation,
16
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
17
 */
18
 
19
#ifndef __TQEDITLINE_H__
20
#define __TQEDITLINE_H__
21
 
22
#include <string>
23
#include <QWidget>
24
 
25
QT_BEGIN_NAMESPACE
26
class QLineEdit;
192 andreas 27
class QTextEdit;
189 andreas 28
class QLabel;
188 andreas 29
class QHBoxLayout;
30
QT_END_NAMESPACE
31
 
191 andreas 32
class TQEditLine : public QWidget
188 andreas 33
{
34
    public:
192 andreas 35
        TQEditLine(QWidget *widget = nullptr, bool multiline=false);
36
        TQEditLine(std::string &text, QWidget *widget = nullptr, bool multiline=false);
188 andreas 37
        ~TQEditLine();
38
 
39
        void setText(std::string &text);
192 andreas 40
        void setPasswordChar(uint c);
190 andreas 41
        std::string& getText() { return mText; }
188 andreas 42
        void setFixedSize(int w, int h);
43
        void move(int x, int y);
44
        void move(QPoint &p);
45
        void setFont(QFont &font);
46
        void setPalette(QPalette &pal);
47
        void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags());
48
        void setPadding(int left, int top, int right, int bottom);
190 andreas 49
        void setFrameSize(int s);
50
        void setAutoFillBackground(bool f);
51
        void installEventFilter(QObject *filter);
192 andreas 52
        void setWordWrapMode(bool mode = false);
190 andreas 53
        WId winId();
54
        void show();
55
        void close();
188 andreas 56
        void clear();
213 andreas 57
        void setInputMask(const std::string& mask);
58
        void setNumericInput();
59
#ifndef __ANDROID__
60
        void setCursor(const QCursor &qc);
61
        void setClearButtonEnabled(bool state);
62
#else
63
        inline void setCursor(const QCursor&) {}
64
        inline void setClearButtonEnabled(bool) {}
65
#endif
192 andreas 66
        void setHandle(ulong handle) { mHandle = handle; }
188 andreas 67
 
189 andreas 68
    signals:
69
        void onTextChanged(const QString &text);
192 andreas 70
        void onTextAreaChanged();
189 andreas 71
 
191 andreas 72
    protected:
73
        bool event(QEvent *event) override;
188 andreas 74
 
75
    private:
76
        void init();
77
 
78
        QHBoxLayout *mLayout{nullptr};
189 andreas 79
        QLineEdit *mEdit{nullptr};
192 andreas 80
        QTextEdit *mTextArea{nullptr};
188 andreas 81
 
82
        std::string mText;
192 andreas 83
        ulong mHandle{0};
84
        bool mChanged{false};
85
        bool mMultiline{false};
188 andreas 86
 
87
        int mPadLeft{0};
88
        int mPadTop{0};
89
        int mPadRight{0};
90
        int mPadBottom{0};
91
        int mWidth{0};
92
        int mHeight{0};
93
        int mPosX{0};
94
        int mPosY{0};
95
};
96
 
97
#endif