1
/****************************************************************************
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
5
** This file is part of the designer application of the Qt Toolkit.
7
** This file may be distributed under the terms of the Q Public License
8
** as defined by Trolltech AS of Norway and appearing in the file
9
** LICENSE.QPL included in the packaging of this file.
11
** This file may be distributed and/or modified under the terms of the
12
** GNU General Public License version 2 as published by the Free Software
13
** Foundation and appearing in the file LICENSE.GPL included in the
14
** packaging of this file.
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
17
** information about Qt Commercial License Agreements.
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
21
** Contact info@trolltech.com if any conditions of this licensing are
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27
****************************************************************************/
33
// This file is not part of the Qt API. It exists for the convenience
34
// of Qt Designer. This header
35
// file may change from version to version without notice, or even be removed.
40
#ifndef QDESIGNER_COMMAND_H
41
#define QDESIGNER_COMMAND_H
43
#include "shared_global_p.h"
45
#include "layoutinfo_p.h"
47
#include <QtDesigner/layoutdecoration.h>
49
#include <QtCore/QPointer>
50
#include <QtCore/QPair>
52
#include <QtCore/QVariant>
54
class QDesignerFormEditorInterface;
55
class QDesignerFormWindowManagerInterface;
56
class QDesignerFormWindowInterface;
57
class QDesignerWidgetDataBaseItemInterface;
60
class QDesignerPropertySheetExtension;
61
class QDesignerMetaDataBaseItemInterface;
62
class QDesignerPromotedWidget;
70
class QT_SHARED_EXPORT QDesignerFormEditorCommand: public QtCommand
74
QDesignerFormEditorCommand(const QString &description, QDesignerFormEditorInterface *core);
76
QDesignerFormEditorInterface *core() const;
79
QPointer<QDesignerFormEditorInterface> m_core;
82
class QT_SHARED_EXPORT QDesignerFormWindowManagerCommand: public QtCommand
86
QDesignerFormWindowManagerCommand(const QString &description, QDesignerFormWindowManagerInterface *formWindowManager);
88
QDesignerFormWindowManagerInterface *formWindowManager() const;
91
QPointer<QDesignerFormWindowManagerInterface> m_formWindowManager;
94
class QT_SHARED_EXPORT QDesignerFormWindowCommand: public QtCommand
98
QDesignerFormWindowCommand(const QString &description, QDesignerFormWindowInterface *formWindow);
100
QDesignerFormWindowInterface *formWindow() const;
103
void checkObjectName(QWidget *widget);
104
void updateBuddies(const QString &old_name, const QString &new_name);
105
void checkSelection(QWidget *widget);
106
void checkParent(QWidget *widget, QWidget *parentWidget);
107
bool hasLayout(QWidget *widget) const;
110
QPointer<QDesignerFormWindowInterface> m_formWindow;
113
class QT_SHARED_EXPORT SetPropertyCommand: public QDesignerFormWindowCommand
117
SetPropertyCommand(QDesignerFormWindowInterface *formWindow);
119
void init(QWidget *widget, const QString &propertyName, const QVariant &newValue);
121
QWidget *widget() const;
122
QWidget *parentWidget() const;
124
inline QString propertyName() const
125
{ return m_propertyName; }
127
inline QVariant oldValue() const
128
{ return m_oldValue; }
130
inline void setOldValue(const QVariant &oldValue)
131
{ m_oldValue = oldValue; }
133
inline QVariant newValue() const
134
{ return m_newValue; }
136
inline void setNewValue(const QVariant &newValue)
137
{ m_newValue = newValue; }
143
virtual bool mergeMeWith(QtCommand *other);
146
QString m_propertyName;
148
QPointer<QWidget> m_widget;
149
QPointer<QWidget> m_parentWidget;
150
QDesignerPropertySheetExtension *m_propertySheet;
156
class QT_SHARED_EXPORT ResetPropertyCommand: public QDesignerFormWindowCommand
160
ResetPropertyCommand(QDesignerFormWindowInterface *formWindow);
162
void init(QWidget *widget, const QString &propertyName);
164
QWidget *widget() const;
165
QWidget *parentWidget() const;
167
inline QString propertyName() const
168
{ return m_propertyName; }
170
inline QVariant oldValue() const
171
{ return m_oldValue; }
173
inline void setOldValue(const QVariant &oldValue)
174
{ m_oldValue = oldValue; }
180
virtual bool mergeMeWith(QtCommand *other) { Q_UNUSED(other); return false; }
183
QString m_propertyName;
185
QPointer<QWidget> m_widget;
186
QPointer<QWidget> m_parentWidget;
187
QDesignerPropertySheetExtension *m_propertySheet;
192
class QT_SHARED_EXPORT InsertWidgetCommand: public QDesignerFormWindowCommand
196
InsertWidgetCommand(QDesignerFormWindowInterface *formWindow);
198
void init(QWidget *widget);
204
QPointer<QWidget> m_widget;
205
QDesignerLayoutDecorationExtension::InsertMode m_insertMode;
206
QPair<int, int> m_cell;
209
class QT_SHARED_EXPORT RaiseWidgetCommand: public QDesignerFormWindowCommand
213
RaiseWidgetCommand(QDesignerFormWindowInterface *formWindow);
215
void init(QWidget *widget);
221
QPointer<QWidget> m_widget;
224
class QT_SHARED_EXPORT LowerWidgetCommand: public QDesignerFormWindowCommand
228
LowerWidgetCommand(QDesignerFormWindowInterface *formWindow);
230
void init(QWidget *widget);
236
QPointer<QWidget> m_widget;
239
class QT_SHARED_EXPORT AdjustWidgetSizeCommand: public QDesignerFormWindowCommand
243
AdjustWidgetSizeCommand(QDesignerFormWindowInterface *formWindow);
245
void init(QWidget *widget);
251
QPointer<QWidget> m_widget;
254
class QT_SHARED_EXPORT DeleteWidgetCommand: public QDesignerFormWindowCommand
258
DeleteWidgetCommand(QDesignerFormWindowInterface *formWindow);
260
void init(QWidget *widget);
266
QPointer<QWidget> m_widget;
267
QPointer<QWidget> m_parentWidget;
269
LayoutInfo::Type m_layoutType;
272
int m_rowspan, m_colspan;
273
QDesignerMetaDataBaseItemInterface *m_formItem;
277
class QT_SHARED_EXPORT ReparentWidgetCommand: public QDesignerFormWindowCommand
281
ReparentWidgetCommand(QDesignerFormWindowInterface *formWindow);
283
void init(QWidget *widget, QWidget *parentWidget);
289
QPointer<QWidget> m_widget;
292
QPointer<QWidget> m_oldParentWidget;
293
QPointer<QWidget> m_newParentWidget;
296
class QT_SHARED_EXPORT ChangeLayoutItemGeometry: public QDesignerFormWindowCommand
300
ChangeLayoutItemGeometry(QDesignerFormWindowInterface *formWindow);
302
void init(QWidget *widget, int row, int column, int rowspan, int colspan);
308
void changeItemPosition(const QRect &g);
311
QPointer<QWidget> m_widget;
316
class QT_SHARED_EXPORT InsertRowCommand: public QDesignerFormWindowCommand
320
InsertRowCommand(QDesignerFormWindowInterface *formWindow);
322
void init(QWidget *widget, int row);
328
QPointer<QWidget> m_widget;
333
class QT_SHARED_EXPORT TabOrderCommand: public QDesignerFormWindowCommand
337
TabOrderCommand(QDesignerFormWindowInterface *formWindow);
339
void init(const QList<QWidget*> &newTabOrder);
341
inline QList<QWidget*> oldTabOrder() const
342
{ return m_oldTabOrder; }
344
inline QList<QWidget*> newTabOrder() const
345
{ return m_newTabOrder; }
351
QDesignerMetaDataBaseItemInterface *m_widgetItem;
352
QList<QWidget*> m_oldTabOrder;
353
QList<QWidget*> m_newTabOrder;
356
class QT_SHARED_EXPORT PromoteToCustomWidgetCommand : public QDesignerFormWindowCommand
359
PromoteToCustomWidgetCommand(QDesignerFormWindowInterface *formWindow);
360
void init(QDesignerWidgetDataBaseItemInterface *item, QWidget *widget);
365
QDesignerPromotedWidget *m_promoted;
366
friend class DemoteFromCustomWidgetCommand;
369
class QT_SHARED_EXPORT DemoteFromCustomWidgetCommand : public QDesignerFormWindowCommand
372
DemoteFromCustomWidgetCommand(QDesignerFormWindowInterface *formWindow);
373
void init(QDesignerPromotedWidget *promoted);
377
PromoteToCustomWidgetCommand *m_promote_cmd;
380
class QT_SHARED_EXPORT LayoutCommand: public QDesignerFormWindowCommand
384
LayoutCommand(QDesignerFormWindowInterface *formWindow);
385
virtual ~LayoutCommand();
387
inline QList<QWidget*> widgets() const
388
{ return m_widgets; }
390
void init(QWidget *parentWidget, const QList<QWidget*> &widgets, LayoutInfo::Type layoutType,
391
QWidget *layoutBase = 0, bool splitter = false);
397
QPointer<QWidget> m_parentWidget;
398
QList<QWidget*> m_widgets;
399
QPointer<QWidget> m_layoutBase;
400
QPointer<Layout> m_layout;
403
class QT_SHARED_EXPORT BreakLayoutCommand: public QDesignerFormWindowCommand
407
BreakLayoutCommand(QDesignerFormWindowInterface *formWindow);
408
virtual ~BreakLayoutCommand();
410
inline QList<QWidget*> widgets() const
411
{ return m_widgets; }
413
void init(const QList<QWidget*> &widgets, QWidget *layoutBase);
419
QList<QWidget*> m_widgets;
420
QPointer<QWidget> m_layoutBase;
421
QPointer<Layout> m_layout;
426
class QT_SHARED_EXPORT ToolBoxCommand: public QDesignerFormWindowCommand
430
ToolBoxCommand(QDesignerFormWindowInterface *formWindow);
431
virtual ~ToolBoxCommand();
433
void init(QToolBox *toolBox);
435
virtual void removePage();
436
virtual void addPage();
439
QPointer<QToolBox> m_toolBox;
440
QPointer<QWidget> m_widget;
446
class QT_SHARED_EXPORT DeleteToolBoxPageCommand: public ToolBoxCommand
450
DeleteToolBoxPageCommand(QDesignerFormWindowInterface *formWindow);
451
virtual ~DeleteToolBoxPageCommand();
453
void init(QToolBox *toolBox);
459
class QT_SHARED_EXPORT AddToolBoxPageCommand: public ToolBoxCommand
463
AddToolBoxPageCommand(QDesignerFormWindowInterface *formWindow);
464
virtual ~AddToolBoxPageCommand();
466
void init(QToolBox *toolBox);
472
class QT_SHARED_EXPORT TabWidgetCommand: public QDesignerFormWindowCommand
476
TabWidgetCommand(QDesignerFormWindowInterface *formWindow);
477
virtual ~TabWidgetCommand();
479
void init(QTabWidget *tabWidget);
481
virtual void removePage();
482
virtual void addPage();
485
QPointer<QTabWidget> m_tabWidget;
486
QPointer<QWidget> m_widget;
492
class QT_SHARED_EXPORT DeleteTabPageCommand: public TabWidgetCommand
496
DeleteTabPageCommand(QDesignerFormWindowInterface *formWindow);
497
virtual ~DeleteTabPageCommand();
499
void init(QTabWidget *tabWidget);
505
class QT_SHARED_EXPORT AddTabPageCommand: public TabWidgetCommand
509
AddTabPageCommand(QDesignerFormWindowInterface *formWindow);
510
virtual ~AddTabPageCommand();
512
void init(QTabWidget *tabWidget);
518
class QT_SHARED_EXPORT MoveTabPageCommand: public TabWidgetCommand
522
MoveTabPageCommand(QDesignerFormWindowInterface *formWindow);
523
virtual ~MoveTabPageCommand();
525
void init(QTabWidget *tabWidget, QWidget *page,
526
const QIcon &icon, const QString &label,
527
int index, int newIndex);
535
QPointer<QWidget> m_page;
540
class QT_SHARED_EXPORT StackedWidgetCommand: public QDesignerFormWindowCommand
544
StackedWidgetCommand(QDesignerFormWindowInterface *formWindow);
545
virtual ~StackedWidgetCommand();
547
void init(QStackedWidget *stackedWidget);
549
virtual void removePage();
550
virtual void addPage();
553
QPointer<QStackedWidget> m_stackedWidget;
554
QPointer<QWidget> m_widget;
558
class QT_SHARED_EXPORT DeleteStackedWidgetPageCommand: public StackedWidgetCommand
562
DeleteStackedWidgetPageCommand(QDesignerFormWindowInterface *formWindow);
563
virtual ~DeleteStackedWidgetPageCommand();
565
void init(QStackedWidget *stackedWidget);
571
class QT_SHARED_EXPORT AddStackedWidgetPageCommand: public StackedWidgetCommand
575
AddStackedWidgetPageCommand(QDesignerFormWindowInterface *formWindow);
576
virtual ~AddStackedWidgetPageCommand();
578
void init(QStackedWidget *stackedWidget);
584
class QT_SHARED_EXPORT DockWidgetCommand: public QDesignerFormWindowCommand
588
DockWidgetCommand(const QString &description, QDesignerFormWindowInterface *formWindow);
589
virtual ~DockWidgetCommand();
591
void init(QDockWidget *dockWidget);
594
QPointer<QDockWidget> m_dockWidget;
597
class QT_SHARED_EXPORT SetDockWidgetCommand: public DockWidgetCommand
601
SetDockWidgetCommand(QDesignerFormWindowInterface *formWindow);
603
void init(QDockWidget *dockWidget, QWidget *widget);
609
QPointer<QWidget> m_widget;
610
QPointer<QWidget> m_oldWidget;
613
class QT_SHARED_EXPORT AddDockWidgetCommand: public QDesignerFormWindowCommand
617
AddDockWidgetCommand(QDesignerFormWindowInterface *formWindow);
619
void init(QMainWindow *mainWindow, QDockWidget *dockWidget);
625
QPointer<QMainWindow> m_mainWindow;
626
QPointer<QDockWidget> m_dockWidget;
629
#endif // QDESIGNER_COMMAND_H