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
listwidgeteditor.cpp
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
6#include <designerpropertymanager.h>
7#include <abstractformbuilder.h>
8
9#include <QtDesigner/abstractsettings.h>
10#include <QtDesigner/abstractformeditor.h>
11
12#include <QtWidgets/qcombobox.h>
13#include <QtWidgets/qgroupbox.h>
14#include <QtWidgets/qdialogbuttonbox.h>
15
17
18namespace qdesigner_internal {
19
20ListWidgetEditor::ListWidgetEditor(QDesignerFormWindowInterface *form,
21 QWidget *parent)
22 : QDialog(parent)
23{
24 QDialogButtonBox *buttonBox = new QDialogButtonBox;
25 buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
26 connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
27 connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
28
29 m_itemsEditor = new ItemListEditor(form, nullptr);
30 m_itemsEditor->layout()->setContentsMargins(QMargins());
31 m_itemsEditor->setNewItemText(tr("New Item"));
32
33 QFrame *sep = new QFrame;
34 sep->setFrameStyle(QFrame::HLine | QFrame::Sunken);
35
36 QBoxLayout *box = new QVBoxLayout(this);
37 box->addWidget(m_itemsEditor);
38 box->addWidget(sep);
39 box->addWidget(buttonBox);
40
41 // Numbers copied from itemlisteditor.ui
42 // (Automatic resizing doesn't work because ui has parent).
43 resize(550, 360);
44}
45
60
62{
63 setWindowTitle(tr("Edit List Widget"));
64
65 ListContents retVal;
66 retVal.createFromListWidget(listWidget, false);
67 retVal.applyToListWidget(m_itemsEditor->listWidget(), m_itemsEditor->iconCache(), true);
68
69 m_itemsEditor->setupEditor(listWidget, listBoxPropList);
70
71 return retVal;
72}
73
79
81{
82 setWindowTitle(tr("Edit Combobox"));
83
84 ListContents retVal;
85 retVal.createFromComboBox(comboBox);
86 retVal.applyToListWidget(m_itemsEditor->listWidget(), m_itemsEditor->iconCache(), true);
87
88 m_itemsEditor->setupEditor(comboBox, comboBoxPropList);
89
90 return retVal;
91}
92
94{
95 ListContents retVal;
96 retVal.createFromListWidget(m_itemsEditor->listWidget(), true);
97 return retVal;
98}
99
100} // namespace qdesigner_internal
101
102QT_END_NAMESPACE
friend class QWidget
Definition qpainter.h:432
ListContents fillContentsFromComboBox(QComboBox *comboBox)
ListContents fillContentsFromListWidget(QListWidget *listWidget)
Combined button and popup list for selecting options.
Auxiliary methods to store/retrieve settings.
static AbstractItemEditor::PropertyDefinition listBoxPropList[]
static AbstractItemEditor::PropertyDefinition comboBoxPropList[]