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
****************************************************************************/
29
#include "widgetbox.h"
32
#include <QtDesigner/QtDesigner>
35
#include <pluginmanager_p.h>
36
#include <sheet_delegate_p.h>
37
#include <iconloader_p.h>
39
#include <QtGui/QtGui>
40
#include <QtCore/qdebug.h>
42
#include "widgetbox_dnditem.h"
44
#define SCRATCHPAD_ITEM 1
48
using namespace qdesigner_internal;
51
/*******************************************************************************
54
static QDomElement childElement(QDomNode node, const QString &tag,
55
const QString &attr_name,
56
const QString &attr_value)
58
if (node.isElement()) {
59
QDomElement elt = node.toElement();
60
if (elt.tagName() == tag) {
61
if (attr_name.isEmpty())
63
if (elt.hasAttribute(attr_name)) {
64
if (attr_value.isEmpty())
66
if (elt.attribute(attr_name) == attr_value)
72
QDomNode child = node.firstChild();
73
for (; !child.isNull(); child = child.nextSibling()) {
74
QDomElement elt = childElement(child, tag, attr_name, attr_value);
82
typedef QList<QDomElement> ElementList;
83
static void _childElementList(QDomNode node, const QString &tag,
84
const QString &attr_name,
85
const QString &attr_value,
88
if (node.isElement()) {
89
QDomElement elt = node.toElement();
90
if (elt.tagName() == tag) {
91
if (attr_name.isEmpty()) {
93
} else if (elt.hasAttribute(attr_name)) {
94
if (attr_value.isEmpty())
96
else if (elt.attribute(attr_name) == attr_value)
102
QDomNode child = node.firstChild();
103
for (; !child.isNull(); child = child.nextSibling())
104
_childElementList(child, tag, attr_name, attr_value, result);
107
static QString domToString(const QDomElement &elt)
110
QTextStream stream(&result, QIODevice::WriteOnly);
116
static QDomDocument stringToDom(const QString &xml)
119
result.setContent(xml);
123
static DomWidget *xmlToUi(QString xml)
127
int err_line, err_col;
128
if (!doc.setContent(xml, &err_msg, &err_line, &err_col)) {
129
qWarning("xmlToUi: parse failed:\n%s\n:%d:%d: %s",
130
xml.toUtf8().constData(),
132
err_msg.toUtf8().constData());
136
QDomElement dom_elt = doc.firstChildElement();
137
if (dom_elt.nodeName() != QLatin1String("widget")) {
138
qWarning("xmlToUi: invalid root element:\n%s", xml.toUtf8().constData());
142
DomWidget *widget = new DomWidget;
143
widget->read(dom_elt);
147
/*******************************************************************************
148
** WidgetBoxItemDelegate
151
namespace qdesigner_internal {
153
class WidgetBoxItemDelegate : public SheetDelegate
156
WidgetBoxItemDelegate(QTreeWidget *tree, QWidget *parent = 0)
157
: SheetDelegate(tree, parent) {}
158
QWidget *createEditor(QWidget *parent,
159
const QStyleOptionViewItem &option,
160
const QModelIndex &index) const;
163
/*******************************************************************************
167
class WidgetBoxTreeView : public QTreeWidget
172
typedef QDesignerWidgetBoxInterface::Widget Widget;
173
typedef QDesignerWidgetBoxInterface::Category Category;
174
typedef QDesignerWidgetBoxInterface::CategoryList CategoryList;
176
WidgetBoxTreeView(QDesignerFormEditorInterface *core, QWidget *parent = 0);
177
~WidgetBoxTreeView();
179
int categoryCount() const;
180
Category category(int cat_idx) const;
181
void addCategory(const Category &cat);
182
void removeCategory(int cat_idx);
184
int widgetCount(int cat_idx) const;
185
Widget widget(int cat_idx, int wgt_idx) const;
186
void addWidget(int cat_idx, const Widget &wgt);
187
void removeWidget(int cat_idx, int wgt_idx);
189
void dropWidgets(const QList<QDesignerDnDItemInterface*> &item_list);
191
void setFileName(const QString &file_name);
192
QString fileName() const;
197
void pressed(const QString dom_xml, const QPoint &global_mouse_pos);
200
void contextMenuEvent(QContextMenuEvent *e);
203
void handleMousePress(QTreeWidgetItem *item);
204
void removeCurrentItem();
205
void editCurrentItem();
206
void updateItemData(QTreeWidgetItem *item);
207
void deleteScratchpad();
210
QDesignerFormEditorInterface *m_core;
212
mutable QHash<QString, QIcon> m_pluginIcons;
214
CategoryList domToCateogryList(const QDomDocument &doc) const;
215
Category domToCategory(const QDomElement &cat_elt) const;
216
CategoryList loadCustomCategoryList() const;
217
QDomDocument categoryListToDom(const CategoryList &cat_list) const;
219
QTreeWidgetItem *widgetToItem(const Widget &wgt, QTreeWidgetItem *parent,
220
bool editable = false);
221
Widget itemToWidget(const QTreeWidgetItem *item) const;
223
int indexOfCategory(const QString &name) const;
224
int indexOfScratchpad();
226
QString widgetDomXml(const Widget &widget) const;
228
QString qtify(const QString &name) const;
231
} // namespace qdesigner_internal
233
QWidget *WidgetBoxItemDelegate::createEditor(QWidget *parent,
234
const QStyleOptionViewItem &option,
235
const QModelIndex &index) const
237
QWidget *result = SheetDelegate::createEditor(parent, option, index);
238
QLineEdit *line_edit = qobject_cast<QLineEdit*>(result);
241
line_edit->setValidator(new QRegExpValidator(QRegExp(QLatin1String("[_a-zA-Z][_a-zA-Z0-9]*")), line_edit));
246
WidgetBoxTreeView::WidgetBoxTreeView(QDesignerFormEditorInterface *core, QWidget *parent)
247
: QTreeWidget(parent)
249
setItemDelegate(new WidgetBoxItemDelegate(this, this));
250
setRootIsDecorated(false);
253
header()->setResizeMode(QHeaderView::Stretch);
257
connect(this, SIGNAL(itemPressed(QTreeWidgetItem*,int)),
258
this, SLOT(handleMousePress(QTreeWidgetItem*)));
259
connect(this, SIGNAL(itemChanged(QTreeWidgetItem*,int)),
260
this, SLOT(updateItemData(QTreeWidgetItem*)));
262
setEditTriggers(QAbstractItemView::AnyKeyPressed);
265
WidgetBoxTreeView::~WidgetBoxTreeView()
268
settings.beginGroup(QLatin1String("WidgetBox"));
270
QStringList open_cat;
271
for (int i = 0; i < categoryCount(); ++i) {
272
QTreeWidgetItem *cat_item = topLevelItem(i);
273
if (isItemExpanded(cat_item))
274
open_cat.append(cat_item->text(0));
276
settings.setValue(QLatin1String("open categories"), open_cat);
281
QString WidgetBoxTreeView::qtify(const QString &name) const
283
QString qname = name;
285
Q_ASSERT(name.isEmpty() == false);
287
if (qname.count() > 1 && qname.at(1).toUpper() == qname.at(1) && (qname.at(0) == QLatin1Char('Q') || qname.at(0) == QLatin1Char('K')))
288
qname = qname.mid(1);
291
while (i < qname.length()) {
292
if (qname.at(i).toLower() != qname.at(i))
293
qname[i] = qname.at(i).toLower();
303
QString WidgetBoxTreeView::widgetDomXml(const Widget &widget) const
305
QString domXml = widget.domXml();
307
if (domXml.isEmpty()) {
308
QString defaultVarName = qtify(widget.name());
309
QString typeStr = widget.type() == Widget::Default
310
? QLatin1String("default")
311
: QLatin1String("custom");
313
domXml = QString::fromUtf8("<widget class=\"%1\" name=\"%2\" type=\"%3\"/>")
322
void WidgetBoxTreeView::setFileName(const QString &file_name)
324
m_file_name = file_name;
327
QString WidgetBoxTreeView::fileName() const
332
bool WidgetBoxTreeView::save()
334
if (fileName().isEmpty())
337
QFile file(fileName());
338
if (!file.open(QIODevice::WriteOnly))
341
CategoryList cat_list;
342
for (int i = 0; i < categoryCount(); ++i)
343
cat_list.append(category(i));
345
QDomDocument doc = categoryListToDom(cat_list);
346
QTextStream stream(&file);
352
void WidgetBoxTreeView::handleMousePress(QTreeWidgetItem *item)
357
if (item->parent() == 0) {
358
setItemExpanded(item, !isItemExpanded(item));
362
QDesignerWidgetBoxInterface::Widget wgt = qvariant_cast<QDesignerWidgetBoxInterface::Widget>(item->data(0, Qt::UserRole));
366
emit pressed(widgetDomXml(wgt), QCursor::pos());
369
int WidgetBoxTreeView::indexOfScratchpad()
371
for (int i = 0; i < topLevelItemCount(); ++i) {
372
if (topLevelItem(i)->data(0, Qt::UserRole).toInt() == SCRATCHPAD_ITEM)
376
QTreeWidgetItem *scratch_item = new QTreeWidgetItem(this);
377
scratch_item->setText(0, tr("Scratchpad"));
378
scratch_item->setData(0, Qt::UserRole, SCRATCHPAD_ITEM);
380
return categoryCount() - 1;
383
int WidgetBoxTreeView::indexOfCategory(const QString &name) const
385
for (int i = 0; i < topLevelItemCount(); ++i) {
386
if (topLevelItem(i)->text(0) == name)
392
bool WidgetBoxTreeView::load()
394
QString name = fileName();
397
if (!f.open(QIODevice::ReadOnly)) {
404
if (!doc.setContent(&f, &error_msg, &line, &col)) {
405
qWarning("WidgetBox: failed to parse \"%s\": on line %d: %s",
406
name.toUtf8().constData(), line, error_msg.toUtf8().constData());
410
CategoryList cat_list = domToCateogryList(doc);
411
if (cat_list.isEmpty())
414
// make sure the scratchpad is always at the end
415
int scratch_idx = -1;
416
for (int i = 0; i < cat_list.size(); ++i) {
417
if (cat_list.at(i).type() == Category::Scratchpad) {
424
foreach(Category cat, cat_list) {
425
if (cat.type() != Category::Scratchpad)
429
CategoryList custom_cat_list = loadCustomCategoryList();
430
foreach (Category cat, custom_cat_list)
433
if (scratch_idx != -1)
434
addCategory(cat_list.at(scratch_idx));
436
// Restore which items are expanded
439
settings.beginGroup(QLatin1String("WidgetBox"));
441
QStringList closed_cat;
442
for (int i = 0; i < topLevelItemCount(); ++i) {
443
QTreeWidgetItem *item = topLevelItem(i);
444
if (!isItemExpanded(item))
445
closed_cat.append(item->text(0));
448
closed_cat = settings.value(QLatin1String("Closed categories"), closed_cat).toStringList();
449
for (int i = 0; i < closed_cat.size(); ++i) {
450
int cat_idx = indexOfCategory(closed_cat[i]);
453
QTreeWidgetItem *item = topLevelItem(cat_idx);
456
setItemExpanded(item, false);
464
QDomDocument WidgetBoxTreeView::categoryListToDom(const CategoryList &cat_list) const
467
QDomElement root = doc.createElement(QLatin1String("widgetbox"));
468
doc.appendChild(root);
470
foreach (Category cat, cat_list) {
471
QDomElement cat_elt = doc.createElement(QLatin1String("category"));
472
root.appendChild(cat_elt);
473
cat_elt.setAttribute(QLatin1String("name"), cat.name());
474
if (cat.type() == Category::Scratchpad)
475
cat_elt.setAttribute(QLatin1String("type"), QLatin1String("scratchpad"));
476
for (int i = 0; i < cat.widgetCount(); ++i) {
477
Widget wgt = cat.widget(i);
478
if (wgt.type() == Widget::Custom)
481
DomWidget *dom_wgt = xmlToUi(widgetDomXml(wgt));
482
QDomElement wgt_elt = dom_wgt->write(doc);
483
wgt_elt.setAttribute(QLatin1String("name"), wgt.name());
484
QString iconName = wgt.iconName();
485
if (!iconName.startsWith("__qt_icon__"))
486
wgt_elt.setAttribute(QLatin1String("icon"), wgt.iconName());
487
wgt_elt.setAttribute(QLatin1String("type"), QLatin1String("default"));
488
cat_elt.appendChild(wgt_elt);
495
WidgetBoxTreeView::CategoryList
496
WidgetBoxTreeView::domToCateogryList(const QDomDocument &doc) const
500
QDomElement root = doc.firstChildElement();
501
if (root.nodeName() != QLatin1String("widgetbox")) {
502
qWarning("WidgetCollectionModel::xmlToModel(): not a widgetbox file");
506
QDomElement cat_elt = root.firstChildElement();
507
for (; !cat_elt.isNull(); cat_elt = cat_elt.nextSiblingElement()) {
508
if (cat_elt.nodeName() != QLatin1String("category")) {
509
qWarning("WidgetCollectionModel::xmlToModel(): bad child of widgetbox: \"%s\"", cat_elt.nodeName().toUtf8().constData());
513
Category cat = domToCategory(cat_elt);
521
WidgetBoxTreeView::Category WidgetBoxTreeView::domToCategory(const QDomElement &cat_elt) const
523
Category result(cat_elt.attribute(QLatin1String("name")));
524
if (cat_elt.attribute(QLatin1String("type"))
525
== QLatin1String("scratchpad"))
526
result.setType(Category::Scratchpad);
528
QDomElement widget_elt = cat_elt.firstChildElement();
529
for (; !widget_elt.isNull(); widget_elt = widget_elt.nextSiblingElement()) {
530
QString type_attr = widget_elt.attribute("type");
531
Widget::Type type = type_attr == QLatin1String("custom")
535
Widget w(widget_elt.attribute(QLatin1String("name")),
536
domToString(widget_elt),
537
widget_elt.attribute(QLatin1String("icon")),
545
static int findCategory(const QString &name, const WidgetBoxTreeView::CategoryList &list)
548
foreach (const WidgetBoxTreeView::Category &cat, list) {
549
if (cat.name() == name)
556
WidgetBoxTreeView::CategoryList WidgetBoxTreeView::loadCustomCategoryList() const
560
PluginManager *pm = m_core->pluginManager();
562
QList<QDesignerCustomWidgetInterface*> customWidgets = pm->registeredCustomWidgets();
564
foreach (QDesignerCustomWidgetInterface *c, customWidgets) {
565
QString dom_xml = c->domXml();
566
if (dom_xml.isEmpty())
569
QString cat_name = c->group();
570
if (cat_name.isEmpty())
571
cat_name = tr("Custom Widgets");
573
int idx = findCategory(cat_name, result);
575
result.append(Category(cat_name));
576
idx = result.size() - 1;
578
Category &cat = result[idx];
580
QIcon icon = c->icon();
584
icon_name = QLatin1String("qtlogo.png");
586
icon_name = QLatin1String("__qt_icon__") + c->name();
587
m_pluginIcons.insert(icon_name, icon);
590
cat.addWidget(Widget(c->name(), dom_xml, icon_name, Widget::Custom));
596
QTreeWidgetItem *WidgetBoxTreeView::widgetToItem(const Widget &wgt,
597
QTreeWidgetItem *parent,
600
QTreeWidgetItem *item = new QTreeWidgetItem(parent);
601
item->setFlags(item->flags() & ~Qt::ItemIsSelectable);
603
QString icon_name = wgt.iconName();
604
if (icon_name.isEmpty())
605
icon_name = QLatin1String("qtlogo.png");
607
bool block = blockSignals(true);
608
item->setText(0, wgt.name());
611
if (icon_name.startsWith("__qt_icon__"))
612
icon = m_pluginIcons.value(icon_name);
614
icon = createIconSet(icon_name);
615
item->setIcon(0, icon);
616
item->setData(0, Qt::UserRole, qVariantFromValue(wgt));
620
item->setFlags(Qt::ItemIsSelectable
622
| Qt::ItemIsEnabled);
628
WidgetBoxTreeView::Widget WidgetBoxTreeView::itemToWidget(const QTreeWidgetItem *item) const
630
return qvariant_cast<Widget>(item->data(0, Qt::UserRole));
633
int WidgetBoxTreeView::categoryCount() const
635
return topLevelItemCount();
638
WidgetBoxTreeView::Category WidgetBoxTreeView::category(int cat_idx) const
642
if (cat_idx >= topLevelItemCount())
645
QTreeWidgetItem *cat_item = topLevelItem(cat_idx);
646
result.setName(cat_item->text(0));
648
for (int i = 0; i < cat_item->childCount(); ++i) {
649
QTreeWidgetItem *child = cat_item->child(i);
650
result.addWidget(itemToWidget(child));
653
int j = cat_item->data(0, Qt::UserRole).toInt();
654
if (j == SCRATCHPAD_ITEM)
655
result.setType(Category::Scratchpad);
657
result.setType(Category::Default);
662
void WidgetBoxTreeView::addCategory(const Category &cat)
664
if (cat.widgetCount() == 0)
667
int idx = indexOfCategory(cat.name());
668
QTreeWidgetItem *cat_item = 0;
670
cat_item = new QTreeWidgetItem(this);
671
cat_item->setText(0, cat.name());
672
setItemExpanded(cat_item, true);
674
if (cat.type() == Category::Scratchpad)
675
cat_item->setData(0, Qt::UserRole, SCRATCHPAD_ITEM);
677
cat_item = topLevelItem(idx);
680
for (int i = 0; i < cat.widgetCount(); ++i)
681
widgetToItem(cat.widget(i), cat_item, cat.type() == Category::Scratchpad);
684
void WidgetBoxTreeView::removeCategory(int cat_idx)
686
if (cat_idx >= topLevelItemCount())
688
delete takeTopLevelItem(cat_idx);
691
int WidgetBoxTreeView::widgetCount(int cat_idx) const
693
if (cat_idx >= topLevelItemCount())
696
return topLevelItem(cat_idx)->childCount();
699
WidgetBoxTreeView::Widget WidgetBoxTreeView::widget(int cat_idx, int wgt_idx) const
701
if (cat_idx >= topLevelItemCount())
704
QTreeWidgetItem *cat_item = topLevelItem(cat_idx);
706
if (wgt_idx >= cat_item->childCount())
709
return itemToWidget(cat_item->child(wgt_idx));
712
void WidgetBoxTreeView::addWidget(int cat_idx, const Widget &wgt)
714
if (cat_idx >= topLevelItemCount())
717
QTreeWidgetItem *cat_item = topLevelItem(cat_idx);
719
bool scratch = cat_item->data(0, Qt::UserRole).toInt() == SCRATCHPAD_ITEM;
720
widgetToItem(wgt, cat_item, scratch);
723
void WidgetBoxTreeView::removeWidget(int cat_idx, int wgt_idx)
725
if (cat_idx >= topLevelItemCount())
728
QTreeWidgetItem *cat_item = topLevelItem(cat_idx);
730
if (wgt_idx >= cat_item->childCount())
733
delete cat_item->takeChild(wgt_idx);
736
void WidgetBoxTreeView::removeCurrentItem()
738
QTreeWidgetItem *item = currentItem();
742
QTreeWidgetItem *parent = item->parent();
744
takeTopLevelItem(indexOfTopLevelItem(item));
746
parent->takeChild(parent->indexOfChild(item));
747
setItemExpanded(parent, true);
748
if (parent->data(0, Qt::UserRole).toInt() == SCRATCHPAD_ITEM
749
&& parent->childCount() == 0) {
750
QMetaObject::invokeMethod(this, "deleteScratchpad",
751
Qt::QueuedConnection);
759
void WidgetBoxTreeView::deleteScratchpad()
761
int idx = indexOfScratchpad();
764
delete takeTopLevelItem(idx);
767
void WidgetBoxTreeView::updateItemData(QTreeWidgetItem *item)
769
if (item->parent() == 0)
772
Widget widget = qvariant_cast<Widget>(item->data(0, Qt::UserRole));
774
if (item->text(0).isEmpty()) {
775
item->setText(0, widget.name());
779
widget.setName(item->text(0));
780
QDomDocument doc = stringToDom(widgetDomXml(widget));
781
QDomElement widget_elt = doc.firstChildElement(QLatin1String("widget"));
782
if (!widget_elt.isNull()) {
783
widget_elt.setAttribute(QLatin1String("name"), item->text(0));
784
widget.setDomXml(domToString(widget_elt));
787
bool block = blockSignals(true);
788
item->setData(0, Qt::UserRole, qVariantFromValue(widget));
794
void WidgetBoxTreeView::editCurrentItem()
796
QModelIndex index = currentIndex();
797
if (!index.isValid())
803
void WidgetBoxTreeView::contextMenuEvent(QContextMenuEvent *e)
805
QPoint global_pos = mapToGlobal(e->pos());
806
QTreeWidgetItem *item = itemAt(e->pos());
808
bool scratchpad_menu = item != 0
809
&& item->parent() != 0
810
&& item->parent()->data(0, Qt::UserRole).toInt()
813
if (scratchpad_menu) {
815
setCurrentItem(item);
816
QMenu *menu = new QMenu(this);
817
menu->addAction(tr("Remove"), this, SLOT(removeCurrentItem()));
818
menu->addAction(tr("Edit name"), this, SLOT(editCurrentItem()));
819
menu->exec(global_pos);
825
void WidgetBoxTreeView::dropWidgets(const QList<QDesignerDnDItemInterface*> &item_list)
827
QTreeWidgetItem *last_item = 0;
829
foreach (QDesignerDnDItemInterface *item, item_list) {
830
QWidget *w = item->widget();
834
DomUI *dom_ui = item->domUi();
838
int scratch_idx = indexOfScratchpad();
839
QTreeWidgetItem *scratch_item = topLevelItem(scratch_idx);
842
QDomElement elt = dom_ui->write(dom);
843
QString xml = domToString(elt
844
.firstChildElement(QLatin1String("widget"))
845
.firstChildElement(QLatin1String("widget")));
847
last_item = widgetToItem(Widget(w->objectName(), xml), scratch_item, true);
848
setItemExpanded(scratch_item, true);
851
if (last_item != 0) {
853
QApplication::setActiveWindow(this);
854
setCurrentItem(last_item);
858
/*******************************************************************************
862
WidgetBox::WidgetBox(QDesignerFormEditorInterface *core, QWidget *parent, Qt::WFlags flags)
863
: QDesignerWidgetBoxInterface(parent, flags), m_core(core)
867
QVBoxLayout *l = new QVBoxLayout(this);
870
m_view = new WidgetBoxTreeView(m_core, this);
871
l->addWidget(m_view);
873
connect(m_view, SIGNAL(pressed(QString,QPoint)),
874
this, SLOT(handleMousePress(QString,QPoint)));
877
WidgetBox::~WidgetBox()
881
QDesignerFormEditorInterface *WidgetBox::core() const
886
void WidgetBox::handleMousePress(const QString &xml, const QPoint &global_mouse_pos)
888
DomWidget *dom_widget = xmlToUi(xml);
891
if (QApplication::mouseButtons() == Qt::LeftButton) {
892
QList<QDesignerDnDItemInterface*> item_list;
893
item_list.append(new WidgetBoxDnDItem(core(), dom_widget, global_mouse_pos));
894
m_core->formWindowManager()->dragItems(item_list);
898
int WidgetBox::categoryCount() const
900
return m_view->categoryCount();
903
QDesignerWidgetBoxInterface::Category WidgetBox::category(int cat_idx) const
905
return m_view->category(cat_idx);
908
void WidgetBox::addCategory(const Category &cat)
910
m_view->addCategory(cat);
913
void WidgetBox::removeCategory(int cat_idx)
915
m_view->removeCategory(cat_idx);
918
int WidgetBox::widgetCount(int cat_idx) const
920
return m_view->widgetCount(cat_idx);
923
QDesignerWidgetBoxInterface::Widget WidgetBox::widget(int cat_idx, int wgt_idx) const
925
return m_view->widget(cat_idx, wgt_idx);
928
void WidgetBox::addWidget(int cat_idx, const Widget &wgt)
930
m_view->addWidget(cat_idx, wgt);
933
void WidgetBox::removeWidget(int cat_idx, int wgt_idx)
935
m_view->removeWidget(cat_idx, wgt_idx);
938
void WidgetBox::dropWidgets(const QList<QDesignerDnDItemInterface*> &item_list, const QPoint&)
940
m_view->dropWidgets(item_list);
943
void WidgetBox::setFileName(const QString &file_name)
945
m_view->setFileName(file_name);
948
QString WidgetBox::fileName() const
950
return m_view->fileName();
953
bool WidgetBox::load()
955
return m_view->load();
958
bool WidgetBox::save()
960
return m_view->save();
963
#include "widgetbox.moc"