File indexing completed on 2024-05-12 04:35:13

0001 /****************************************************************************
0002 **
0003 ** Copyright (C) 2016 The Qt Company Ltd.
0004 ** Contact: https://www.qt.io/licensing/
0005 **
0006 ** This file is part of the tools applications of the Qt Toolkit.
0007 **
0008 ** $QT_BEGIN_LICENSE:LGPL$
0009 ** Commercial License Usage
0010 ** Licensees holding valid commercial Qt licenses may use this file in
0011 ** accordance with the commercial license agreement provided with the
0012 ** Software or, alternatively, in accordance with the terms contained in
0013 ** a written agreement between you and The Qt Company. For licensing terms
0014 ** and conditions see https://www.qt.io/terms-conditions. For further
0015 ** information use the contact form at https://www.qt.io/contact-us.
0016 **
0017 ** GNU Lesser General Public License Usage
0018 ** Alternatively, this file may be used under the terms of the GNU Lesser
0019 ** General Public License version 3 as published by the Free Software
0020 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
0021 ** packaging of this file. Please review the following information to
0022 ** ensure the GNU Lesser General Public License version 3 requirements
0023 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
0024 **
0025 ** GNU General Public License Usage
0026 ** Alternatively, this file may be used under the terms of the GNU
0027 ** General Public License version 2.0 or (at your option) the GNU General
0028 ** Public license version 3 or any later version approved by the KDE Free
0029 ** Qt Foundation. The licenses are as published by the Free Software
0030 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
0031 ** included in the packaging of this file. Please review the following
0032 ** information to ensure the GNU General Public License requirements will
0033 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
0034 ** https://www.gnu.org/licenses/gpl-3.0.html.
0035 **
0036 ** $QT_END_LICENSE$
0037 **
0038 ****************************************************************************/
0039 
0040 #ifndef QTTREEPROPERTYBROWSER_H
0041 #define QTTREEPROPERTYBROWSER_H
0042 
0043 #include "qtpropertybrowser.h"
0044 
0045 QT_BEGIN_NAMESPACE
0046 
0047 class QTreeWidgetItem;
0048 class QtTreePropertyBrowserPrivate;
0049 
0050 class QT_QTPROPERTYBROWSER_EXPORT QtTreePropertyBrowser : public QtAbstractPropertyBrowser
0051 {
0052     Q_OBJECT
0053     Q_PROPERTY(int indentation READ indentation WRITE setIndentation)
0054     Q_PROPERTY(bool rootIsDecorated READ rootIsDecorated WRITE setRootIsDecorated)
0055     Q_PROPERTY(bool alternatingRowColors READ alternatingRowColors WRITE setAlternatingRowColors)
0056     Q_PROPERTY(bool headerVisible READ isHeaderVisible WRITE setHeaderVisible)
0057     Q_PROPERTY(ResizeMode resizeMode READ resizeMode WRITE setResizeMode)
0058     Q_PROPERTY(int splitterPosition READ splitterPosition WRITE setSplitterPosition)
0059     Q_PROPERTY(bool propertiesWithoutValueMarked READ propertiesWithoutValueMarked WRITE setPropertiesWithoutValueMarked)
0060 public:
0061 
0062     enum ResizeMode
0063     {
0064         Interactive,
0065         Stretch,
0066         Fixed,
0067         ResizeToContents
0068     };
0069     Q_ENUM(ResizeMode)
0070 
0071     QtTreePropertyBrowser(QWidget *parent = 0);
0072     ~QtTreePropertyBrowser();
0073 
0074     int indentation() const;
0075     void setIndentation(int i);
0076 
0077     bool rootIsDecorated() const;
0078     void setRootIsDecorated(bool show);
0079 
0080     bool alternatingRowColors() const;
0081     void setAlternatingRowColors(bool enable);
0082 
0083     bool isHeaderVisible() const;
0084     void setHeaderVisible(bool visible);
0085 
0086     ResizeMode resizeMode() const;
0087     void setResizeMode(ResizeMode mode);
0088 
0089     int splitterPosition() const;
0090     void setSplitterPosition(int position);
0091 
0092     void setExpanded(QtBrowserItem *item, bool expanded);
0093     bool isExpanded(QtBrowserItem *item) const;
0094 
0095     bool isItemVisible(QtBrowserItem *item) const;
0096     void setItemVisible(QtBrowserItem *item, bool visible);
0097 
0098     void setBackgroundColor(QtBrowserItem *item, const QColor &color);
0099     QColor backgroundColor(QtBrowserItem *item) const;
0100     QColor calculatedBackgroundColor(QtBrowserItem *item) const;
0101 
0102     void setPropertiesWithoutValueMarked(bool mark);
0103     bool propertiesWithoutValueMarked() const;
0104 
0105     void editItem(QtBrowserItem *item);
0106 
0107 Q_SIGNALS:
0108 
0109     void collapsed(QtBrowserItem *item);
0110     void expanded(QtBrowserItem *item);
0111 
0112 protected:
0113     virtual void itemInserted(QtBrowserItem *item, QtBrowserItem *afterItem);
0114     virtual void itemRemoved(QtBrowserItem *item);
0115     virtual void itemChanged(QtBrowserItem *item);
0116 
0117 private:
0118 
0119     QScopedPointer<QtTreePropertyBrowserPrivate> d_ptr;
0120     Q_DECLARE_PRIVATE(QtTreePropertyBrowser)
0121     Q_DISABLE_COPY(QtTreePropertyBrowser)
0122 
0123     Q_PRIVATE_SLOT(d_func(), void slotCollapsed(const QModelIndex &))
0124     Q_PRIVATE_SLOT(d_func(), void slotExpanded(const QModelIndex &))
0125     Q_PRIVATE_SLOT(d_func(), void slotCurrentBrowserItemChanged(QtBrowserItem *))
0126     Q_PRIVATE_SLOT(d_func(), void slotCurrentTreeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *))
0127 
0128 };
0129 
0130 QT_END_NAMESPACE
0131 
0132 #endif