QGIS API Documentation  2.2.0-Valmiera
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsfiledropedit.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsfiledropedit.h - File Dropable LineEdit
3  --------------------------------------
4  Date : 31-Jan-2007
5  Copyright : (C) 2007 by Tom Elwertowski
6  Email : telwertowski at users dot sourceforge dot net
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 #ifndef QGSFILEDROPEDIT_H
16 #define QGSFILEDROPEDIT_H
17 
18 #include <QLineEdit>
19 
24 class GUI_EXPORT QgsFileDropEdit: public QLineEdit
25 {
26  public:
27  QgsFileDropEdit( QWidget *parent = 0 );
28  virtual ~QgsFileDropEdit();
29 
30  bool isDirOnly() const { return mDirOnly; }
31  void setDirOnly( bool isDirOnly );
32 
33  bool isFileOnly() const { return mFileOnly; }
34  void setFileOnly( bool isFileOnly );
35 
36  const QString& suffixFilter() const { return mSuffix; }
37  void setSuffixFilter( const QString& suffix );
38 
39  protected:
40 
41  virtual void dragEnterEvent( QDragEnterEvent *event );
42  virtual void dragLeaveEvent( QDragLeaveEvent *event );
43  virtual void dropEvent( QDropEvent *event );
44  virtual void paintEvent( QPaintEvent *e );
45 
46  private:
47  QString acceptableFilePath( QDropEvent *event ) const;
48 
49  QString mSuffix;
50  bool mDirOnly;
51  bool mFileOnly;
53 };
54 
55 #endif