2022-05-10 10:06:48 +00:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
#ifndef XBELTREE_H
|
|
|
|
#define XBELTREE_H
|
|
|
|
|
|
|
|
#include <QDomDocument>
|
|
|
|
#include <QIcon>
|
|
|
|
#include <QTreeWidget>
|
|
|
|
|
2023-04-12 14:22:24 +00:00
|
|
|
//! [0]
|
2011-04-27 10:05:43 +00:00
|
|
|
class XbelTree : public QTreeWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2023-06-12 09:48:21 +00:00
|
|
|
explicit XbelTree(QWidget *parent = nullptr);
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
bool read(QIODevice *device);
|
2016-10-31 10:09:00 +00:00
|
|
|
bool write(QIODevice *device) const;
|
|
|
|
|
|
|
|
protected:
|
2023-06-12 09:48:21 +00:00
|
|
|
#if QT_CONFIG(clipboard) && QT_CONFIG(contextmenu)
|
2017-09-18 08:36:49 +00:00
|
|
|
void contextMenuEvent(QContextMenuEvent *event) override;
|
2016-10-31 10:09:00 +00:00
|
|
|
#endif
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
private slots:
|
2016-10-31 10:09:00 +00:00
|
|
|
void updateDomElement(const QTreeWidgetItem *item, int column);
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void parseFolderElement(const QDomElement &element,
|
2020-10-07 11:05:48 +00:00
|
|
|
QTreeWidgetItem *parentItem = nullptr);
|
2011-04-27 10:05:43 +00:00
|
|
|
QTreeWidgetItem *createItem(const QDomElement &element,
|
2020-10-07 11:05:48 +00:00
|
|
|
QTreeWidgetItem *parentItem = nullptr);
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
QDomDocument domDocument;
|
|
|
|
QIcon folderIcon;
|
|
|
|
QIcon bookmarkIcon;
|
|
|
|
};
|
2023-04-12 14:22:24 +00:00
|
|
|
//! [0]
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
#endif
|