File indexing completed on 2024-12-08 13:34:35
0001 /*************************************************************************** 0002 selectionsafelinedit.h - description 0003 ------------------- 0004 begin : Sat Jun 30 2007 0005 copyright : (C) 2007 by Dominik Seichter 0006 email : domseichter@web.de 0007 ***************************************************************************/ 0008 0009 /*************************************************************************** 0010 * * 0011 * This program is free software; you can redistribute it and/or modify * 0012 * it under the terms of the GNU General Public License as published by * 0013 * the Free Software Foundation; either version 2 of the License, or * 0014 * (at your option) any later version. * 0015 * * 0016 ***************************************************************************/ 0017 0018 #ifndef SELECTIONSAFELINEEDIT_H 0019 #define SELECTIONSAFELINEEDIT_H 0020 0021 #include <QLineEdit> 0022 0023 /** A QLineEdit that does not loose its selection 0024 * on focusout events 0025 */ 0026 class SelectionSafeLineEdit : public QLineEdit 0027 { 0028 public: 0029 /** Create a SeletionSafeLineEdit that keeps its selection 0030 * even when the widget does not have the current keyboard focus. 0031 * 0032 * @param parent parent widget 0033 */ 0034 explicit SelectionSafeLineEdit(QWidget *parent = nullptr) 0035 : QLineEdit(parent) 0036 { 0037 0038 } 0039 0040 protected: 0041 void focusOutEvent(QFocusEvent *) 0042 { 0043 // ignore 0044 } 0045 0046 }; 0047 0048 #endif // SELECTIONSAFELINEEDIT_H