20 #include <QFileDialog>
22 #include <QGridLayout>
38 if ( mLineEdit->text() == QSettings().value(
"qgis/nullValue",
"NULL" ).toString() )
41 value = mLineEdit->text();
45 value = mLabel->text();
52 QWidget* container =
new QWidget( parent );
53 container->setBackgroundRole( QPalette::Window );
54 container->setAutoFillBackground(
true );
57 QPushButton* pbn =
new QPushButton(
tr(
"..." ), container );
58 QGridLayout* layout =
new QGridLayout();
60 layout->setMargin( 0 );
61 layout->addWidget( le, 0, 0 );
62 layout->addWidget( pbn, 0, 1 );
64 container->setLayout( layout );
71 mLineEdit = qobject_cast<QLineEdit*>( editor );
74 mLineEdit = editor->findChild<QLineEdit*>();
77 mPushButton = editor->findChild<QPushButton*>();
80 connect( mPushButton, SIGNAL( clicked() ),
this, SLOT( selectFileName() ) );
82 mLabel = qobject_cast<QLabel*>( editor );
92 connect( mLineEdit, SIGNAL( textChanged( QString ) ),
this, SLOT(
valueChanged( QString ) ) );
100 if ( value.isNull() )
101 mLineEdit->setText( QSettings().
value(
"qgis/nullValue",
"NULL" ).toString() );
103 mLineEdit->setText( value.toString() );
107 mLabel->setText( value.toString() );
110 void QgsFileNameWidgetWrapper::selectFileName()
115 text = mLineEdit->text();
118 text = mLabel->text();
120 QString fileName = QFileDialog::getOpenFileName( mLineEdit,
tr(
"Select a file" ), QFileInfo( text ).absolutePath() );
122 if ( fileName.isNull() )
126 mLineEdit->setText( QDir::toNativeSeparators( fileName ) );
129 mLineEdit->setText( QDir::toNativeSeparators( fileName ) );