Seamly2D
Code documentation
expandingtextedit.cpp
Go to the documentation of this file.
1 /******************************************************************************
2  * @file expandingtextedit.cpp
3  ** @author DS Caskey
4  ** @date Feb 18, 2023
5  **
6  ** @brief
7  ** @copyright
8  ** This source code is part of the Seamly2D project, a pattern making
9  ** program, whose allow create and modeling patterns of clothing.
10  ** Copyright (C) 2017-2023 Seamly2D project
11  ** <https://github.com/fashionfreedom/seamly2d> All Rights Reserved.
12  **
13  ** Seamly2D is free software: you can redistribute it and/or modify
14  ** it under the terms of the GNU General Public License as published by
15  ** the Free Software Foundation, either version 3 of the License, or
16  ** (at your option) any later version.
17  **
18  ** Seamly2D is distributed in the hope that it will be useful,
19  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
20  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  ** GNU General Public License for more details.
22  **
23  ** You should have received a copy of the GNU General Public License
24  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
25  **
26  *************************************************************************/
27 
28 #include "expandingtextedit.h"
29 
30 //---------------------------------------------------------------------------------------------------------------------
32  : QPlainTextEdit(parent)
33 {}
34 
35 //---------------------------------------------------------------------------------------------------------------------
36 ExpandingTextEdit::ExpandingTextEdit(const QString &text, QWidget *parent)
37  : QPlainTextEdit(text, parent)
38 {}
39 
40 //---------------------------------------------------------------------------------------------------------------------
41 void ExpandingTextEdit::focusInEvent(QFocusEvent *e)
42 {
43  QPlainTextEdit::focusInEvent(e);
44  setFixedHeight(64);
45 }
46 
47 //---------------------------------------------------------------------------------------------------------------------
49 {
50  QPlainTextEdit::focusOutEvent(e);
51  setFixedHeight(28);
52 }
virtual void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE
virtual void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE
ExpandingTextEdit(QWidget *parent=nullptr)