Logo    
KDWinUtils
Helper library for MFC to Qt migration
Loading...
Searching...
No Matches
kedit.h
Go to the documentation of this file.
1/****************************************************************************
2**
3** This file is part of KDWinutils, KDAB's MFC to Qt migration tool.
4**
5** Copyright (C) 2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
6** All rights reserved.
7**
8** This file is intended solely for use by the migration tools and services
9** provided by Klarälvdalens Datakonsult AB.
10**
11** Any other use or distribution of this software that is not otherwise agreed
12** upon in writing and signed by an authorized representative of Klarälvdalens
13** Datakonsult AB, KDAB (USA) LLC, KDAB (Deutschland) GmbH & Co. K.G.,
14** KDAB (France) SAS, KDAB (UK), Ltd., or any future subsidiary of Klarälvdalens
15** Datakonsult AB is hereby prohibited.
16**
17** Contact info@kdab.com if any conditions stated above are unclear to you.
18**
19****************************************************************************/
20
21#pragma once
22
23#include "../corelib/kstring.h"
25
26class QLineEdit;
27
29
39{
40public:
42 QLineEdit *widget() const;
44 void setWidget(QLineEdit *lineEdit);
45
47 operator KString() const;
48
50 void SetLimitText(unsigned int nMax);
51
53 void SetWindowText(const KString &str);
54
56 void GetWindowText(KString &str) const;
57
59 void Clear();
60
62 void Copy();
63
65 void Cut();
66
68 void Paste();
69
71 void SetReadOnly(bool bReadOnly = true);
72
74 void SetModify(bool bModified = true);
75
77 bool GetModify() const;
78
80 uint GetLimitText() const;
81
83 bool CanUndo() const;
84
90 void SetSel(int nStartChar, int nEndChar = -1);
92 void GetSel(int &nStartChar, int &nEndChar) const;
94 int GetSel() const;
95
96private:
97 QLineEdit *m_widget = nullptr;
98};
99
The KEdit class is used to replace DDX_Control edit data exchange.
Definition kedit.h:39
int GetSel() const
Gets the first character position of the current selection in an edit control.
void Clear()
Call this function to delete (clear) the current selection (if any) in the edit control.
void SetModify(bool bModified=true)
Call this function to set or clear the modified flag for an edit control.
void GetWindowText(KString &str) const
Get the text of the line edit.
uint GetLimitText() const
Call this member function to get the text limit for this KEdit object.
bool GetModify() const
Call this function to determine whether the contents of an edit control have been modified.
void GetSel(int &nStartChar, int &nEndChar) const
Gets the first and last character positions of the current selection in an edit control.
void SetReadOnly(bool bReadOnly=true)
Calls this function to set the read-only state of an edit control.
QLineEdit * widget() const
void Copy()
Call this function to copy the current selection.
void SetLimitText(unsigned int nMax)
Sets the maximum amount of text this KEdit can contain.
void Paste()
Call this function to insert the data from the Clipboard into the KEdit at the insertion point.
void Cut()
Call this function to delete (cut) the current selection.
void setWidget(QLineEdit *lineEdit)
void SetSel(int nStartChar, int nEndChar=-1)
Selects a range of characters in an edit control [start, end[.
bool CanUndo() const
Call this function to determine if the last edit operation can be undone.
void SetWindowText(const KString &str)
Change the text of the line edit.
The KString class provides a Unicode character string.
Definition kstring.h:45
#define KDWINUTILS_EXPORT
Definition kdwinutils_export.h:31
#define KDWINUTILS_BEGIN_NAMESPACE
Definition kdwinutils_global.h:27
#define KDWINUTILS_END_NAMESPACE
Definition kdwinutils_global.h:28