~ubuntu-branches/ubuntu/wily/qgis/wily

« back to all changes in this revision

Viewing changes to src/gui/qgsfiledropedit.h

  • Committer: Bazaar Package Importer
  • Author(s): Johan Van de Wauw
  • Date: 2010-07-11 20:23:24 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100711202324-5ktghxa7hracohmr
Tags: 1.4.0+12730-3ubuntu1
* Merge from Debian unstable (LP: #540941).
* Fix compilation issues with QT 4.7
* Add build-depends on libqt4-webkit-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
21
/** \ingroup gui
 
22
 * A line edit for capturing file names that can have files dropped onto
 
23
 * it via drag & drop.
 
24
 */
 
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;
 
53
    bool mDragActive;
 
54
};
 
55
 
 
56
#endif