qt5base-lts/examples/xml/dombookmarks/xbeltree.h
Friedemann Kleint 3a553507a1 Brush up the DOM bookmarks example
- Use modern string literals (use QStringLiteral instead of
  QLatin1StringView for strings that go into the DOM API).
- Use mime types in the file dialog handling
- Streamline code
- Remove mentions of SAX
- Use per class includes
- Do not use QObject::tr()
- Use the configure system instead of QT_NO... defines
- Fix some doc text typos

Complements 3dd3268ded.

Pick-to: 6.6 6.5
Task-number: QTBUG-111974
Change-Id: If0dc7b61e729d0a71f37743efc9b82e285d3f451
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-06-13 01:51:10 +02:00

43 lines
988 B
C++

// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef XBELTREE_H
#define XBELTREE_H
#include <QDomDocument>
#include <QIcon>
#include <QTreeWidget>
//! [0]
class XbelTree : public QTreeWidget
{
Q_OBJECT
public:
explicit XbelTree(QWidget *parent = nullptr);
bool read(QIODevice *device);
bool write(QIODevice *device) const;
protected:
#if QT_CONFIG(clipboard) && QT_CONFIG(contextmenu)
void contextMenuEvent(QContextMenuEvent *event) override;
#endif
private slots:
void updateDomElement(const QTreeWidgetItem *item, int column);
private:
void parseFolderElement(const QDomElement &element,
QTreeWidgetItem *parentItem = nullptr);
QTreeWidgetItem *createItem(const QDomElement &element,
QTreeWidgetItem *parentItem = nullptr);
QDomDocument domDocument;
QIcon folderIcon;
QIcon bookmarkIcon;
};
//! [0]
#endif