Quantum GIS API Documentation  1.7.5-Wroclaw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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 /* $Id$ */
16 #ifndef QGSFILEDROPEDIT_H
17 #define QGSFILEDROPEDIT_H
18 
19 #include <QLineEdit>
20 
25 class GUI_EXPORT QgsFileDropEdit: public QLineEdit
26 {
27  public:
28  QgsFileDropEdit( QWidget *parent = 0 );
29  virtual ~QgsFileDropEdit();
30 
31  bool isDirOnly() const { return mDirOnly; }
32  void setDirOnly( bool isDirOnly );
33 
34  bool isFileOnly() const { return mFileOnly; }
35  void setFileOnly( bool isFileOnly );
36 
37  const QString& suffixFilter() const { return mSuffix; }
38  void setSuffixFilter( const QString& suffix );
39 
40  protected:
41 
42  virtual void dragEnterEvent( QDragEnterEvent *event );
43  virtual void dragLeaveEvent( QDragLeaveEvent *event );
44  virtual void dropEvent( QDropEvent *event );
45  virtual void paintEvent( QPaintEvent *e );
46 
47  private:
48  QString acceptableFilePath( QDropEvent *event ) const;
49 
50  QString mSuffix;
51  bool mDirOnly;
52  bool mFileOnly;
54 };
55 
56 #endif