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
qaxwidgetextrainfo.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
8
9#include <QtDesigner/abstractformeditor.h>
10#include <QtDesigner/private/ui4_p.h>
11
13
14QAxWidgetExtraInfo::QAxWidgetExtraInfo(QDesignerAxWidget *widget, QDesignerFormEditorInterface *core, QObject *parent)
15 : QObject(parent), m_widget(widget), m_core(core)
16{
17}
18
20{
21 return m_widget;
22}
23
25{
26 return m_core;
27}
28
30{
31 return false;
32}
33
35{
36 return false;
37}
38
39bool QAxWidgetExtraInfo::saveWidgetExtraInfo(DomWidget *ui_widget)
40{
41 /* Turn off standard setters and make sure "control" is in front,
42 * otherwise, previews will not work as the properties are not applied via
43 * the caching property sheet, them. */
44 QList<DomProperty *> props = ui_widget->elementProperty();
45 const qsizetype size = props.size();
46 const QString controlProperty = QLatin1String(QAxWidgetPropertySheet::controlPropertyName);
47 for (qsizetype i = 0; i < size; ++i) {
48 props.at(i)->setAttributeStdset(false);
49 if (i > 0 && props.at(i)->attributeName() == controlProperty) {
50 qSwap(props[0], props[i]);
51 ui_widget->setElementProperty(props);
52 }
53
54 }
55 return true;
56}
57
59{
60 return false;
61}
62
63QAxWidgetExtraInfoFactory::QAxWidgetExtraInfoFactory(QDesignerFormEditorInterface *core, QExtensionManager *parent)
64 : QExtensionFactory(parent), m_core(core)
65{
66}
67
68QObject *QAxWidgetExtraInfoFactory::createExtension(QObject *object, const QString &iid, QObject *parent) const
69{
70 if (iid != Q_TYPEID(QDesignerExtraInfoExtension))
71 return 0;
72
73 if (QDesignerAxWidget *w = qobject_cast<QDesignerAxWidget*>(object))
74 return new QAxWidgetExtraInfo(w, m_core, parent);
75
76 return 0;
77}
78
79QT_END_NAMESPACE
QObject * createExtension(QObject *object, const QString &iid, QObject *parent) const override
Creates an extension specified by iid for the given object.
bool loadWidgetExtraInfo(DomWidget *ui_widget) override
Loads extra information about the specified widget, and returns true if successful; otherwise returns...
bool saveWidgetExtraInfo(DomWidget *ui_widget) override
Saves the information about the specified widget, and returns true if successful; otherwise returns f...
bool saveUiExtraInfo(DomUI *ui) override
Saves the information about the user interface specified by ui, and returns true if successful; other...
QDesignerFormEditorInterface * core() const override
\omit
QWidget * widget() const override
Returns the widget described by this extension.
bool loadUiExtraInfo(DomUI *ui) override
Loads extra information about the user interface specified by ui, and returns true if successful; oth...
static const char * controlPropertyName
QObject * parent
Definition qobject.h:74
Combined button and popup list for selecting options.