]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Property "Selection"
authorstv <stv@opencascade.com>
Mon, 11 Sep 2006 13:36:58 +0000 (13:36 +0000)
committerstv <stv@opencascade.com>
Mon, 11 Sep 2006 13:36:58 +0000 (13:36 +0000)
src/QDS/QDS_LineEdit.cxx
src/QDS/QDS_LineEdit.h

index 803d9397f118cd04e77ca2f8b31855d5224f1b8f..cb5ddf1486690e53029822e4b2e4883f4d57bb04 100644 (file)
@@ -125,6 +125,34 @@ void QDS_LineEdit::selectAll()
     lineEdit()->selectAll();
 }
 
+/*!
+  Deselect all text in the editor.
+*/
+void QDS_LineEdit::deselect()
+{
+  if ( lineEdit() )
+    lineEdit()->deselect();
+}
+
+/*!
+  Select or deselect all text in the editor.
+*/
+void QDS_LineEdit::setSelection( const bool on )
+{
+  if ( on )
+    selectAll();
+  else
+    deselect();
+}
+
+/*!
+  Returns true if the editor has selected text.
+*/
+bool QDS_LineEdit::hasSelection() const
+{
+  return lineEdit() ? lineEdit()->hasSelectedText() : false;
+}
+
 /*!
   Set the aligment of line edit. Reimplemented from QDS_Datum.
 */
index e67b86e2bfebea643a3f4781bc5594f7c995a2b2..293e57eedf58b73cb0c52fac55d3b361c0f73423 100644 (file)
@@ -27,6 +27,8 @@ class QDS_EXPORT QDS_LineEdit : public QDS_Datum
 {
   Q_OBJECT
 
+  Q_PROPERTY( bool Selection READ hasSelection WRITE setSelection )
+
 protected:
   class Editor;
 
@@ -34,9 +36,13 @@ public:
   QDS_LineEdit( const QString&, QWidget* = 0, const int = All, const QString& = QString::null );
   virtual ~QDS_LineEdit();
 
+  virtual void         deselect();
   virtual void         selectAll();
   virtual void         setAlignment( const int, const int = Label );
 
+  bool                 hasSelection() const;
+  void                 setSelection( const bool );
+
 signals:
   void                 returnPressed();