Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
widgetboxcategorylistview.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3// Qt-Security score:significant reason:default
4
5#ifndef WIDGETBOXCATEGORYLISTVIEW_H
6#define WIDGETBOXCATEGORYLISTVIEW_H
7
8#include <QtDesigner/abstractwidgetbox.h>
9
10#include <QtWidgets/qlistview.h>
11#include <QtCore/qlist.h>
12
13QT_BEGIN_NAMESPACE
14
15class QDesignerFormEditorInterface;
16class QDesignerDnDItemInterface;
17
18class QSortFilterProxyModel;
19
20namespace qdesigner_internal {
21
23
24// List view of a category, switchable between icon and list mode.
25// Provides a filtered view.
27{
29public:
30 // Whether to access the filtered or unfiltered view
32
33 explicit WidgetBoxCategoryListView(QDesignerFormEditorInterface *core, QWidget *parent = nullptr);
34 void setViewMode(ViewMode vm);
35
36 void dropWidgets(const QList<QDesignerDnDItemInterface*> &item_list);
37
39
40 // These methods operate on the filtered/unfiltered model according to accessmode
41 int count(AccessMode am) const;
42 QDesignerWidgetBoxInterface::Widget widgetAt(AccessMode am, const QModelIndex &index) const;
43 QDesignerWidgetBoxInterface::Widget widgetAt(AccessMode am, int row) const;
44 void removeRow(AccessMode am, int row);
45 void setCurrentItem(AccessMode am, int row);
46
47 // These methods operate on the unfiltered model and are used for serialization
48 void addWidget(const QDesignerWidgetBoxInterface::Widget &widget, const QIcon &icon, bool editable);
49 bool containsWidget(const QString &name);
52
53 // Helper: Ensure a <ui> tag in the case of empty XML
54 static QString widgetDomXml(const QDesignerWidgetBoxInterface::Widget &widget);
55
58 void widgetBoxPressed(const QString &name, const QString &xml, const QPoint &globalPos);
61
62public slots:
64 void removeCurrentItem();
65 void editCurrentItem();
66
67private slots:
68 void slotPressed(const QModelIndex &index);
69
70private:
71 int mapRowToSource(int filterRow) const;
72 QSortFilterProxyModel *m_proxyModel;
74};
75
76} // namespace qdesigner_internal
77
78QT_END_NAMESPACE
79
80#endif // WIDGETBOXCATEGORYLISTVIEW_H
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Returns the widget used to edit the item specified by index for editing.
void widgetBoxPressed(const QString &name, const QString &xml, const QPoint &globalPos)
QDesignerWidgetBoxInterface::Category category() const
static QString widgetDomXml(const QDesignerWidgetBoxInterface::Widget &widget)
QDesignerWidgetBoxInterface::Widget widgetAt(AccessMode am, const QModelIndex &index) const
WidgetBoxCategoryListView(QDesignerFormEditorInterface *core, QWidget *parent=nullptr)
void dropWidgets(const QList< QDesignerDnDItemInterface * > &item_list)
void addWidget(const QDesignerWidgetBoxInterface::Widget &widget, const QIcon &icon, bool editable)
QDesignerWidgetBoxInterface::Widget widgetAt(AccessMode am, int row) const
void addWidget(const QDesignerWidgetBoxInterface::Widget &widget, const QIcon &icon, bool editable)
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Returns the data stored under the given role for the item referred to by the index.
QDesignerWidgetBoxInterface::Widget widgetAt(const QModelIndex &index) const
Qt::ItemFlags flags(const QModelIndex &index) const override
\reimp
QDesignerWidgetBoxInterface::Category category() const
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of rows under the given parent.
WidgetBoxCategoryModel(QDesignerFormEditorInterface *core, QObject *parent=nullptr)
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex()) override
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
Sets the role data for the item at index to value.
QDesignerWidgetBoxInterface::Widget widgetAt(int row) const
Combined button and popup list for selecting options.
Auxiliary methods to store/retrieve settings.
WidgetBoxCategoryEntry(const QDesignerWidgetBoxInterface::Widget &widget, const QString &filter, const QIcon &icon, bool editable)
static QDomDocument stringToDom(const QString &xml)
static QString domToString(const QDomElement &elt)
static constexpr auto uiClosingTagC
static constexpr auto uiOpeningTagC
static constexpr auto widgetElementC
static constexpr auto nameAttributeC