VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/extensions/QILineEdit.h@ 88860

Last change on this file since 88860 was 88860, checked in by vboxsync, 4 years ago

FE/Qt: bugref:10003: A bit of cleanup for QILineEdit; Unused stuff.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.7 KB
Line 
1/* $Id: QILineEdit.h 88860 2021-05-04 15:59:15Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - Qt extensions: QILineEdit class declaration.
4 */
5
6/*
7 * Copyright (C) 2008-2021 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef FEQT_INCLUDED_SRC_extensions_QILineEdit_h
19#define FEQT_INCLUDED_SRC_extensions_QILineEdit_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24/* Qt includes */
25#include <QIcon>
26#include <QLineEdit>
27
28/* GUI includes: */
29#include "UILibraryDefs.h"
30
31class QLabel;
32
33/** QLineEdit extension with advanced functionality. */
34class SHARED_LIBRARY_STUFF QILineEdit : public QLineEdit
35{
36 Q_OBJECT;
37
38public:
39
40 /** Constructs line-edit passing @a pParent to the base-class. */
41 QILineEdit(QWidget *pParent = 0);
42 /** Constructs line-edit passing @a pParent to the base-class.
43 * @param strText Brings the line-edit text. */
44 QILineEdit(const QString &strText, QWidget *pParent = 0);
45
46 /** Defines whether this is @a fAllowed to copy contents when disabled. */
47 void setAllowToCopyContentsWhenDisabled(bool fAllowed);
48
49 /** Forces line-edit to adjust minimum width acording to passed @a strText. */
50 void setMinimumWidthByText(const QString &strText);
51 /** Forces line-edit to adjust fixed width acording to passed @a strText. */
52 void setFixedWidthByText(const QString &strText);
53
54 /** Puts an icon to mark some error on the right hand side of the line edit. @p is used as tooltip of the icon. */
55 void mark(bool fError, const QString &strErrorMessage = QString());
56
57protected:
58
59 /** Handles any Qt @a pEvent. */
60 virtual bool event(QEvent *pEvent) /* override */;
61 virtual void paintEvent(QPaintEvent *pPaintEvent) /* override */;
62
63private slots:
64
65 /** Copies text into clipboard. */
66 void copy();
67
68private:
69
70 /** Prepares all. */
71 void prepare();
72
73 /** Calculates suitable @a strText size. */
74 QSize featTextWidth(const QString &strText) const;
75
76 /** Holds whether this is allowed to copy contents when disabled. */
77 bool m_fAllowToCopyContentsWhenDisabled;
78 /** Holds the copy to clipboard action. */
79 QAction *m_pCopyAction;
80
81 QLabel *m_pIconLabel;
82 QIcon m_markIcon;
83 bool m_fMarkForError;
84 QString m_strErrorMessage;
85};
86
87#endif /* !FEQT_INCLUDED_SRC_extensions_QILineEdit_h */
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette