itom 2.2.1
K:/git-itom/sources/itom/itomWidgets/comboBox.h
00001 /* ********************************************************************
00002     itom software
00003     URL: http://www.uni-stuttgart.de/ito
00004     Copyright (C) 2016, Institut fuer Technische Optik (ITO),
00005     Universitaet Stuttgart, Germany
00006 
00007     This file is part of itom and its software development toolkit (SDK).
00008 
00009     itom is free software; you can redistribute it and/or modify it
00010     under the terms of the GNU Library General Public Licence as published by
00011     the Free Software Foundation; either version 2 of the Licence, or (at
00012     your option) any later version.
00013    
00014     In addition, as a special exception, the Institut fuer Technische
00015     Optik (ITO) gives you certain additional rights.
00016     These rights are described in the ITO LGPL Exception version 1.0,
00017     which can be found in the file LGPL_EXCEPTION.txt in this package.
00018 
00019     itom is distributed in the hope that it will be useful, but
00020     WITHOUT ANY WARRANTY; without even the implied warranty of
00021     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library
00022     General Public Licence for more details.
00023 
00024     You should have received a copy of the GNU Library General Public License
00025     along with itom. If not, see <http://www.gnu.org/licenses/>.
00026 
00027     This file is a port and modified version of the 
00028     Common framework (http://www.commontk.org)
00029 *********************************************************************** */
00030 
00031 #ifndef COMBOBOX_H
00032 #define COMBOBOX_H
00033 
00034 // Qt includes
00035 #include <QComboBox>
00036 
00037 // CTK includes
00038 //#include "ctkPimpl.h"
00039 #include "commonWidgets.h"
00040 class ComboBoxPrivate;
00041 
00054 class ITOMWIDGETS_EXPORT ComboBox : public QComboBox
00055 {
00056   Q_OBJECT
00057   Q_PROPERTY(QString defaultText READ defaultText WRITE setDefaultText)
00058   Q_PROPERTY(QIcon defaultIcon READ defaultIcon WRITE setDefaultIcon)
00059   Q_PROPERTY(bool forceDefault READ isDefaultForced WRITE forceDefault)
00060   Q_PROPERTY(Qt::TextElideMode elideMode READ elideMode WRITE setElideMode)
00064   Q_PROPERTY(ScrollEffect scrollWheelEffect READ scrollWheelEffect WRITE setScrollWheelEffect)
00065 
00066   Q_ENUMS(ScrollEffect);
00067 public:
00069   explicit ComboBox(QWidget* parent = 0);
00070   virtual ~ComboBox();
00071 
00073   void setDefaultText(const QString&);
00074   QString defaultText()const;
00075 
00077   void setDefaultIcon(const QIcon&);
00078   QIcon defaultIcon()const;
00079 
00082   void forceDefault(bool forceDefault);
00083   bool isDefaultForced()const;
00084 
00087   void setElideMode(const Qt::TextElideMode& newMode);
00088   Qt::TextElideMode elideMode()const;
00089 
00091   enum ScrollEffect
00092   {
00094     NeverScroll,
00096     AlwaysScroll,
00099     ScrollWithFocus,
00102     ScrollWithNoVScrollBar
00103   };
00106   ScrollEffect scrollWheelEffect()const;
00109   void setScrollWheelEffect(ScrollEffect scroll);
00110 
00112   virtual QSize minimumSizeHint()const;
00114   virtual QSize sizeHint()const;
00115 
00116 protected:
00118   virtual void paintEvent(QPaintEvent* event);
00119   virtual void changeEvent(QEvent* event);
00120   virtual void wheelEvent(QWheelEvent* event);
00121 
00122 protected:
00123   QScopedPointer<ComboBoxPrivate> d_ptr;
00124 
00125 private:
00126   Q_DECLARE_PRIVATE(ComboBox);
00127   Q_DISABLE_COPY(ComboBox);
00128 };
00129 
00130 #endif
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties Friends