1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the Qt Designer of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:GPL-EXCEPT$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU
19** General Public License version 3 as published by the Free Software
20** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
21** included in the packaging of this file. Please review the following
22** information to ensure the GNU General Public License requirements will
23** be met: https://www.gnu.org/licenses/gpl-3.0.html.
24**
25** $QT_END_LICENSE$
26**
27****************************************************************************/
28
29#ifndef INPLACE_EDITOR_H
30#define INPLACE_EDITOR_H
31
32#include <textpropertyeditor_p.h>
33#include <shared_enums_p.h>
34
35#include "inplace_widget_helper.h"
36#include <qdesigner_utils_p.h>
37
38#include <QtCore/qpointer.h>
39
40QT_BEGIN_NAMESPACE
41
42
43class QDesignerFormWindowInterface;
44
45namespace qdesigner_internal {
46
47class InPlaceEditor: public TextPropertyEditor
48{
49 Q_OBJECT
50public:
51 InPlaceEditor(QWidget *widget,
52 TextPropertyValidationMode validationMode,
53 QDesignerFormWindowInterface *fw,
54 const QString& text,
55 const QRect& r);
56private:
57 InPlaceWidgetHelper m_InPlaceWidgetHelper;
58};
59
60// Base class for inline editor helpers to be embedded into a task menu.
61// Inline-edits a property on a multi-selection.
62// To use it for a particular widget/property, overwrite the method
63// returning the edit area.
64
65class TaskMenuInlineEditor : public QObject {
66 TaskMenuInlineEditor(const TaskMenuInlineEditor&);
67 TaskMenuInlineEditor &operator=(const TaskMenuInlineEditor&);
68 Q_OBJECT
69
70public slots:
71 void editText();
72
73private slots:
74 void updateText(const QString &text);
75 void updateSelection();
76
77protected:
78 TaskMenuInlineEditor(QWidget *w, TextPropertyValidationMode vm, const QString &property, QObject *parent);
79 // Overwrite to return the area for the inline editor.
80 virtual QRect editRectangle() const = 0;
81 QWidget *widget() const { return m_widget; }
82
83private:
84 const TextPropertyValidationMode m_vm;
85 const QString m_property;
86 QWidget *m_widget;
87 QPointer<QDesignerFormWindowInterface> m_formWindow;
88 QPointer<InPlaceEditor> m_editor;
89 bool m_managed;
90 qdesigner_internal::PropertySheetStringValue m_value;
91};
92
93} // namespace qdesigner_internal
94
95QT_END_NAMESPACE
96
97#endif // INPLACE_EDITOR_H
98

source code of qttools/src/designer/src/components/taskmenu/inplace_editor.h