00001 /**************************************************************************** 00002 ** 00003 ** Copyright (C) Qxt Foundation. Some rights reserved. 00004 ** 00005 ** This file is part of the QxtGui module of the Qxt library. 00006 ** 00007 ** This library is free software; you can redistribute it and/or modify it 00008 ** under the terms of the Common Public License, version 1.0, as published 00009 ** by IBM, and/or under the terms of the GNU Lesser General Public License, 00010 ** version 2.1, as published by the Free Software Foundation. 00011 ** 00012 ** This file is provided "AS IS", without WARRANTIES OR CONDITIONS OF ANY 00013 ** KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY 00014 ** WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR 00015 ** FITNESS FOR A PARTICULAR PURPOSE. 00016 ** 00017 ** You should have received a copy of the CPL and the LGPL along with this 00018 ** file. See the LICENSE file and the cpl1.0.txt/lgpl-2.1.txt files 00019 ** included with the source distribution for more information. 00020 ** If you did not receive a copy of the licenses, contact the Qxt Foundation. 00021 ** 00022 ** <http://libqxt.org> <foundation@libqxt.org> 00023 ** 00024 ****************************************************************************/ 00025 #ifndef QXTCHECKCOMBOBOX_P_H 00026 #define QXTCHECKCOMBOBOX_P_H 00027 00028 #include <QListView> 00029 #include <QStandardItemModel> 00030 #include "qxtcheckcombobox.h" 00031 #include "qxtpimpl.h" 00032 00033 class QxtCheckComboModel : public QStandardItemModel 00034 { 00035 Q_OBJECT 00036 00037 public: 00038 explicit QxtCheckComboModel(QObject* parent = 0); 00039 00040 virtual Qt::ItemFlags flags(const QModelIndex& index) const; 00041 virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; 00042 virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole); 00043 00044 Q_SIGNALS: 00045 void checkStateChanged(); 00046 }; 00047 00048 class QxtCheckComboBoxPrivate : public QObject, public QxtPrivate<QxtCheckComboBox> 00049 { 00050 Q_OBJECT 00051 00052 public: 00053 QXT_DECLARE_PUBLIC(QxtCheckComboBox); 00054 QxtCheckComboBoxPrivate(); 00055 bool eventFilter(QObject* receiver, QEvent* event); 00056 QString separator; 00057 QString defaultText; 00058 bool containerMousePress; 00059 00060 public Q_SLOTS: 00061 void updateCheckedItems(); 00062 void toggleCheckState(int index); 00063 }; 00064 00065 #endif // QXTCHECKCOMBOBOX_P_H