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
7
8#include <QtDesigner/abstractformeditor.h>
9#include <QtDesigner/private/ui4_p.h>
10
12
13QAxWidgetExtraInfo::QAxWidgetExtraInfo(QDesignerAxWidget *widget, QDesignerFormEditorInterface *core, QObject *parent)
14 : QObject(parent), m_widget(widget), m_core(core)
15{
16}
17
19{
20 return m_widget;
21}
22
24{
25 return m_core;
26}
27
29{
30 return false;
31}
32
34{
35 return false;
36}
37
38bool QAxWidgetExtraInfo::saveWidgetExtraInfo(DomWidget *ui_widget)
39{
40 /* Turn off standard setters and make sure "control" is in front,
41 * otherwise, previews will not work as the properties are not applied via
42 * the caching property sheet, them. */
43 QList<DomProperty *> props = ui_widget->elementProperty();
44 const qsizetype size = props.size();
45 const QString controlProperty = QLatin1String(QAxWidgetPropertySheet::controlPropertyName);
46 for (qsizetype i = 0; i < size; ++i) {
47 props.at(i)->setAttributeStdset(false);
48 if (i > 0 && props.at(i)->attributeName() == controlProperty) {
49 qSwap(props[0], props[i]);
50 ui_widget->setElementProperty(props);
51 }
52
53 }
54 return true;
55}
56
58{
59 return false;
60}
61
62QAxWidgetExtraInfoFactory::QAxWidgetExtraInfoFactory(QDesignerFormEditorInterface *core, QExtensionManager *parent)
63 : QExtensionFactory(parent), m_core(core)
64{
65}
66
67QObject *QAxWidgetExtraInfoFactory::createExtension(QObject *object, const QString &iid, QObject *parent) const
68{
69 if (iid != Q_TYPEID(QDesignerExtraInfoExtension))
70 return 0;
71
72 if (QDesignerAxWidget *w = qobject_cast<QDesignerAxWidget*>(object))
73 return new QAxWidgetExtraInfo(w, m_core, parent);
74
75 return 0;
76}
77
78QT_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...
QObject * parent
Definition qobject.h:73
Combined button and popup list for selecting options.