From bfa5022d7f34e564eebf0e9751a27dbc381c9076 Mon Sep 17 00:00:00 2001 From: san Date: Fri, 25 Jun 2010 05:46:03 +0000 Subject: [PATCH] Some modifications made in frame of project "KALLISTO" --- src/Qtx/QtxPathEdit.cxx | 48 ++++++++++++++++++++++++++++------------ src/Qtx/QtxPathEdit.h | 49 ++++++++++++++++++++++------------------- 2 files changed, 60 insertions(+), 37 deletions(-) diff --git a/src/Qtx/QtxPathEdit.cxx b/src/Qtx/QtxPathEdit.cxx index 3e0c37fa0..95083b8b1 100644 --- a/src/Qtx/QtxPathEdit.cxx +++ b/src/Qtx/QtxPathEdit.cxx @@ -1,17 +1,17 @@ // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// +// // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either +// License as published by the Free Software Foundation; either // version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com @@ -59,14 +59,14 @@ static const char* browse_icon[] = { \brief The QtxPathEdit class represents a widget for file or directory path preference items editing. - The path preference item is represented as the line edit box for the + The path preference item is represented as the line edit box for the direct path editing and small button clicking on which invokes browse - dialog box. The widget can be used in different modes: "Open File", + dialog box. The widget can be used in different modes: "Open File", "Save File", "Select Directory". The mode defines the type of the standard browse dialog box which is invoked on the button clicking. Initial path value can be set with setPath() method. Chosen path - can be retrieved with the path() method. The widget mode can be set + can be retrieved with the path() method. The widget mode can be set with setPathType() and retrieved with pathType() method. In addition, file/direcrory filters (wildcards) can be set with the @@ -144,7 +144,7 @@ QString QtxPathEdit::path() const /*! \brief Set path. - \param txt file or directory path + \param txt file or directory path \sa path() */ void QtxPathEdit::setPath( const QString& txt ) @@ -177,7 +177,27 @@ void QtxPathEdit::setPathFilter( const QString& f ) } /*! - \brief Called when user clicks "Browse" button. + \brief Get currently used validator. + \return validator + \sa setValidator() +*/ +const QValidator* QtxPathEdit::validator() const +{ + return lineEdit()->validator(); +} + +/*! + \brief Set validator. + \param v new validator + \sa validator() +*/ +void QtxPathEdit::setValidator( QValidator* v ) +{ + lineEdit()->setValidator( v ); +} + +/*! + \brief Called when user clicks "Browse" button. Invokes standard browsng dialog box depending on the used widget mode. @@ -202,7 +222,7 @@ void QtxPathEdit::onBrowse( bool /*on*/ ) } if ( !path.isEmpty() ) - myPath->setText( QDir::convertSeparators( path ) ); + myPath->setText( QDir::convertSeparators( path ) ); myPath->setFocus(); } diff --git a/src/Qtx/QtxPathEdit.h b/src/Qtx/QtxPathEdit.h index c4fe189c6..018e2349d 100644 --- a/src/Qtx/QtxPathEdit.h +++ b/src/Qtx/QtxPathEdit.h @@ -1,17 +1,17 @@ // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// +// // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either +// License as published by the Free Software Foundation; either // version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com @@ -27,6 +27,7 @@ #include class QLineEdit; +class QValidator; class QTX_EXPORT QtxPathEdit : public QFrame { @@ -37,29 +38,31 @@ public: QtxPathEdit( QWidget* = 0 ); virtual ~QtxPathEdit(); - QString path() const; - void setPath( const QString& ); + QString path() const; + void setPath( const QString& ); - Qtx::PathType pathType() const; - void setPathType( const Qtx::PathType ); + Qtx::PathType pathType() const; + void setPathType( const Qtx::PathType ); - QString pathFilter() const; - void setPathFilter( const QString& ); + QString pathFilter() const; + void setPathFilter( const QString& ); -private slots: - void onBrowse( bool = false ); + QLineEdit* lineEdit() const; -protected: - QLineEdit* lineEdit() const; + const QValidator* validator() const; + void setValidator( QValidator* ); + +private slots: + void onBrowse( bool = false ); private: - void initialize(); - void updateState(); + void initialize(); + void updateState(); private: - QLineEdit* myPath; - Qtx::PathType myType; - QString myFilter; + QLineEdit* myPath; + Qtx::PathType myType; + QString myFilter; }; #endif -- 2.39.2