X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FQtx%2FQtxPathEdit.cxx;h=57b6a8b042edd9caa1e0512378bed163a5660a92;hb=373ceb017989dce241907729a6391ce0af8b9dcb;hp=ae0dbfc69bb5a8c498871226827293ca13eecc32;hpb=33cfab46cd4e38d290c412bf05fd828b305979d6;p=modules%2Fgui.git diff --git a/src/Qtx/QtxPathEdit.cxx b/src/Qtx/QtxPathEdit.cxx index ae0dbfc69..57b6a8b04 100644 --- a/src/Qtx/QtxPathEdit.cxx +++ b/src/Qtx/QtxPathEdit.cxx @@ -22,10 +22,12 @@ // #include "QtxPathEdit.h" +#include #include #include #include #include +#include #include #include #include @@ -78,11 +80,14 @@ static const char* browse_icon[] = { \brief Constructor \param type widget mode (Qtx::PathType) \param parent parent widget + \param browse if \c true, automatically finish editing of file path when + user presses OK in "Select File/Directory" dialog box \sa pathType(), setPathType() */ -QtxPathEdit::QtxPathEdit( const Qtx::PathType type, QWidget* parent ) +QtxPathEdit::QtxPathEdit( const Qtx::PathType type, QWidget* parent, bool browse ) : QFrame( parent ), - myType( type ) + myType( type ), + myBrowse ( browse ) { initialize(); } @@ -93,11 +98,14 @@ QtxPathEdit::QtxPathEdit( const Qtx::PathType type, QWidget* parent ) Qtx::PT_OpenFile mode is used by default. \param parent parent widget + \param browse if \c true, automatically finish editing of file path when + user presses OK in "Select File/Directory" dialog box \sa pathType(), setPathType() */ -QtxPathEdit::QtxPathEdit( QWidget* parent ) +QtxPathEdit::QtxPathEdit( QWidget* parent, bool browse ) : QFrame( parent ), - myType( Qtx::PT_OpenFile ) + myType( Qtx::PT_OpenFile ), + myBrowse ( browse ) { initialize(); } @@ -206,6 +214,9 @@ void QtxPathEdit::onBrowse( bool /*on*/ ) myPath->setText( QDir::convertSeparators( path ) ); myPath->setFocus(); + + if ( !path.isEmpty() && myBrowse ) + QApplication::postEvent( myPath, new QKeyEvent( QEvent::KeyPress, Qt::Key_Enter, Qt::NoModifier ) ); } /*!