ctkDirectoryButton.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Library:   CTK
00004  
00005   Copyright (c) 2010  Kitware Inc.
00006 
00007   Licensed under the Apache License, Version 2.0 (the "License");
00008   you may not use this file except in compliance with the License.
00009   You may obtain a copy of the License at
00010 
00011       http://www.commontk.org/LICENSE
00012 
00013   Unless required by applicable law or agreed to in writing, software
00014   distributed under the License is distributed on an "AS IS" BASIS,
00015   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016   See the License for the specific language governing permissions and
00017   limitations under the License.
00018  
00019 =========================================================================*/
00020 
00021 #ifndef __ctkDirectoryButton_h
00022 #define __ctkDirectoryButton_h
00023 
00024 // Qt includes
00025 #include <QDir>
00026 #include <QFileDialog>
00027 
00028 // CTK includes
00029 #include <ctkPimpl.h>
00030 #include "CTKWidgetsExport.h"
00031 class ctkDirectoryButtonPrivate;
00032 
00033 class CTK_WIDGETS_EXPORT ctkDirectoryButton: public QWidget
00034 {
00035   Q_OBJECT
00036   Q_PROPERTY(QString directory READ directory WRITE setDirectory)
00037   Q_PROPERTY(QString caption READ caption WRITE setCaption)
00038   Q_PROPERTY(Options options READ options WRITE setOptions)
00039   // QFileDialog::Options is not a meta-type, we need to create our own.
00040   Q_FLAGS(Option Options);
00041 
00042 public: 
00043   // QFileDialog::Options is not a meta-type, we need to create our own.
00044   enum Option
00045     {
00046       ShowDirsOnly          = 0x00000001,
00047       DontResolveSymlinks   = 0x00000002,
00048       DontConfirmOverwrite  = 0x00000004,
00049       DontUseSheet          = 0x00000008,
00050       DontUseNativeDialog   = 0x00000010,
00051       ReadOnly              = 0x00000020,
00052       HideNameFilterDetails = 0x00000040
00053     };
00054   Q_DECLARE_FLAGS(Options, Option)
00055     
00056   ctkDirectoryButton(QWidget * parent = 0);
00057   ctkDirectoryButton(const QString& directory, QWidget * parent = 0);
00058   ctkDirectoryButton(const QIcon& icon, const QString& directory, QWidget * parent = 0);
00059 
00060   void setDirectory(const QString& directory);
00061   QString directory()const;
00062   
00066   void setCaption(const QString& caption);
00067   const QString& caption()const;
00068   
00069   void setOptions(const Options& options);
00070   const Options& options()const;
00071 
00072 public slots:
00073   void browse();
00074 
00075 signals:
00079   void directoryChanged(const QString&);
00080 
00081 private:
00082   CTK_DECLARE_PRIVATE(ctkDirectoryButton);
00083 };
00084 
00085 Q_DECLARE_OPERATORS_FOR_FLAGS(ctkDirectoryButton::Options);
00086 
00087 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated on 21 May 2010 for CTK by  doxygen 1.6.1