Quantum GIS API Documentation  1.7.4
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 /* $Id$ */
00016 #ifndef QGSFILEDROPEDIT_H
00017 #define QGSFILEDROPEDIT_H
00018 
00019 #include <QLineEdit>
00020 
00025 class GUI_EXPORT QgsFileDropEdit: public QLineEdit
00026 {
00027   public:
00028     QgsFileDropEdit( QWidget *parent = 0 );
00029     virtual ~QgsFileDropEdit();
00030 
00031     bool isDirOnly() const { return mDirOnly; }
00032     void setDirOnly( bool isDirOnly );
00033 
00034     bool isFileOnly() const { return mFileOnly; }
00035     void setFileOnly( bool isFileOnly );
00036 
00037     const QString& suffixFilter() const { return mSuffix; }
00038     void setSuffixFilter( const QString& suffix );
00039 
00040   protected:
00041 
00042     virtual void dragEnterEvent( QDragEnterEvent *event );
00043     virtual void dragLeaveEvent( QDragLeaveEvent *event );
00044     virtual void dropEvent( QDropEvent *event );
00045     virtual void paintEvent( QPaintEvent *e );
00046 
00047   private:
00048     QString acceptableFilePath( QDropEvent *event ) const;
00049 
00050     QString mSuffix;
00051     bool mDirOnly;
00052     bool mFileOnly;
00053     bool mDragActive;
00054 };
00055 
00056 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines