Quantum GIS API Documentation  1.8
src/gui/qgsfiledropedit.h
Go to the documentation of this file.
00001 /***************************************************************************
00002     qgsfiledropedit.h - File Dropable LineEdit
00003      --------------------------------------
00004     Date                 : 31-Jan-2007
00005     Copyright            : (C) 2007 by Tom Elwertowski
00006     Email                : telwertowski at users dot sourceforge dot net
00007  ***************************************************************************
00008  *                                                                         *
00009  *   This program is free software; you can redistribute it and/or modify  *
00010  *   it under the terms of the GNU General Public License as published by  *
00011  *   the Free Software Foundation; either version 2 of the License, or     *
00012  *   (at your option) any later version.                                   *
00013  *                                                                         *
00014  ***************************************************************************/
00015 #ifndef QGSFILEDROPEDIT_H
00016 #define QGSFILEDROPEDIT_H
00017 
00018 #include <QLineEdit>
00019 
00024 class GUI_EXPORT QgsFileDropEdit: public QLineEdit
00025 {
00026   public:
00027     QgsFileDropEdit( QWidget *parent = 0 );
00028     virtual ~QgsFileDropEdit();
00029 
00030     bool isDirOnly() const { return mDirOnly; }
00031     void setDirOnly( bool isDirOnly );
00032 
00033     bool isFileOnly() const { return mFileOnly; }
00034     void setFileOnly( bool isFileOnly );
00035 
00036     const QString& suffixFilter() const { return mSuffix; }
00037     void setSuffixFilter( const QString& suffix );
00038 
00039   protected:
00040 
00041     virtual void dragEnterEvent( QDragEnterEvent *event );
00042     virtual void dragLeaveEvent( QDragLeaveEvent *event );
00043     virtual void dropEvent( QDropEvent *event );
00044     virtual void paintEvent( QPaintEvent *e );
00045 
00046   private:
00047     QString acceptableFilePath( QDropEvent *event ) const;
00048 
00049     QString mSuffix;
00050     bool mDirOnly;
00051     bool mFileOnly;
00052     bool mDragActive;
00053 };
00054 
00055 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines