summaryrefslogtreecommitdiffstats
path: root/tools/designer
diff options
context:
space:
mode:
Diffstat (limited to 'tools/designer')
-rw-r--r--tools/designer/data/generate_shared.xsl4
-rw-r--r--tools/designer/data/ui4.xsd13
-rw-r--r--tools/designer/src/components/buddyeditor/buddyeditor.cpp4
-rw-r--r--tools/designer/src/components/buddyeditor/buddyeditor_plugin.cpp4
-rw-r--r--tools/designer/src/components/buddyeditor/buddyeditor_tool.cpp4
-rw-r--r--tools/designer/src/components/formeditor/embeddedoptionspage.cpp4
-rw-r--r--tools/designer/src/components/formeditor/formwindow.cpp9
-rw-r--r--tools/designer/src/components/formeditor/formwindowcursor.cpp4
-rw-r--r--tools/designer/src/components/formeditor/formwindowmanager.cpp4
-rw-r--r--tools/designer/src/components/formeditor/qdesigner_resource.cpp127
-rw-r--r--tools/designer/src/components/formeditor/tool_widgeteditor.cpp4
-rw-r--r--tools/designer/src/components/objectinspector/objectinspector.cpp4
-rw-r--r--tools/designer/src/components/objectinspector/objectinspectormodel.cpp4
-rw-r--r--tools/designer/src/components/propertyeditor/designerpropertymanager.cpp3
-rw-r--r--tools/designer/src/components/propertyeditor/paletteeditor.cpp7
-rw-r--r--tools/designer/src/components/propertyeditor/paletteeditorbutton.cpp4
-rw-r--r--tools/designer/src/components/propertyeditor/previewframe.cpp4
-rw-r--r--tools/designer/src/components/propertyeditor/propertyeditor.cpp9
-rw-r--r--tools/designer/src/components/propertyeditor/stringlisteditorbutton.cpp4
-rw-r--r--tools/designer/src/components/signalsloteditor/connectdialog.ui8
-rw-r--r--tools/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp4
-rw-r--r--tools/designer/src/components/signalsloteditor/signalsloteditor_tool.cpp4
-rw-r--r--tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp4
-rw-r--r--tools/designer/src/components/tabordereditor/tabordereditor_plugin.cpp4
-rw-r--r--tools/designer/src/components/tabordereditor/tabordereditor_tool.cpp4
-rw-r--r--tools/designer/src/components/taskmenu/button_taskmenu.cpp4
-rw-r--r--tools/designer/src/components/taskmenu/combobox_taskmenu.cpp4
-rw-r--r--tools/designer/src/components/taskmenu/containerwidget_taskmenu.cpp5
-rw-r--r--tools/designer/src/components/taskmenu/groupbox_taskmenu.cpp4
-rw-r--r--tools/designer/src/components/taskmenu/label_taskmenu.cpp4
-rw-r--r--tools/designer/src/components/taskmenu/layouttaskmenu.cpp4
-rw-r--r--tools/designer/src/components/taskmenu/lineedit_taskmenu.cpp4
-rw-r--r--tools/designer/src/components/taskmenu/listwidget_taskmenu.cpp4
-rw-r--r--tools/designer/src/components/taskmenu/listwidgeteditor.cpp4
-rw-r--r--tools/designer/src/components/taskmenu/menutaskmenu.cpp4
-rw-r--r--tools/designer/src/components/taskmenu/tablewidget_taskmenu.cpp4
-rw-r--r--tools/designer/src/components/taskmenu/tablewidgeteditor.cpp4
-rw-r--r--tools/designer/src/components/taskmenu/textedit_taskmenu.cpp4
-rw-r--r--tools/designer/src/components/taskmenu/toolbar_taskmenu.cpp4
-rw-r--r--tools/designer/src/components/taskmenu/treewidget_taskmenu.cpp4
-rw-r--r--tools/designer/src/components/taskmenu/treewidgeteditor.cpp4
-rw-r--r--tools/designer/src/components/widgetbox/widgetbox_dnditem.cpp10
-rw-r--r--tools/designer/src/designer/mainwindow.cpp2
-rw-r--r--tools/designer/src/designer/qdesigner_actions.cpp2
-rw-r--r--tools/designer/src/designer/qdesigner_workbench.cpp2
-rw-r--r--tools/designer/src/designer/versiondialog.cpp6
-rw-r--r--tools/designer/src/lib/sdk/abstractformeditor.cpp12
-rw-r--r--tools/designer/src/lib/sdk/abstractformwindow.cpp14
-rw-r--r--tools/designer/src/lib/sdk/script.cpp6
-rw-r--r--tools/designer/src/lib/shared/actioneditor.cpp4
-rw-r--r--tools/designer/src/lib/shared/codedialog.cpp4
-rw-r--r--tools/designer/src/lib/shared/csshighlighter.cpp4
-rw-r--r--tools/designer/src/lib/shared/formwindowbase.cpp4
-rw-r--r--tools/designer/src/lib/shared/newformwidget.cpp5
-rw-r--r--tools/designer/src/lib/shared/orderdialog.cpp4
-rw-r--r--tools/designer/src/lib/shared/plaintexteditor.cpp4
-rw-r--r--tools/designer/src/lib/shared/pluginmanager.cpp120
-rw-r--r--tools/designer/src/lib/shared/pluginmanager_p.h8
-rw-r--r--tools/designer/src/lib/shared/previewconfigurationwidget.cpp28
-rw-r--r--tools/designer/src/lib/shared/previewmanager.cpp171
-rw-r--r--tools/designer/src/lib/shared/promotionmodel.cpp4
-rw-r--r--tools/designer/src/lib/shared/qdesigner_formbuilder.cpp14
-rw-r--r--tools/designer/src/lib/shared/qdesigner_formbuilder_p.h17
-rw-r--r--tools/designer/src/lib/shared/qdesigner_promotiondialog.cpp4
-rw-r--r--tools/designer/src/lib/shared/qdesigner_propertyeditor.cpp104
-rw-r--r--tools/designer/src/lib/shared/qdesigner_stackedbox.cpp11
-rw-r--r--tools/designer/src/lib/shared/qdesigner_tabwidget.cpp12
-rw-r--r--tools/designer/src/lib/shared/qdesigner_taskmenu.cpp4
-rw-r--r--tools/designer/src/lib/shared/qdesigner_toolbar.cpp17
-rw-r--r--tools/designer/src/lib/shared/qdesigner_widgetbox.cpp4
-rw-r--r--tools/designer/src/lib/shared/qsimpleresource.cpp133
-rw-r--r--tools/designer/src/lib/shared/qsimpleresource_p.h17
-rw-r--r--tools/designer/src/lib/shared/qtresourceview.cpp189
-rw-r--r--tools/designer/src/lib/shared/qtresourceview_p.h1
-rw-r--r--tools/designer/src/lib/shared/richtexteditor.cpp4
-rw-r--r--tools/designer/src/lib/shared/scriptdialog.cpp4
-rw-r--r--tools/designer/src/lib/shared/scripterrordialog.cpp4
-rw-r--r--tools/designer/src/lib/shared/stylesheeteditor.cpp4
-rw-r--r--tools/designer/src/lib/shared/widgetfactory.cpp4
-rw-r--r--tools/designer/src/lib/shared/zoomwidget.cpp22
-rw-r--r--tools/designer/src/lib/shared/zoomwidget_p.h9
-rw-r--r--tools/designer/src/lib/uilib/abstractformbuilder.cpp21
-rw-r--r--tools/designer/src/lib/uilib/formbuilder.cpp29
-rw-r--r--tools/designer/src/lib/uilib/formbuilderextra.cpp18
-rw-r--r--tools/designer/src/lib/uilib/formbuilderextra_p.h8
-rw-r--r--tools/designer/src/lib/uilib/ui4.cpp245
-rw-r--r--tools/designer/src/lib/uilib/ui4_p.h97
-rw-r--r--tools/designer/src/plugins/activeqt/qaxwidgettaskmenu.cpp2
-rw-r--r--tools/designer/src/uitools/quiloader.cpp11
89 files changed, 1180 insertions, 556 deletions
diff --git a/tools/designer/data/generate_shared.xsl b/tools/designer/data/generate_shared.xsl
index f7859cd..ec95fe2 100644
--- a/tools/designer/data/generate_shared.xsl
+++ b/tools/designer/data/generate_shared.xsl
@@ -6,8 +6,8 @@
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- Hack to make names camel case
- All names in ui files are lowercase, while the element names are
- capital case. To make the ui files conforming to the xsd file + keep
+ All names in UI files are lowercase, while the element names are
+ capital case. To make the UI files conforming to the XSD file + keep
the DOM interface we rename them here -->
<xsl:template name="camel-case">
<xsl:param name="text"/>
diff --git a/tools/designer/data/ui4.xsd b/tools/designer/data/ui4.xsd
index 703e497..de4253c 100644
--- a/tools/designer/data/ui4.xsd
+++ b/tools/designer/data/ui4.xsd
@@ -143,6 +143,7 @@
<xs:element name="script" type="Script" minOccurs="0" />
<xs:element name="properties" type="Properties" minOccurs="0" />
<xs:element name="slots" type="Slots" minOccurs="0" />
+ <xs:element name="propertyspecifications" type="PropertySpecifications" minOccurs="0" />
</xs:all>
</xs:complexType>
@@ -571,4 +572,16 @@
</xs:sequence>
</xs:complexType>
+ <xs:complexType name="PropertySpecifications">
+ <xs:sequence maxOccurs="unbounded">
+ <xs:element name="stringpropertyspecification" type="StringPropertySpecification" minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="StringPropertySpecification">
+ <xs:attribute name="name" type="xs:string" use="required" />
+ <xs:attribute name="type" type="xs:string" use="required" />
+ <xs:attribute name="notr" type="xs:string"/>
+ </xs:complexType>
+
</xs:schema>
diff --git a/tools/designer/src/components/buddyeditor/buddyeditor.cpp b/tools/designer/src/components/buddyeditor/buddyeditor.cpp
index 295b37f..9984b0d 100644
--- a/tools/designer/src/components/buddyeditor/buddyeditor.cpp
+++ b/tools/designer/src/components/buddyeditor/buddyeditor.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::BuddyEditor
-*/
-
#include "buddyeditor.h"
#include <QtDesigner/QDesignerFormWindowInterface>
diff --git a/tools/designer/src/components/buddyeditor/buddyeditor_plugin.cpp b/tools/designer/src/components/buddyeditor/buddyeditor_plugin.cpp
index e79e4f2..ff0c3c6 100644
--- a/tools/designer/src/components/buddyeditor/buddyeditor_plugin.cpp
+++ b/tools/designer/src/components/buddyeditor/buddyeditor_plugin.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::BuddyEditorPlugin
-*/
-
#include <QtGui/QAction>
#include "buddyeditor_plugin.h"
diff --git a/tools/designer/src/components/buddyeditor/buddyeditor_tool.cpp b/tools/designer/src/components/buddyeditor/buddyeditor_tool.cpp
index 75669aa..3cc63f7 100644
--- a/tools/designer/src/components/buddyeditor/buddyeditor_tool.cpp
+++ b/tools/designer/src/components/buddyeditor/buddyeditor_tool.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::BuddyEditorTool
-*/
-
#include "buddyeditor_tool.h"
#include "buddyeditor.h"
diff --git a/tools/designer/src/components/formeditor/embeddedoptionspage.cpp b/tools/designer/src/components/formeditor/embeddedoptionspage.cpp
index b11c4b2..7b66d8c 100644
--- a/tools/designer/src/components/formeditor/embeddedoptionspage.cpp
+++ b/tools/designer/src/components/formeditor/embeddedoptionspage.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::EmbeddedOptionsControl
-*/
-
#include "embeddedoptionspage.h"
#include "deviceprofiledialog.h"
#include "widgetfactory_p.h"
diff --git a/tools/designer/src/components/formeditor/formwindow.cpp b/tools/designer/src/components/formeditor/formwindow.cpp
index 06fa40e..d556030 100644
--- a/tools/designer/src/components/formeditor/formwindow.cpp
+++ b/tools/designer/src/components/formeditor/formwindow.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::FormWindow
-*/
-
#include "formwindow.h"
#include "formeditor.h"
#include "formwindow_dnditem.h"
@@ -2140,7 +2136,10 @@ void FormWindow::layoutContainer(QWidget *w, int type)
bool FormWindow::hasInsertedChildren(QWidget *widget) const // ### move
{
if (QDesignerContainerExtension *container = qt_extension<QDesignerContainerExtension*>(core()->extensionManager(), widget)) {
- widget = container->widget(container->currentIndex());
+ const int index = container->currentIndex();
+ if (index < 0)
+ return false;
+ widget = container->widget(index);
}
const QWidgetList l = widgets(widget);
diff --git a/tools/designer/src/components/formeditor/formwindowcursor.cpp b/tools/designer/src/components/formeditor/formwindowcursor.cpp
index e8480bc..717b679 100644
--- a/tools/designer/src/components/formeditor/formwindowcursor.cpp
+++ b/tools/designer/src/components/formeditor/formwindowcursor.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::FormWindowCursor
-*/
-
#include "formwindowcursor.h"
#include "formwindow.h"
diff --git a/tools/designer/src/components/formeditor/formwindowmanager.cpp b/tools/designer/src/components/formeditor/formwindowmanager.cpp
index 1d48bad..993bae9 100644
--- a/tools/designer/src/components/formeditor/formwindowmanager.cpp
+++ b/tools/designer/src/components/formeditor/formwindowmanager.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::FormWindowManager
-*/
-
// components/formeditor
#include "formwindowmanager.h"
#include "formwindow_dnditem.h"
diff --git a/tools/designer/src/components/formeditor/qdesigner_resource.cpp b/tools/designer/src/components/formeditor/qdesigner_resource.cpp
index f4f961a..ac03909 100644
--- a/tools/designer/src/components/formeditor/qdesigner_resource.cpp
+++ b/tools/designer/src/components/formeditor/qdesigner_resource.cpp
@@ -631,13 +631,13 @@ static bool readUiAttributes(QIODevice *dev, QString *errorMessage,
*language = attributes.value(languageAttribute).toString();
return true;
} else {
- *errorMessage = QCoreApplication::translate("Designer", "Invalid ui file: The root element <ui> is missing.");
+ *errorMessage = QCoreApplication::translate("Designer", "Invalid UI file: The root element <ui> is missing.");
return false;
}
}
}
- *errorMessage = QCoreApplication::translate("Designer", "An error has occurred while reading the ui file at line %1, column %2: %3")
+ *errorMessage = QCoreApplication::translate("Designer", "An error has occurred while reading the UI file at line %1, column %2: %3")
.arg(reader.lineNumber()).arg(reader.columnNumber()).arg(reader.errorString());
return false;
}
@@ -753,30 +753,10 @@ void QDesignerResource::setSaveRelative(bool relative)
m_resourceBuilder->setSaveRelative(relative);
}
-static bool addFakeMethods(const DomSlots *domSlots, QStringList &fakeSlots, QStringList &fakeSignals)
-{
- if (!domSlots)
- return false;
-
- bool rc = false;
- foreach (const QString &fakeSlot, domSlots->elementSlot())
- if (fakeSlots.indexOf(fakeSlot) == -1) {
- fakeSlots += fakeSlot;
- rc = true;
- }
-
- foreach (const QString &fakeSignal, domSlots->elementSignal())
- if (fakeSignals.indexOf(fakeSignal) == -1) {
- fakeSignals += fakeSignal;
- rc = true;
- }
- return rc;
-}
-
QWidget *QDesignerResource::create(DomUI *ui, QWidget *parentWidget)
{
// Load extra info extension. This is used by Jambi for preventing
- // C++ ui files from being loaded
+ // C++ UI files from being loaded
if (QDesignerExtraInfoExtension *extra = qt_extension<QDesignerExtraInfoExtension*>(core()->extensionManager(), core())) {
if (!extra->loadUiExtraInfo(ui)) {
const QString errorMessage = QApplication::translate("Designer", "This file cannot be read because the extra info extension failed to load.");
@@ -1435,108 +1415,9 @@ DomLayoutItem *QDesignerResource::createDom(QLayoutItem *item, DomLayout *ui_lay
return ui_item;
}
-static void addFakeMethodsToWidgetDataBase(const DomCustomWidget *domCustomWidget, WidgetDataBaseItem *item)
-{
- const DomSlots *domSlots = domCustomWidget->elementSlots();
- if (!domSlots)
- return;
-
- // Merge in new slots, signals
- QStringList fakeSlots = item->fakeSlots();
- QStringList fakeSignals = item->fakeSignals();
- if (addFakeMethods(domSlots, fakeSlots, fakeSignals)) {
- item->setFakeSlots(fakeSlots);
- item->setFakeSignals(fakeSignals);
- }
-}
-
-void QDesignerResource::addCustomWidgetsToWidgetDatabase(DomCustomWidgetList& custom_widget_list)
-{
- // Perform one iteration of adding the custom widgets to the database,
- // looking up the base class and inheriting its data.
- // Remove the succeeded custom widgets from the list.
- // Classes whose base class could not be found are left in the list.
- QDesignerWidgetDataBaseInterface *db = m_formWindow->core()->widgetDataBase();
- for (int i=0; i < custom_widget_list.size(); ) {
- bool classInserted = false;
- DomCustomWidget *custom_widget = custom_widget_list[i];
- const QString customClassName = custom_widget->elementClass();
- const QString base_class = custom_widget->elementExtends();
- QString includeFile;
- IncludeType includeType = IncludeLocal;
- if (const DomHeader *header = custom_widget->elementHeader()) {
- includeFile = header->text();
- if (header->hasAttributeLocation() && header->attributeLocation() == QLatin1String("global"))
- includeType = IncludeGlobal;
- }
- const bool domIsContainer = custom_widget->elementContainer();
- // Append a new item
- if (base_class.isEmpty()) {
- WidgetDataBaseItem *item = new WidgetDataBaseItem(customClassName);
- item->setPromoted(false);
- item->setGroup(QApplication::translate("Designer", "Custom Widgets"));
- item->setIncludeFile(buildIncludeFile(includeFile, includeType));
- item->setContainer(domIsContainer);
- item->setCustom(true);
- addFakeMethodsToWidgetDataBase(custom_widget, item);
- db->append(item);
- custom_widget_list.removeAt(i);
- classInserted = true;
- } else {
- // Create a new entry cloned from base class. Note that this will ignore existing
- // classes, eg, plugin custom widgets.
- QDesignerWidgetDataBaseItemInterface *item =
- appendDerived(db, customClassName, QApplication::translate("Designer", "Promoted Widgets"),
- base_class,
- buildIncludeFile(includeFile, includeType),
- true,true);
- // Ok, base class found.
- if (item) {
- // Hack to accommodate for old UI-files in which "contains" is not set properly:
- // Apply "contains" from DOM only if true (else, eg classes from QFrame might not accept
- // dropping child widgets on them as container=false). This also allows for
- // QWidget-derived stacked pages.
- if (domIsContainer)
- item->setContainer(domIsContainer);
-
- addFakeMethodsToWidgetDataBase(custom_widget, static_cast<WidgetDataBaseItem*>(item));
- custom_widget_list.removeAt(i);
- classInserted = true;
- }
- }
- // Skip failed item.
- if (!classInserted)
- i++;
- }
-
-}
void QDesignerResource::createCustomWidgets(DomCustomWidgets *dom_custom_widgets)
{
- if (dom_custom_widgets == 0)
- return;
- DomCustomWidgetList custom_widget_list = dom_custom_widgets->elementCustomWidget();
- // Attempt to insert each item derived from its base class.
- // This should at most require two iterations in the event that the classes are out of order
- // (derived first, max depth: promoted custom plugin = 2)
- for (int iteration = 0; iteration < 2; iteration++) {
- addCustomWidgetsToWidgetDatabase(custom_widget_list);
- if (custom_widget_list.empty())
- return;
- }
- // Oops, there are classes left whose base class could not be found.
- // Default them to QWidget with warnings.
- const QString fallBackBaseClass = QLatin1String("QWidget");
- for (int i=0; i < custom_widget_list.size(); i++ ) {
- DomCustomWidget *custom_widget = custom_widget_list[i];
- const QString customClassName = custom_widget->elementClass();
- const QString base_class = custom_widget->elementExtends();
- qDebug() << "** WARNING The base class " << base_class << " of the custom widget class " << customClassName
- << " could not be found. Defaulting to " << fallBackBaseClass << '.';
- custom_widget->setElementExtends(fallBackBaseClass);
- }
- // One more pass.
- addCustomWidgetsToWidgetDatabase(custom_widget_list);
- Q_ASSERT(custom_widget_list.empty());
+ QSimpleResource::handleDomCustomWidgets(core(), dom_custom_widgets);
}
DomTabStops *QDesignerResource::saveTabStops()
diff --git a/tools/designer/src/components/formeditor/tool_widgeteditor.cpp b/tools/designer/src/components/formeditor/tool_widgeteditor.cpp
index b4e52f5..967c6b7 100644
--- a/tools/designer/src/components/formeditor/tool_widgeteditor.cpp
+++ b/tools/designer/src/components/formeditor/tool_widgeteditor.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::WidgetEditorTool
-*/
-
#include "tool_widgeteditor.h"
#include "formwindow.h"
diff --git a/tools/designer/src/components/objectinspector/objectinspector.cpp b/tools/designer/src/components/objectinspector/objectinspector.cpp
index a356d9b..c36a629 100644
--- a/tools/designer/src/components/objectinspector/objectinspector.cpp
+++ b/tools/designer/src/components/objectinspector/objectinspector.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::ObjectInspector
-*/
-
#include "objectinspector.h"
#include "objectinspectormodel_p.h"
#include "formwindow.h"
diff --git a/tools/designer/src/components/objectinspector/objectinspectormodel.cpp b/tools/designer/src/components/objectinspector/objectinspectormodel.cpp
index a86d4e8..c265539 100644
--- a/tools/designer/src/components/objectinspector/objectinspectormodel.cpp
+++ b/tools/designer/src/components/objectinspector/objectinspectormodel.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::ObjectInspector
-*/
-
#include "objectinspectormodel_p.h"
#include <qlayout_widget_p.h>
diff --git a/tools/designer/src/components/propertyeditor/designerpropertymanager.cpp b/tools/designer/src/components/propertyeditor/designerpropertymanager.cpp
index 2f6a51e..fb1a5bb 100644
--- a/tools/designer/src/components/propertyeditor/designerpropertymanager.cpp
+++ b/tools/designer/src/components/propertyeditor/designerpropertymanager.cpp
@@ -2455,6 +2455,9 @@ void DesignerEditorFactory::slotStringTextChanged(const QString &value)
if (val.userType() == DesignerPropertyManager::designerStringTypeId()) {
PropertySheetStringValue strVal = qVariantValue<PropertySheetStringValue>(val);
strVal.setValue(value);
+ // Disable translation if no translation subproperties exist.
+ if (varProp->subProperties().empty())
+ strVal.setTranslatable(false);
val = qVariantFromValue(strVal);
} else {
val = QVariant(value);
diff --git a/tools/designer/src/components/propertyeditor/paletteeditor.cpp b/tools/designer/src/components/propertyeditor/paletteeditor.cpp
index c44b514..ab105b3 100644
--- a/tools/designer/src/components/propertyeditor/paletteeditor.cpp
+++ b/tools/designer/src/components/propertyeditor/paletteeditor.cpp
@@ -39,13 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::PaletteEditor
-*/
-/*
-TRANSLATOR qdesigner_internal::PaletteModel
-*/
-
#include "paletteeditor.h"
#include <iconloader_p.h>
diff --git a/tools/designer/src/components/propertyeditor/paletteeditorbutton.cpp b/tools/designer/src/components/propertyeditor/paletteeditorbutton.cpp
index 2ac1c3f..de96fea 100644
--- a/tools/designer/src/components/propertyeditor/paletteeditorbutton.cpp
+++ b/tools/designer/src/components/propertyeditor/paletteeditorbutton.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::PaletteEditorButton
-*/
-
#include "paletteeditorbutton.h"
#include "paletteeditor.h"
diff --git a/tools/designer/src/components/propertyeditor/previewframe.cpp b/tools/designer/src/components/propertyeditor/previewframe.cpp
index 8416a4e..33073e2 100644
--- a/tools/designer/src/components/propertyeditor/previewframe.cpp
+++ b/tools/designer/src/components/propertyeditor/previewframe.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::PreviewWorkspace
-*/
-
#include "previewframe.h"
#include "previewwidget.h"
diff --git a/tools/designer/src/components/propertyeditor/propertyeditor.cpp b/tools/designer/src/components/propertyeditor/propertyeditor.cpp
index 4c0565d..b20a5a8 100644
--- a/tools/designer/src/components/propertyeditor/propertyeditor.cpp
+++ b/tools/designer/src/components/propertyeditor/propertyeditor.cpp
@@ -137,13 +137,8 @@ void PropertyEditor::setupStringProperty(QtVariantProperty *property, bool isMai
const bool hasComment = params.second;
property->setAttribute(m_strings.m_validationModeAttribute, params.first);
// assuming comment cannot appear or disappear for the same property in different object instance
- if (!hasComment) {
- QList<QtProperty *> commentProperties = property->subProperties();
- if (commentProperties.count() > 0)
- delete commentProperties.at(0);
- if (commentProperties.count() > 1)
- delete commentProperties.at(1);
- }
+ if (!hasComment)
+ qDeleteAll(property->subProperties());
}
void PropertyEditor::setupPaletteProperty(QtVariantProperty *property)
diff --git a/tools/designer/src/components/propertyeditor/stringlisteditorbutton.cpp b/tools/designer/src/components/propertyeditor/stringlisteditorbutton.cpp
index d4bebb9..1b51376 100644
--- a/tools/designer/src/components/propertyeditor/stringlisteditorbutton.cpp
+++ b/tools/designer/src/components/propertyeditor/stringlisteditorbutton.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::StringListEditorButton
-*/
-
#include "stringlisteditorbutton.h"
#include "stringlisteditor.h"
diff --git a/tools/designer/src/components/signalsloteditor/connectdialog.ui b/tools/designer/src/components/signalsloteditor/connectdialog.ui
index bd062eb..568516a 100644
--- a/tools/designer/src/components/signalsloteditor/connectdialog.ui
+++ b/tools/designer/src/components/signalsloteditor/connectdialog.ui
@@ -13,7 +13,7 @@
<string>Configure Connection</string>
</property>
<layout class="QGridLayout" >
- <item row="0" column="0" colspan="2" >
+ <item row="0" column="0" >
<widget class="QGroupBox" name="signalGroupBox" >
<property name="title" >
<string>GroupBox</string>
@@ -53,7 +53,7 @@
</layout>
</widget>
</item>
- <item row="0" column="2" >
+ <item row="0" column="1" >
<widget class="QGroupBox" name="slotGroupBox" >
<property name="title" >
<string>GroupBox</string>
@@ -93,14 +93,14 @@
</layout>
</widget>
</item>
- <item row="1" column="0" >
+ <item row="1" column="0" colspan="2" >
<widget class="QCheckBox" name="showAllCheckBox" >
<property name="text" >
<string>Show signals and slots inherited from QWidget</string>
</property>
</widget>
</item>
- <item row="2" column="1" colspan="2" >
+ <item row="2" column="0" colspan="2" >
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
diff --git a/tools/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp b/tools/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp
index fd90e67..e664ae7 100644
--- a/tools/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp
+++ b/tools/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::SignalSlotEditorPlugin
-*/
-
#include "signalsloteditor_plugin.h"
#include "signalsloteditor_tool.h"
diff --git a/tools/designer/src/components/signalsloteditor/signalsloteditor_tool.cpp b/tools/designer/src/components/signalsloteditor/signalsloteditor_tool.cpp
index d743d21..8b0dd7c 100644
--- a/tools/designer/src/components/signalsloteditor/signalsloteditor_tool.cpp
+++ b/tools/designer/src/components/signalsloteditor/signalsloteditor_tool.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::SignalSlotEditorTool
-*/
-
#include "signalsloteditor_tool.h"
#include "signalsloteditor.h"
#include "ui4_p.h"
diff --git a/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp b/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp
index e1126bd..9f27923 100644
--- a/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp
+++ b/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::ConnectionModel
-*/
-
#include "signalsloteditorwindow.h"
#include "signalsloteditor_p.h"
#include "signalsloteditor.h"
diff --git a/tools/designer/src/components/tabordereditor/tabordereditor_plugin.cpp b/tools/designer/src/components/tabordereditor/tabordereditor_plugin.cpp
index b6b93a9..9b051c9 100644
--- a/tools/designer/src/components/tabordereditor/tabordereditor_plugin.cpp
+++ b/tools/designer/src/components/tabordereditor/tabordereditor_plugin.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::TabOrderEditorPlugin
-*/
-
#include <QtGui/QAction>
#include "tabordereditor_plugin.h"
diff --git a/tools/designer/src/components/tabordereditor/tabordereditor_tool.cpp b/tools/designer/src/components/tabordereditor/tabordereditor_tool.cpp
index 23e2f47..b94f7ff 100644
--- a/tools/designer/src/components/tabordereditor/tabordereditor_tool.cpp
+++ b/tools/designer/src/components/tabordereditor/tabordereditor_tool.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::TabOrderEditorTool
-*/
-
#include "tabordereditor_tool.h"
#include "tabordereditor.h"
diff --git a/tools/designer/src/components/taskmenu/button_taskmenu.cpp b/tools/designer/src/components/taskmenu/button_taskmenu.cpp
index c431024..5eb74cc 100644
--- a/tools/designer/src/components/taskmenu/button_taskmenu.cpp
+++ b/tools/designer/src/components/taskmenu/button_taskmenu.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::ButtonTaskMenu
-*/
-
#include "button_taskmenu.h"
#include "inplace_editor.h"
#include <qdesigner_formwindowcommand_p.h>
diff --git a/tools/designer/src/components/taskmenu/combobox_taskmenu.cpp b/tools/designer/src/components/taskmenu/combobox_taskmenu.cpp
index 600e9e4..f1d16a3 100644
--- a/tools/designer/src/components/taskmenu/combobox_taskmenu.cpp
+++ b/tools/designer/src/components/taskmenu/combobox_taskmenu.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::ComboBoxTaskMenu
-*/
-
#include "combobox_taskmenu.h"
#include "listwidgeteditor.h"
#include "qdesigner_utils_p.h"
diff --git a/tools/designer/src/components/taskmenu/containerwidget_taskmenu.cpp b/tools/designer/src/components/taskmenu/containerwidget_taskmenu.cpp
index 84d964b..14385ba 100644
--- a/tools/designer/src/components/taskmenu/containerwidget_taskmenu.cpp
+++ b/tools/designer/src/components/taskmenu/containerwidget_taskmenu.cpp
@@ -39,13 +39,8 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::ContainerWidgetTaskMenu
-*/
-
#include "containerwidget_taskmenu.h"
-
#include <QtDesigner/QDesignerFormEditorInterface>
#include <QtDesigner/QDesignerFormWindowInterface>
#include <QtDesigner/QExtensionManager>
diff --git a/tools/designer/src/components/taskmenu/groupbox_taskmenu.cpp b/tools/designer/src/components/taskmenu/groupbox_taskmenu.cpp
index ce6b4ab..ba9651a 100644
--- a/tools/designer/src/components/taskmenu/groupbox_taskmenu.cpp
+++ b/tools/designer/src/components/taskmenu/groupbox_taskmenu.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::GroupBoxTaskMenu
-*/
-
#include "groupbox_taskmenu.h"
#include "inplace_editor.h"
diff --git a/tools/designer/src/components/taskmenu/label_taskmenu.cpp b/tools/designer/src/components/taskmenu/label_taskmenu.cpp
index 6a555c8..c7e8d72 100644
--- a/tools/designer/src/components/taskmenu/label_taskmenu.cpp
+++ b/tools/designer/src/components/taskmenu/label_taskmenu.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::LabelTaskMenu
-*/
-
#include "label_taskmenu.h"
#include "inplace_editor.h"
diff --git a/tools/designer/src/components/taskmenu/layouttaskmenu.cpp b/tools/designer/src/components/taskmenu/layouttaskmenu.cpp
index d7e5365..46d3497 100644
--- a/tools/designer/src/components/taskmenu/layouttaskmenu.cpp
+++ b/tools/designer/src/components/taskmenu/layouttaskmenu.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::LayoutWidgetTaskMenu
-*/
-
#include "layouttaskmenu.h"
#include <formlayoutmenu_p.h>
#include <morphmenu_p.h>
diff --git a/tools/designer/src/components/taskmenu/lineedit_taskmenu.cpp b/tools/designer/src/components/taskmenu/lineedit_taskmenu.cpp
index db7327b..f2915ec 100644
--- a/tools/designer/src/components/taskmenu/lineedit_taskmenu.cpp
+++ b/tools/designer/src/components/taskmenu/lineedit_taskmenu.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::LineEditTaskMenu
-*/
-
#include "lineedit_taskmenu.h"
#include "inplace_editor.h"
diff --git a/tools/designer/src/components/taskmenu/listwidget_taskmenu.cpp b/tools/designer/src/components/taskmenu/listwidget_taskmenu.cpp
index 984fc8a..e70d985 100644
--- a/tools/designer/src/components/taskmenu/listwidget_taskmenu.cpp
+++ b/tools/designer/src/components/taskmenu/listwidget_taskmenu.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::ListWidgetTaskMenu
-*/
-
#include "listwidget_taskmenu.h"
#include "listwidgeteditor.h"
#include "qdesigner_utils_p.h"
diff --git a/tools/designer/src/components/taskmenu/listwidgeteditor.cpp b/tools/designer/src/components/taskmenu/listwidgeteditor.cpp
index 8edad6d..a40a345 100644
--- a/tools/designer/src/components/taskmenu/listwidgeteditor.cpp
+++ b/tools/designer/src/components/taskmenu/listwidgeteditor.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::ListWidgetEditor
-*/
-
#include "listwidgeteditor.h"
#include <designerpropertymanager.h>
#include <abstractformbuilder.h>
diff --git a/tools/designer/src/components/taskmenu/menutaskmenu.cpp b/tools/designer/src/components/taskmenu/menutaskmenu.cpp
index 346a07f..3546cd1 100644
--- a/tools/designer/src/components/taskmenu/menutaskmenu.cpp
+++ b/tools/designer/src/components/taskmenu/menutaskmenu.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::MenuTaskMenu
-*/
-
#include "menutaskmenu.h"
#include <promotiontaskmenu_p.h>
diff --git a/tools/designer/src/components/taskmenu/tablewidget_taskmenu.cpp b/tools/designer/src/components/taskmenu/tablewidget_taskmenu.cpp
index f0fa680..c187a69 100644
--- a/tools/designer/src/components/taskmenu/tablewidget_taskmenu.cpp
+++ b/tools/designer/src/components/taskmenu/tablewidget_taskmenu.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::TableWidgetTaskMenu
-*/
-
#include "tablewidget_taskmenu.h"
#include "tablewidgeteditor.h"
diff --git a/tools/designer/src/components/taskmenu/tablewidgeteditor.cpp b/tools/designer/src/components/taskmenu/tablewidgeteditor.cpp
index 6115998..587e7d3 100644
--- a/tools/designer/src/components/taskmenu/tablewidgeteditor.cpp
+++ b/tools/designer/src/components/taskmenu/tablewidgeteditor.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::TableWidgetEditor
-*/
-
#include "tablewidgeteditor.h"
#include <abstractformbuilder.h>
#include <iconloader_p.h>
diff --git a/tools/designer/src/components/taskmenu/textedit_taskmenu.cpp b/tools/designer/src/components/taskmenu/textedit_taskmenu.cpp
index 55cd105..d052ced 100644
--- a/tools/designer/src/components/taskmenu/textedit_taskmenu.cpp
+++ b/tools/designer/src/components/taskmenu/textedit_taskmenu.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::TextEditTaskMenu
-*/
-
#include "textedit_taskmenu.h"
#include <QtDesigner/QDesignerFormWindowInterface>
diff --git a/tools/designer/src/components/taskmenu/toolbar_taskmenu.cpp b/tools/designer/src/components/taskmenu/toolbar_taskmenu.cpp
index 7c4c07d..a64de13 100644
--- a/tools/designer/src/components/taskmenu/toolbar_taskmenu.cpp
+++ b/tools/designer/src/components/taskmenu/toolbar_taskmenu.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::ToolBarTaskMenu
-*/
-
#include "toolbar_taskmenu.h"
#include "qdesigner_toolbar_p.h"
diff --git a/tools/designer/src/components/taskmenu/treewidget_taskmenu.cpp b/tools/designer/src/components/taskmenu/treewidget_taskmenu.cpp
index 3784957..6643141 100644
--- a/tools/designer/src/components/taskmenu/treewidget_taskmenu.cpp
+++ b/tools/designer/src/components/taskmenu/treewidget_taskmenu.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::TreeWidgetTaskMenu
-*/
-
#include "treewidget_taskmenu.h"
#include "treewidgeteditor.h"
diff --git a/tools/designer/src/components/taskmenu/treewidgeteditor.cpp b/tools/designer/src/components/taskmenu/treewidgeteditor.cpp
index d0b6283..458eadb 100644
--- a/tools/designer/src/components/taskmenu/treewidgeteditor.cpp
+++ b/tools/designer/src/components/taskmenu/treewidgeteditor.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::TreeWidgetEditor
-*/
-
#include "treewidgeteditor.h"
#include <formwindowbase_p.h>
#include <iconloader_p.h>
diff --git a/tools/designer/src/components/widgetbox/widgetbox_dnditem.cpp b/tools/designer/src/components/widgetbox/widgetbox_dnditem.cpp
index 67e1184..045bfca 100644
--- a/tools/designer/src/components/widgetbox/widgetbox_dnditem.cpp
+++ b/tools/designer/src/components/widgetbox/widgetbox_dnditem.cpp
@@ -50,6 +50,7 @@
#include <formwindowbase_p.h>
#include <qdesigner_utils_p.h>
#include <qdesigner_dockwidget_p.h>
+#include <qsimpleresource_p.h>
#include <QtDesigner/QDesignerFormEditorInterface>
#include <QtDesigner/QDesignerFormWindowManagerInterface>
@@ -84,6 +85,7 @@ protected:
virtual QWidget *create(DomWidget *ui_widget, QWidget *parents);
virtual QWidget *createWidget(const QString &widgetName, QWidget *parentWidget, const QString &name);
+ virtual void createCustomWidgets(DomCustomWidgets *);
};
WidgetBoxResource::WidgetBoxResource(QDesignerFormEditorInterface *core) :
@@ -120,6 +122,14 @@ QWidget *WidgetBoxResource::create(DomWidget *ui_widget, QWidget *parent)
return result;
}
+void WidgetBoxResource::createCustomWidgets(DomCustomWidgets *dc)
+{
+ // Make a promotion entry in case someone has a promoted widget
+ // in the scratchpad.
+ QSimpleResource::handleDomCustomWidgets(core(), dc);
+
+}
+
/*******************************************************************************
** WidgetBoxResource
*/
diff --git a/tools/designer/src/designer/mainwindow.cpp b/tools/designer/src/designer/mainwindow.cpp
index b72a790..a3ca234 100644
--- a/tools/designer/src/designer/mainwindow.cpp
+++ b/tools/designer/src/designer/mainwindow.cpp
@@ -155,7 +155,7 @@ DockedMdiArea::DockedMdiArea(const QString &extension, QWidget *parent) :
QStringList DockedMdiArea::uiFiles(const QMimeData *d) const
{
- // Extract dropped ui files from Mime data.
+ // Extract dropped UI files from Mime data.
QStringList rc;
if (!d->hasFormat(QLatin1String(uriListMimeFormatC)))
return rc;
diff --git a/tools/designer/src/designer/qdesigner_actions.cpp b/tools/designer/src/designer/qdesigner_actions.cpp
index 5151044..c671386 100644
--- a/tools/designer/src/designer/qdesigner_actions.cpp
+++ b/tools/designer/src/designer/qdesigner_actions.cpp
@@ -280,7 +280,7 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench)
m_fileActions->addAction(createSeparator(this));
- m_quitAction->setShortcut(tr("CTRL+Q"));
+ m_quitAction->setShortcuts(QKeySequence::Quit);
m_quitAction->setMenuRole(QAction::QuitRole);
connect(m_quitAction, SIGNAL(triggered()), this, SLOT(shutdown()));
m_fileActions->addAction(m_quitAction);
diff --git a/tools/designer/src/designer/qdesigner_workbench.cpp b/tools/designer/src/designer/qdesigner_workbench.cpp
index c9d9fc4..2ac9e1f 100644
--- a/tools/designer/src/designer/qdesigner_workbench.cpp
+++ b/tools/designer/src/designer/qdesigner_workbench.cpp
@@ -961,7 +961,7 @@ QDesignerFormWindow * QDesignerWorkbench::loadForm(const QString &fileName,
removeFormWindow(formWindow);
formWindowManager->removeFormWindow(editor);
m_core->metaDataBase()->remove(editor);
- *errorMessage = tr("The file <b>%1</b> is not a valid Designer ui file.").arg(file.fileName());
+ *errorMessage = tr("The file <b>%1</b> is not a valid Designer UI file.").arg(file.fileName());
return 0;
}
*uic3Converted = editor->fileName().isEmpty();
diff --git a/tools/designer/src/designer/versiondialog.cpp b/tools/designer/src/designer/versiondialog.cpp
index 101a3f3..388fb27 100644
--- a/tools/designer/src/designer/versiondialog.cpp
+++ b/tools/designer/src/designer/versiondialog.cpp
@@ -172,15 +172,11 @@ VersionDialog::VersionDialog(QWidget *parent)
version = version.arg(tr("Qt Designer")).arg(QLatin1String(QT_VERSION_STR));
version.append(tr("<br/>Qt Designer is a graphical user interface designer for Qt applications.<br/>"));
- // TODO: Remove this variable for 4.6.0. Must keep this way for 4.5.x due to string freeze
- QString edition;
-
lbl->setText(tr("%1"
- "<br/>%2"
"<br/>Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)."
"<br/><br/>The program is provided AS IS with NO WARRANTY OF ANY KIND,"
" INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A"
- " PARTICULAR PURPOSE.<br/> ").arg(version).arg(edition));
+ " PARTICULAR PURPOSE.<br/> ").arg(version));
lbl->setWordWrap(true);
lbl->setOpenExternalLinks(true);
diff --git a/tools/designer/src/lib/sdk/abstractformeditor.cpp b/tools/designer/src/lib/sdk/abstractformeditor.cpp
index 52f1ef1..48772b8 100644
--- a/tools/designer/src/lib/sdk/abstractformeditor.cpp
+++ b/tools/designer/src/lib/sdk/abstractformeditor.cpp
@@ -66,9 +66,21 @@
#include <grid_p.h>
#include <QtDesigner/QDesignerPromotionInterface>
+// Must be done outside of the Qt namespace
static void initResources()
{
Q_INIT_RESOURCE(shared);
+ Q_INIT_RESOURCE(ClamshellPhone);
+ Q_INIT_RESOURCE(PDAPhone);
+ Q_INIT_RESOURCE(PortableMedia);
+ Q_INIT_RESOURCE(S60_nHD_Touchscreen);
+ Q_INIT_RESOURCE(S60_QVGA_Candybar);
+ Q_INIT_RESOURCE(SmartPhone2);
+ Q_INIT_RESOURCE(SmartPhone);
+ Q_INIT_RESOURCE(SmartPhoneWithButtons);
+ Q_INIT_RESOURCE(TouchscreenPhone);
+ Q_INIT_RESOURCE(Trolltech_Keypad);
+ Q_INIT_RESOURCE(Trolltech_Touchscreen);
}
QT_BEGIN_NAMESPACE
diff --git a/tools/designer/src/lib/sdk/abstractformwindow.cpp b/tools/designer/src/lib/sdk/abstractformwindow.cpp
index 89c1015..313b324 100644
--- a/tools/designer/src/lib/sdk/abstractformwindow.cpp
+++ b/tools/designer/src/lib/sdk/abstractformwindow.cpp
@@ -247,7 +247,7 @@ QDesignerFormWindowInterface *QDesignerFormWindowInterface::findFormWindow(QObje
/*!
\fn virtual QString QDesignerFormWindowInterface::fileName() const
- Returns the file name of the .ui file that describes the form
+ Returns the file name of the UI file that describes the form
currently being shown.
\sa setFileName()
@@ -399,11 +399,11 @@ QDesignerFormWindowInterface *QDesignerFormWindowInterface::findFormWindow(QObje
\fn virtual QStringList QDesignerFormWindowInterface::includeHints() const
Returns a list of the header files that will be included in the
- form window's associated \c .ui file.
+ form window's associated UI file.
Header files may be local, i.e. relative to the project's
- directory,\c "mywidget.h", or global, i.e. part of Qt or the
- compilers standard libraries:\c <QtGui/QWidget>.
+ directory, \c "mywidget.h", or global, i.e. part of Qt or the
+ compilers standard libraries: \c <QtGui/QWidget>.
\sa setIncludeHints()
*/
@@ -412,11 +412,11 @@ QDesignerFormWindowInterface *QDesignerFormWindowInterface::findFormWindow(QObje
\fn virtual void QDesignerFormWindowInterface::setIncludeHints(const QStringList &includeHints)
Sets the header files that will be included in the form window's
- associated \c .ui file to the specified \a includeHints.
+ associated UI file to the specified \a includeHints.
Header files may be local, i.e. relative to the project's
- directory,\c "mywidget.h", or global, i.e. part of Qt or the
- compilers standard libraries:\c <QtGui/QWidget>.
+ directory, \c "mywidget.h", or global, i.e. part of Qt or the
+ compilers standard libraries: \c <QtGui/QWidget>.
\sa includeHints()
*/
diff --git a/tools/designer/src/lib/sdk/script.cpp b/tools/designer/src/lib/sdk/script.cpp
index 90b4c73..2eda3d1 100644
--- a/tools/designer/src/lib/sdk/script.cpp
+++ b/tools/designer/src/lib/sdk/script.cpp
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
\since 4.3
On saving the form, the extension is queried for a script snippet
- to be associated with the widget while saving the \c .ui file.
+ to be associated with the widget while saving the UI file.
This script is then run after creating the widget by \l uic or
QUiLoader.
@@ -66,7 +66,7 @@ QT_BEGIN_NAMESPACE
for which an editor is provided by the QDesignerTaskMenuExtension.
While saving the form, the state is serialized as a QVariantMap of
- \QD-supported properties, which is stored in the \c .ui file. This is
+ \QD-supported properties, which is stored in the UI file. This is
handled by data() and setData().
For item view contents, there might be for example a key that determines
@@ -97,7 +97,7 @@ QDesignerScriptExtension::~QDesignerScriptExtension()
\fn virtual QVariantMap QDesignerScriptExtension::data() const
Returns a map of variants describing the internal state to be
- stored in the \c .ui file.
+ stored in the UI file.
*/
/*!
diff --git a/tools/designer/src/lib/shared/actioneditor.cpp b/tools/designer/src/lib/shared/actioneditor.cpp
index a89e47c..1a236d6 100644
--- a/tools/designer/src/lib/shared/actioneditor.cpp
+++ b/tools/designer/src/lib/shared/actioneditor.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::ActionEditor
-*/
-
#include "actioneditor_p.h"
#include "filterwidget_p.h"
#include "actionrepository_p.h"
diff --git a/tools/designer/src/lib/shared/codedialog.cpp b/tools/designer/src/lib/shared/codedialog.cpp
index f379970..380566c 100644
--- a/tools/designer/src/lib/shared/codedialog.cpp
+++ b/tools/designer/src/lib/shared/codedialog.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::CodeDialog
-*/
-
#include "codedialog_p.h"
#include "qdesigner_utils_p.h"
#include "iconloader_p.h"
diff --git a/tools/designer/src/lib/shared/csshighlighter.cpp b/tools/designer/src/lib/shared/csshighlighter.cpp
index d871d4d..cb7a78e 100644
--- a/tools/designer/src/lib/shared/csshighlighter.cpp
+++ b/tools/designer/src/lib/shared/csshighlighter.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::StyleSheetEditorDialog
-*/
-
#include "csshighlighter_p.h"
QT_BEGIN_NAMESPACE
diff --git a/tools/designer/src/lib/shared/formwindowbase.cpp b/tools/designer/src/lib/shared/formwindowbase.cpp
index ab96809..1d79ac4 100644
--- a/tools/designer/src/lib/shared/formwindowbase.cpp
+++ b/tools/designer/src/lib/shared/formwindowbase.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::FormWindowBase
-*/
-
#include "formwindowbase_p.h"
#include "connectionedit_p.h"
#include "qdesigner_command_p.h"
diff --git a/tools/designer/src/lib/shared/newformwidget.cpp b/tools/designer/src/lib/shared/newformwidget.cpp
index e351ef0..c4d202e 100644
--- a/tools/designer/src/lib/shared/newformwidget.cpp
+++ b/tools/designer/src/lib/shared/newformwidget.cpp
@@ -310,9 +310,8 @@ QImage NewFormWidget::grabForm(QDesignerFormEditorInterface *core,
const QString &workingDir,
const qdesigner_internal::DeviceProfile &dp)
{
- qdesigner_internal::QDesignerFormBuilder formBuilder(core,
- qdesigner_internal::QDesignerFormBuilder::DisableScripts,
- dp);
+ qdesigner_internal::NewFormWidgetFormBuilder
+ formBuilder(core, qdesigner_internal::QDesignerFormBuilder::DisableScripts, dp);
if (!workingDir.isEmpty())
formBuilder.setWorkingDirectory(workingDir);
diff --git a/tools/designer/src/lib/shared/orderdialog.cpp b/tools/designer/src/lib/shared/orderdialog.cpp
index 96963db..d7da5f2 100644
--- a/tools/designer/src/lib/shared/orderdialog.cpp
+++ b/tools/designer/src/lib/shared/orderdialog.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::OrderDialog
-*/
-
#include "orderdialog_p.h"
#include "iconloader_p.h"
#include "ui_orderdialog.h"
diff --git a/tools/designer/src/lib/shared/plaintexteditor.cpp b/tools/designer/src/lib/shared/plaintexteditor.cpp
index 9b74ffd..3f9c5ed 100644
--- a/tools/designer/src/lib/shared/plaintexteditor.cpp
+++ b/tools/designer/src/lib/shared/plaintexteditor.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::PlainTextEditorDialog
-*/
-
#include "plaintexteditor_p.h"
#include "abstractsettings_p.h"
diff --git a/tools/designer/src/lib/shared/pluginmanager.cpp b/tools/designer/src/lib/shared/pluginmanager.cpp
index d74f477..b8c1c40 100644
--- a/tools/designer/src/lib/shared/pluginmanager.cpp
+++ b/tools/designer/src/lib/shared/pluginmanager.cpp
@@ -72,6 +72,11 @@ static const char *classAttributeC = "class";
static const char *customwidgetElementC = "customwidget";
static const char *extendsElementC = "extends";
static const char *addPageMethodC = "addpagemethod";
+static const char *propertySpecsC = "propertyspecifications";
+static const char *stringPropertySpecC = "stringpropertyspecification";
+static const char *stringPropertyNameAttrC = "name";
+static const char *stringPropertyTypeAttrC = "type";
+static const char *stringPropertyNoTrAttrC = "notr";
static const char *jambiLanguageC = "jambi";
enum { debugPluginManager = 0 };
@@ -141,6 +146,10 @@ static inline QString getDesignerLanguage(QDesignerFormEditorInterface *core)
class QDesignerCustomWidgetSharedData : public QSharedData {
public:
+ // Type of a string property
+ typedef QPair<qdesigner_internal::TextPropertyValidationMode, bool> StringPropertyType;
+ typedef QHash<QString, StringPropertyType> StringPropertyTypeMap;
+
explicit QDesignerCustomWidgetSharedData(const QString &thePluginPath) : pluginPath(thePluginPath) {}
void clearXML();
@@ -152,6 +161,7 @@ public:
QString xmlAddPageMethod;
QString xmlExtends;
+ StringPropertyTypeMap xmlStringPropertyTypeMap;
};
void QDesignerCustomWidgetSharedData::clearXML()
@@ -161,6 +171,7 @@ void QDesignerCustomWidgetSharedData::clearXML()
xmlLanguage.clear();
xmlAddPageMethod.clear();
xmlExtends.clear();
+ xmlStringPropertyTypeMap.clear();
}
// ---------------- QDesignerCustomWidgetData
@@ -220,6 +231,17 @@ QString QDesignerCustomWidgetData::pluginPath() const
return m_d->pluginPath;
}
+bool QDesignerCustomWidgetData::xmlStringPropertyType(const QString &name, StringPropertyType *type) const
+{
+ QDesignerCustomWidgetSharedData::StringPropertyTypeMap::const_iterator it = m_d->xmlStringPropertyTypeMap.constFind(name);
+ if (it == m_d->xmlStringPropertyTypeMap.constEnd()) {
+ *type = StringPropertyType(qdesigner_internal::ValidationRichText, true);
+ return false;
+ }
+ *type = it.value();
+ return true;
+}
+
// Wind a QXmlStreamReader until it finds an element. Returns index or one of FindResult
enum FindResult { FindError = -2, ElementNotFound = -1 };
@@ -249,6 +271,82 @@ static inline QString msgXmlError(const QString &name, const QString &errorMessa
return QDesignerPluginManager::tr("An XML error was encountered when parsing the XML of the custom widget %1: %2").arg(name, errorMessage);
}
+static inline QString msgAttributeMissing(const QString &name)
+{
+ return QDesignerPluginManager::tr("A required attribute ('%1') is missing.").arg(name);
+}
+
+static qdesigner_internal::TextPropertyValidationMode typeStringToType(const QString &v, bool *ok)
+{
+ *ok = true;
+ if (v == QLatin1String("multiline"))
+ return qdesigner_internal::ValidationMultiLine;
+ if (v == QLatin1String("richtext"))
+ return qdesigner_internal::ValidationRichText;
+ if (v == QLatin1String("stylesheet"))
+ return qdesigner_internal::ValidationStyleSheet;
+ if (v == QLatin1String("singleline"))
+ return qdesigner_internal::ValidationSingleLine;
+ if (v == QLatin1String("objectname"))
+ return qdesigner_internal::ValidationObjectName;
+ if (v == QLatin1String("objectnamescope"))
+ return qdesigner_internal::ValidationObjectNameScope;
+ if (v == QLatin1String("url"))
+ return qdesigner_internal::ValidationURL;
+ *ok = false;
+ return qdesigner_internal::ValidationRichText;
+}
+
+static bool parsePropertySpecs(QXmlStreamReader &sr,
+ QDesignerCustomWidgetSharedData::StringPropertyTypeMap *rc,
+ QString *errorMessage)
+{
+ const QString propertySpecs = QLatin1String(propertySpecsC);
+ const QString stringPropertySpec = QLatin1String(stringPropertySpecC);
+ const QString stringPropertyTypeAttr = QLatin1String(stringPropertyTypeAttrC);
+ const QString stringPropertyNoTrAttr = QLatin1String(stringPropertyNoTrAttrC);
+ const QString stringPropertyNameAttr = QLatin1String(stringPropertyNameAttrC);
+
+ while (!sr.atEnd()) {
+ switch(sr.readNext()) {
+ case QXmlStreamReader::StartElement: {
+ if (sr.name() != stringPropertySpec) {
+ *errorMessage = QDesignerPluginManager::tr("An invalid property specification ('%1') was encountered. Supported types: %2").arg(sr.name().toString(), stringPropertySpec);
+ return false;
+ }
+ const QXmlStreamAttributes atts = sr.attributes();
+ const QString name = atts.value(stringPropertyNameAttr).toString();
+ const QString type = atts.value(stringPropertyTypeAttr).toString();
+ const QString notrS = atts.value(stringPropertyNoTrAttr).toString(); //Optional
+
+ if (type.isEmpty()) {
+ *errorMessage = msgAttributeMissing(stringPropertyTypeAttr);
+ return false;
+ }
+ if (name.isEmpty()) {
+ *errorMessage = msgAttributeMissing(stringPropertyNameAttr);
+ return false;
+ }
+ bool typeOk;
+ const bool noTr = notrS == QLatin1String("true") || notrS == QLatin1String("1");
+ QDesignerCustomWidgetSharedData::StringPropertyType v(typeStringToType(type, &typeOk), !noTr);
+ if (!typeOk) {
+ *errorMessage = QDesignerPluginManager::tr("'%1' is not a valid string property specification!").arg(type);
+ return false;
+ }
+ rc->insert(name, v);
+ }
+ break;
+ case QXmlStreamReader::EndElement: // Outer </stringproperties>
+ if (sr.name() == propertySpecs)
+ return true;
+ default:
+ break;
+ }
+ }
+ return true;
+}
+
QDesignerCustomWidgetData::ParseResult
QDesignerCustomWidgetData::parseXml(const QString &xml, const QString &name, QString *errorMessage)
{
@@ -311,10 +409,11 @@ QDesignerCustomWidgetData::ParseResult
default:
break;
}
- // Find <extends>, <addPageMethod>
+ // Find <extends>, <addPageMethod>, <stringproperties>
elements.clear();
elements.push_back(QLatin1String(extendsElementC));
elements.push_back(QLatin1String(addPageMethodC));
+ elements.push_back(QLatin1String(propertySpecsC));
while (true) {
switch (findElement(elements, sr)) {
case FindError:
@@ -336,6 +435,12 @@ QDesignerCustomWidgetData::ParseResult
return ParseError;
}
break;
+ case 2: // <stringproperties>
+ if (!parsePropertySpecs(sr, &m_d->xmlStringPropertyTypeMap, errorMessage)) {
+ *errorMessage = msgXmlError(name, *errorMessage);
+ return ParseError;
+ }
+ break;
}
}
return rc;
@@ -345,6 +450,8 @@ QDesignerCustomWidgetData::ParseResult
class QDesignerPluginManagerPrivate {
public:
+ typedef QPair<QString, QString> ClassNamePropertyNameKey;
+
QDesignerPluginManagerPrivate(QDesignerFormEditorInterface *core);
void clearCustomWidgets();
@@ -562,7 +669,7 @@ bool QDesignerPluginManager::registerNewPlugins()
const int before = m_d->m_registeredPlugins.size();
foreach (const QString &path, m_d->m_pluginPaths)
- registerPath(path);
+ registerPath(path);
const bool newPluginsFound = m_d->m_registeredPlugins.size() > before;
// We force a re-initialize as Jambi collection might return
// different widget lists when switching projects.
@@ -654,6 +761,15 @@ QDesignerCustomWidgetData QDesignerPluginManager::customWidgetData(QDesignerCust
return m_d->m_customWidgetData.at(index);
}
+QDesignerCustomWidgetData QDesignerPluginManager::customWidgetData(const QString &name) const
+{
+ const int count = m_d->m_customWidgets.size();
+ for (int i = 0; i < count; i++)
+ if (m_d->m_customWidgets.at(i)->name() == name)
+ return m_d->m_customWidgetData.at(i);
+ return QDesignerCustomWidgetData();
+}
+
QObjectList QDesignerPluginManager::instances() const
{
QStringList plugins = registeredPlugins();
diff --git a/tools/designer/src/lib/shared/pluginmanager_p.h b/tools/designer/src/lib/shared/pluginmanager_p.h
index 479e94d..4654280 100644
--- a/tools/designer/src/lib/shared/pluginmanager_p.h
+++ b/tools/designer/src/lib/shared/pluginmanager_p.h
@@ -54,9 +54,11 @@
#define PLUGINMANAGER_H
#include "shared_global_p.h"
+#include "shared_enums_p.h"
#include <QtCore/QSharedDataPointer>
#include <QtCore/QMap>
+#include <QtCore/QPair>
#include <QtCore/QStringList>
QT_BEGIN_NAMESPACE
@@ -70,6 +72,9 @@ class QDesignerCustomWidgetSharedData;
/* Information contained in the Dom XML of a custom widget. */
class QDESIGNER_SHARED_EXPORT QDesignerCustomWidgetData {
public:
+ // StringPropertyType: validation mode and translatable flag.
+ typedef QPair<qdesigner_internal::TextPropertyValidationMode, bool> StringPropertyType;
+
explicit QDesignerCustomWidgetData(const QString &pluginPath = QString());
enum ParseResult { ParseOk, ParseWarning, ParseError };
@@ -93,6 +98,8 @@ public:
QString xmlExtends() const;
// Optional. The name to be used in the widget box.
QString xmlDisplayName() const;
+ // Type of a string property
+ bool xmlStringPropertyType(const QString &name, StringPropertyType *type) const;
private:
QSharedDataPointer<QDesignerCustomWidgetSharedData> m_d;
@@ -128,6 +135,7 @@ public:
CustomWidgetList registeredCustomWidgets() const;
QDesignerCustomWidgetData customWidgetData(QDesignerCustomWidgetInterface *w) const;
+ QDesignerCustomWidgetData customWidgetData(const QString &className) const;
bool registerNewPlugins();
diff --git a/tools/designer/src/lib/shared/previewconfigurationwidget.cpp b/tools/designer/src/lib/shared/previewconfigurationwidget.cpp
index 54a5c20..0134788 100644
--- a/tools/designer/src/lib/shared/previewconfigurationwidget.cpp
+++ b/tools/designer/src/lib/shared/previewconfigurationwidget.cpp
@@ -65,43 +65,27 @@
#include <QtCore/QFileInfo>
#include <QtCore/QSharedData>
-// #define DEFAULT_SKINS_FROM_RESOURCE
-#ifdef DEFAULT_SKINS_FROM_RESOURCE
-QT_BEGIN_NAMESPACE
+
static const char *skinResourcePathC = ":/skins/";
-QT_END_NAMESPACE
-#else
-# include <QtCore/QLibraryInfo>
-#endif
QT_BEGIN_NAMESPACE
static const char *skinExtensionC = "skin";
-namespace {
- // Pair of skin name, path
- typedef QPair<QString, QString> SkinNamePath;
- typedef QList<SkinNamePath> Skins;
- enum { SkinComboNoneIndex = 0 };
-}
+// Pair of skin name, path
+typedef QPair<QString, QString> SkinNamePath;
+typedef QList<SkinNamePath> Skins;
+enum { SkinComboNoneIndex = 0 };
// find default skins (resources)
static const Skins &defaultSkins() {
static Skins rc;
if (rc.empty()) {
-#ifdef DEFAULT_SKINS_FROM_RESOURCE
const QString skinPath = QLatin1String(skinResourcePathC);
-#else
- QString skinPath = QLibraryInfo::location(QLibraryInfo::PrefixPath);
- skinPath += QDir::separator();
- skinPath += QLatin1String("tools");
- skinPath += QDir::separator();
- skinPath += QLatin1String("qvfb");
-#endif
QString pattern = QLatin1String("*.");
pattern += QLatin1String(skinExtensionC);
const QDir dir(skinPath, pattern);
- const QFileInfoList list = dir.entryInfoList();
+ const QFileInfoList list = dir.entryInfoList(QDir::Dirs|QDir::NoDotAndDotDot, QDir::Name);
if (list.empty())
return rc;
const QFileInfoList::const_iterator lcend = list.constEnd();
diff --git a/tools/designer/src/lib/shared/previewmanager.cpp b/tools/designer/src/lib/shared/previewmanager.cpp
index f972ffe..890bfc1 100644
--- a/tools/designer/src/lib/shared/previewmanager.cpp
+++ b/tools/designer/src/lib/shared/previewmanager.cpp
@@ -67,6 +67,7 @@
#include <QtGui/QAction>
#include <QtGui/QActionGroup>
#include <QtGui/QCursor>
+#include <QtGui/QMatrix>
#include <QtCore/QMap>
#include <QtCore/QDebug>
@@ -149,11 +150,16 @@ QGraphicsProxyWidget *DesignerZoomWidget::createProxyWidget(QGraphicsItem *paren
return new DesignerZoomProxyWidget(parent, wFlags);
}
-// --------- Widget Preview skin: Forward the key events to the window
+// PreviewDeviceSkin: Forwards the key events to the window and
+// provides context menu with rotation options. Derived class
+// can apply additional transformations to the skin.
+
class PreviewDeviceSkin : public DeviceSkin
{
Q_OBJECT
public:
+ enum Direction { DirectionUp, DirectionLeft, DirectionRight };
+
explicit PreviewDeviceSkin(const DeviceSkinParameters &parameters, QWidget *parent);
virtual void setPreview(QWidget *w);
QSize screenSize() const { return m_screenSize; }
@@ -164,15 +170,36 @@ private slots:
void slotPopupMenu();
protected:
- virtual void populateContextMenu(QMenu *m);
+ virtual void populateContextMenu(QMenu *) {}
+
+private slots:
+ void slotDirection(QAction *);
+
+protected:
+ // Fit the widget in case the orientation changes (transposing screensize)
+ virtual void fitWidget(const QSize &size);
+ // Calculate the complete transformation for the skin
+ // (base class implementation provides rotation).
+ virtual QMatrix skinTransform() const;
private:
const QSize m_screenSize;
+ Direction m_direction;
+
+ QAction *m_directionUpAction;
+ QAction *m_directionLeftAction;
+ QAction *m_directionRightAction;
+ QAction *m_closeAction;
};
PreviewDeviceSkin::PreviewDeviceSkin(const DeviceSkinParameters &parameters, QWidget *parent) :
- DeviceSkin(parameters, parent),
- m_screenSize(parameters.screenSize())
+ DeviceSkin(parameters, parent),
+ m_screenSize(parameters.screenSize()),
+ m_direction(DirectionUp),
+ m_directionUpAction(0),
+ m_directionLeftAction(0),
+ m_directionRightAction(0),
+ m_closeAction(0)
{
connect(this, SIGNAL(skinKeyPressEvent(int,QString,bool)),
this, SLOT(slotSkinKeyPressEvent(int,QString,bool)));
@@ -195,7 +222,6 @@ void PreviewDeviceSkin::slotSkinKeyPressEvent(int code, const QString& text, boo
QKeyEvent e(QEvent::KeyPress,code,0,text,autorep);
QApplication::sendEvent(focusWidget, &e);
}
-
}
void PreviewDeviceSkin::slotSkinKeyReleaseEvent(int code, const QString& text, bool autorep)
@@ -206,16 +232,83 @@ void PreviewDeviceSkin::slotSkinKeyReleaseEvent(int code, const QString& text, b
}
}
+// Create a checkable action with integer data and
+// set it checked if it matches the currentState.
+static inline QAction
+ *createCheckableActionIntData(const QString &label,
+ int actionValue, int currentState,
+ QActionGroup *ag, QObject *parent)
+{
+ QAction *a = new QAction(label, parent);
+ a->setData(actionValue);
+ a->setCheckable(true);
+ if (actionValue == currentState)
+ a->setChecked(true);
+ ag->addAction(a);
+ return a;
+}
+
void PreviewDeviceSkin::slotPopupMenu()
{
QMenu menu(this);
+ // Create actions
+ if (!m_directionUpAction) {
+ QActionGroup *directionGroup = new QActionGroup(this);
+ connect(directionGroup, SIGNAL(triggered(QAction*)), this, SLOT(slotDirection(QAction*)));
+ directionGroup->setExclusive(true);
+ m_directionUpAction = createCheckableActionIntData(tr("&Portrait"), DirectionUp, m_direction, directionGroup, this);
+ m_directionLeftAction = createCheckableActionIntData(tr("Landscape (&CCW)"), DirectionLeft, m_direction, directionGroup, this);
+ m_directionRightAction = createCheckableActionIntData(tr("&Landscape (CW)"), DirectionRight, m_direction, directionGroup, this);
+ m_closeAction = new QAction(tr("&Close"), this);
+ connect(m_closeAction, SIGNAL(triggered()), parentWidget(), SLOT(close()));
+ }
+ menu.addAction(m_directionUpAction);
+ menu.addAction(m_directionLeftAction);
+ menu.addAction(m_directionRightAction);
+ menu.addSeparator();
populateContextMenu(&menu);
+ menu.addAction(m_closeAction);
menu.exec(QCursor::pos());
}
-void PreviewDeviceSkin::populateContextMenu(QMenu *menu)
+void PreviewDeviceSkin::slotDirection(QAction *a)
+{
+ const Direction newDirection = static_cast<Direction>(a->data().toInt());
+ if (m_direction == newDirection)
+ return;
+ const Qt::Orientation newOrientation = newDirection == DirectionUp ? Qt::Vertical : Qt::Horizontal;
+ const Qt::Orientation oldOrientation = m_direction == DirectionUp ? Qt::Vertical : Qt::Horizontal;
+ m_direction = newDirection;
+ QApplication::setOverrideCursor(Qt::WaitCursor);
+ if (oldOrientation != newOrientation) {
+ QSize size = screenSize();
+ if (newOrientation == Qt::Horizontal)
+ size.transpose();
+ fitWidget(size);
+ }
+ setTransform(skinTransform());
+ QApplication::restoreOverrideCursor();
+}
+
+void PreviewDeviceSkin::fitWidget(const QSize &size)
+{
+ view()->setFixedSize(size);
+}
+
+QMatrix PreviewDeviceSkin::skinTransform() const
{
- connect(menu->addAction(tr("&Close")), SIGNAL(triggered()), parentWidget(), SLOT(close()));
+ QMatrix newTransform;
+ switch (m_direction) {
+ case DirectionUp:
+ break;
+ case DirectionLeft:
+ newTransform.rotate(270.0);
+ break;
+ case DirectionRight:
+ newTransform.rotate(90.0);
+ break;
+ }
+ return newTransform;
}
// ------------ PreviewConfigurationPrivate
@@ -257,16 +350,20 @@ signals:
void zoomPercentChanged(int);
protected:
- virtual void populateContextMenu(QMenu *m);
+ virtual void populateContextMenu(QMenu *m);
+ virtual QMatrix skinTransform() const;
+ virtual void fitWidget(const QSize &size);
private:
ZoomMenu *m_zoomMenu;
+ QAction *m_zoomSubMenuAction;
ZoomWidget *m_zoomWidget;
};
ZoomablePreviewDeviceSkin::ZoomablePreviewDeviceSkin(const DeviceSkinParameters &parameters, QWidget *parent) :
PreviewDeviceSkin(parameters, parent),
m_zoomMenu(new ZoomMenu(this)),
+ m_zoomSubMenuAction(0),
m_zoomWidget(new DesignerZoomWidget)
{
connect(m_zoomMenu, SIGNAL(zoomChanged(int)), this, SLOT(setZoomPercent(int)));
@@ -279,10 +376,20 @@ ZoomablePreviewDeviceSkin::ZoomablePreviewDeviceSkin(const DeviceSkinParameters
setView(m_zoomWidget);
}
-void ZoomablePreviewDeviceSkin::setPreview(QWidget *formWidget)
+static inline qreal zoomFactor(int percent)
{
- formWidget->setFixedSize(screenSize());
+ return qreal(percent) / 100.0;
+}
+
+static inline QSize scaleSize(int zoomPercent, const QSize &size)
+{
+ return zoomPercent == 100 ? size : (QSizeF(size) * zoomFactor(zoomPercent)).toSize();
+}
+
+void ZoomablePreviewDeviceSkin::setPreview(QWidget *formWidget)
+{
m_zoomWidget->setWidget(formWidget);
+ m_zoomWidget->resize(scaleSize(zoomPercent(), screenSize()));
}
int ZoomablePreviewDeviceSkin::zoomPercent() const
@@ -290,32 +397,50 @@ int ZoomablePreviewDeviceSkin::zoomPercent() const
return m_zoomWidget->zoom();
}
-void ZoomablePreviewDeviceSkin::setZoomPercent(int z)
+void ZoomablePreviewDeviceSkin::setZoomPercent(int zp)
{
- if (z == zoomPercent())
+ if (zp == zoomPercent())
return;
// If not triggered by the menu itself: Update it
- if (m_zoomMenu->zoom() != z)
- m_zoomMenu->setZoom(z);
+ if (m_zoomMenu->zoom() != zp)
+ m_zoomMenu->setZoom(zp);
- const QCursor oldCursor = cursor();
- QApplication::setOverrideCursor(Qt::WaitCursor);
- // DeviceSkin has double, not qreal.
- const double hundred = 100.0;
- setZoom(static_cast<double>(z) / hundred);
- m_zoomWidget->setZoom(z);
+ QApplication::setOverrideCursor(Qt::WaitCursor);
+ m_zoomWidget->setZoom(zp);
+ setTransform(skinTransform());
QApplication::restoreOverrideCursor();
}
void ZoomablePreviewDeviceSkin::populateContextMenu(QMenu *menu)
{
- m_zoomMenu->addActions(menu);
- menu->addSeparator();
- PreviewDeviceSkin::populateContextMenu(menu);
+ if (!m_zoomSubMenuAction) {
+ m_zoomSubMenuAction = new QAction(tr("&Zoom"), this);
+ QMenu *zoomSubMenu = new QMenu;
+ m_zoomSubMenuAction->setMenu(zoomSubMenu);
+ m_zoomMenu->addActions(zoomSubMenu);
+ }
+ menu->addAction(m_zoomSubMenuAction);
menu->addSeparator();
}
+QMatrix ZoomablePreviewDeviceSkin::skinTransform() const
+{
+ // Complete transformation consisting of base class rotation and zoom.
+ QMatrix rc = PreviewDeviceSkin::skinTransform();
+ const int zp = zoomPercent();
+ if (zp != 100) {
+ const qreal factor = zoomFactor(zp);
+ rc.scale(factor, factor);
+ }
+ return rc;
+}
+
+void ZoomablePreviewDeviceSkin::fitWidget(const QSize &size)
+{
+ m_zoomWidget->resize(scaleSize(zoomPercent(), size));
+}
+
// ------------- PreviewConfiguration
static const char *styleKey = "Style";
diff --git a/tools/designer/src/lib/shared/promotionmodel.cpp b/tools/designer/src/lib/shared/promotionmodel.cpp
index 7276195..4b4bc04 100644
--- a/tools/designer/src/lib/shared/promotionmodel.cpp
+++ b/tools/designer/src/lib/shared/promotionmodel.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::PromotionModel
-*/
-
#include "promotionmodel_p.h"
#include "widgetdatabase_p.h"
diff --git a/tools/designer/src/lib/shared/qdesigner_formbuilder.cpp b/tools/designer/src/lib/shared/qdesigner_formbuilder.cpp
index c4cdd9d..20e94dc 100644
--- a/tools/designer/src/lib/shared/qdesigner_formbuilder.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_formbuilder.cpp
@@ -473,6 +473,20 @@ QPixmap QDesignerFormBuilder::createPreviewPixmap(const QDesignerFormWindowInter
return rc;
}
+// ---------- NewFormWidgetFormBuilder
+
+NewFormWidgetFormBuilder::NewFormWidgetFormBuilder(QDesignerFormEditorInterface *core,
+ Mode mode,
+ const DeviceProfile &deviceProfile) :
+ QDesignerFormBuilder(core, mode, deviceProfile)
+{
+}
+
+void NewFormWidgetFormBuilder::createCustomWidgets(DomCustomWidgets *dc)
+{
+ QSimpleResource::handleDomCustomWidgets(core(), dc);
+}
+
} // namespace qdesigner_internal
QT_END_NAMESPACE
diff --git a/tools/designer/src/lib/shared/qdesigner_formbuilder_p.h b/tools/designer/src/lib/shared/qdesigner_formbuilder_p.h
index 9564c55..f026ac5 100644
--- a/tools/designer/src/lib/shared/qdesigner_formbuilder_p.h
+++ b/tools/designer/src/lib/shared/qdesigner_formbuilder_p.h
@@ -75,7 +75,7 @@ namespace qdesigner_internal {
class DesignerPixmapCache;
class DesignerIconCache;
-/* Form builder used for previewing forms, widget box and new form dialog.
+/* Form builder used for previewing forms and widget box.
* It applies the system settings to its toplevel window. */
class QDESIGNER_SHARED_EXPORT QDesignerFormBuilder: public QFormBuilder
@@ -159,6 +159,21 @@ private:
bool m_mainWidget;
};
+// Form builder for a new form widget (preview). To allow for promoted
+// widgets in the template, it implements the handling of custom widgets
+// (adding of them to the widget database).
+
+class QDESIGNER_SHARED_EXPORT NewFormWidgetFormBuilder: public QDesignerFormBuilder {
+public:
+ NewFormWidgetFormBuilder(QDesignerFormEditorInterface *core,
+ Mode mode,
+ const DeviceProfile &deviceProfile = DeviceProfile());
+
+protected:
+ virtual void createCustomWidgets(DomCustomWidgets *);
+};
+
+
} // namespace qdesigner_internal
QT_END_NAMESPACE
diff --git a/tools/designer/src/lib/shared/qdesigner_promotiondialog.cpp b/tools/designer/src/lib/shared/qdesigner_promotiondialog.cpp
index caa3ef2..010cc17 100644
--- a/tools/designer/src/lib/shared/qdesigner_promotiondialog.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_promotiondialog.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::QDesignerPromotionDialog
-*/
-
#include "qdesigner_promotiondialog_p.h"
#include "promotionmodel_p.h"
#include "iconloader_p.h"
diff --git a/tools/designer/src/lib/shared/qdesigner_propertyeditor.cpp b/tools/designer/src/lib/shared/qdesigner_propertyeditor.cpp
index 5a435ba..96b51f0 100644
--- a/tools/designer/src/lib/shared/qdesigner_propertyeditor.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_propertyeditor.cpp
@@ -40,16 +40,56 @@
****************************************************************************/
#include "qdesigner_propertyeditor_p.h"
-#ifdef Q_OS_WIN
-# include <widgetfactory_p.h>
-#endif
-#include <QAction>
-#include <QLineEdit>
-#include <QAbstractButton>
+#include "pluginmanager_p.h"
+
+#include <QtDesigner/QDesignerFormEditorInterface>
+#include <widgetfactory_p.h>
+#include <QtGui/QAction>
+#include <QtGui/QLineEdit>
+#include <QtGui/QAbstractButton>
QT_BEGIN_NAMESPACE
namespace qdesigner_internal {
+typedef QDesignerPropertyEditor::StringPropertyParameters StringPropertyParameters;
+// A map of property name to type
+typedef QHash<QString, StringPropertyParameters> PropertyNameTypeMap;
+
+// Compile a map of hard-coded string property types
+static const PropertyNameTypeMap &stringPropertyTypes()
+{
+ static PropertyNameTypeMap propertyNameTypeMap;
+ if (propertyNameTypeMap.empty()) {
+ const StringPropertyParameters richtext(ValidationRichText, true);
+ // Accessibility. Both are texts the narrator reads
+ propertyNameTypeMap.insert(QLatin1String("accessibleDescription"), richtext);
+ propertyNameTypeMap.insert(QLatin1String("accessibleName"), richtext);
+ // object names
+ const StringPropertyParameters objectName(ValidationObjectName, false);
+ propertyNameTypeMap.insert(QLatin1String("buddy"), objectName);
+ propertyNameTypeMap.insert(QLatin1String("currentItemName"), objectName);
+ propertyNameTypeMap.insert(QLatin1String("currentPageName"), objectName);
+ propertyNameTypeMap.insert(QLatin1String("currentTabName"), objectName);
+ propertyNameTypeMap.insert(QLatin1String("layoutName"), objectName);
+ propertyNameTypeMap.insert(QLatin1String("spacerName"), objectName);
+ // Style sheet
+ propertyNameTypeMap.insert(QLatin1String("styleSheet"), StringPropertyParameters(ValidationStyleSheet, false));
+ // Buttons/ QCommandLinkButton
+ const StringPropertyParameters multiline(ValidationMultiLine, true);
+ propertyNameTypeMap.insert(QLatin1String("description"), multiline);
+ propertyNameTypeMap.insert(QLatin1String("iconText"), multiline);
+ // Tooltips, etc.
+ propertyNameTypeMap.insert(QLatin1String("toolTip"), richtext);
+ propertyNameTypeMap.insert(QLatin1String("whatsThis"), richtext);
+ propertyNameTypeMap.insert(QLatin1String("windowIconText"), richtext);
+ propertyNameTypeMap.insert(QLatin1String("html"), richtext);
+ // A QWizard page id
+ propertyNameTypeMap.insert(QLatin1String("pageId"), StringPropertyParameters(ValidationSingleLine, false));
+ // QPlainTextEdit
+ propertyNameTypeMap.insert(QLatin1String("plainText"), StringPropertyParameters(ValidationMultiLine, true));
+ }
+ return propertyNameTypeMap;
+}
QDesignerPropertyEditor::QDesignerPropertyEditor(QWidget *parent, Qt::WindowFlags flags) :
QDesignerPropertyEditorInterface(parent, flags)
@@ -68,33 +108,19 @@ QDesignerPropertyEditor::StringPropertyParameters QDesignerPropertyEditor::textP
return StringPropertyParameters(vm, false);
}
- // Accessibility. Both are texts the narrator reads
- if (propertyName == QLatin1String("accessibleDescription") || propertyName == QLatin1String("accessibleName"))
- return StringPropertyParameters(ValidationRichText, true);
-
- // Names
- if (propertyName == QLatin1String("buddy")
- || propertyName == QLatin1String("currentItemName")
- || propertyName == QLatin1String("currentPageName")
- || propertyName == QLatin1String("currentTabName")
- || propertyName == QLatin1String("layoutName")
- || propertyName == QLatin1String("spacerName"))
- return StringPropertyParameters(ValidationObjectName, false);
-
- if (propertyName.endsWith(QLatin1String("Name")))
- return StringPropertyParameters(ValidationSingleLine, true);
-
- // Multi line?
- if (propertyName == QLatin1String("styleSheet"))
- return StringPropertyParameters(ValidationStyleSheet, false);
-
- if (propertyName == QLatin1String("description") || propertyName == QLatin1String("iconText")) // QCommandLinkButton
- return StringPropertyParameters(ValidationMultiLine, true);
+ // Check custom widgets by class.
+ const QString className = WidgetFactory::classNameOf(core, object);
+ const QDesignerCustomWidgetData customData = core->pluginManager()->customWidgetData(className);
+ if (!customData.isNull()) {
+ StringPropertyParameters customType;
+ if (customData.xmlStringPropertyType(propertyName, &customType))
+ return customType;
+ }
- if (propertyName == QLatin1String("toolTip") || propertyName.endsWith(QLatin1String("ToolTip")) ||
- propertyName == QLatin1String("whatsThis") ||
- propertyName == QLatin1String("windowIconText") || propertyName == QLatin1String("html"))
- return StringPropertyParameters(ValidationRichText, true);
+ // Check hardcoded property ames
+ const PropertyNameTypeMap::const_iterator hit = stringPropertyTypes().constFind(propertyName);
+ if (hit != stringPropertyTypes().constEnd())
+ return hit.value();
// text: Check according to widget type.
if (propertyName == QLatin1String("text")) {
@@ -104,17 +130,17 @@ QDesignerPropertyEditor::StringPropertyParameters QDesignerPropertyEditor::textP
return StringPropertyParameters(ValidationMultiLine, true);
return StringPropertyParameters(ValidationRichText, true);
}
- if (propertyName == QLatin1String("pageId")) // A QWizard page id
- return StringPropertyParameters(ValidationSingleLine, false);
- if (propertyName == QLatin1String("plainText")) // QPlainTextEdit
- return StringPropertyParameters(ValidationMultiLine, true);
+ // Fuzzy matching
+ if (propertyName.endsWith(QLatin1String("Name")))
+ return StringPropertyParameters(ValidationSingleLine, true);
+
+ if (propertyName.endsWith(QLatin1String("ToolTip")))
+ return StringPropertyParameters(ValidationRichText, true);
#ifdef Q_OS_WIN // No translation for the active X "control" property
- if (propertyName == QLatin1String("control") && WidgetFactory::classNameOf(core, object) == QLatin1String("QAxWidget"))
+ if (propertyName == QLatin1String("control") && className == QLatin1String("QAxWidget"))
return StringPropertyParameters(ValidationSingleLine, false);
-#else
- Q_UNUSED(core);
#endif
// default to single
diff --git a/tools/designer/src/lib/shared/qdesigner_stackedbox.cpp b/tools/designer/src/lib/shared/qdesigner_stackedbox.cpp
index 38b1d7c..0b45b7b 100644
--- a/tools/designer/src/lib/shared/qdesigner_stackedbox.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_stackedbox.cpp
@@ -315,7 +315,7 @@ QMenu *QStackedWidgetEventFilter::addContextMenuActions(QMenu *popup)
QMenu *pageMenu = 0;
const int count = stackedWidget()->count();
const bool hasSeveralPages = count > 1;
- m_actionDeletePage->setEnabled(hasSeveralPages);
+ m_actionDeletePage->setEnabled(count);
if (count) {
const QString pageSubMenuLabel = tr("Page %1 of %2").arg(stackedWidget()->currentIndex() + 1).arg(count);
pageMenu = popup->addMenu(pageSubMenuLabel);
@@ -327,10 +327,13 @@ QMenu *QStackedWidgetEventFilter::addContextMenuActions(QMenu *popup)
qdesigner_internal::PromotionTaskMenu::SuppressGlobalEdit,
pageMenu);
}
+ QMenu *insertPageMenu = popup->addMenu(tr("Insert Page"));
+ insertPageMenu->addAction(m_actionInsertPageAfter);
+ insertPageMenu->addAction(m_actionInsertPage);
+ } else {
+ QAction *insertPageAction = popup->addAction(tr("Insert Page"));
+ connect(insertPageAction, SIGNAL(triggered()), this, SLOT(addPage()));
}
- QMenu *insertPageMenu = popup->addMenu(tr("Insert Page"));
- insertPageMenu->addAction(m_actionInsertPageAfter);
- insertPageMenu->addAction(m_actionInsertPage);
popup->addAction(m_actionNextPage);
m_actionNextPage->setEnabled(hasSeveralPages);
popup->addAction(m_actionPreviousPage);
diff --git a/tools/designer/src/lib/shared/qdesigner_tabwidget.cpp b/tools/designer/src/lib/shared/qdesigner_tabwidget.cpp
index 22833b3..eb4dfa2 100644
--- a/tools/designer/src/lib/shared/qdesigner_tabwidget.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_tabwidget.cpp
@@ -368,7 +368,7 @@ QMenu *QTabWidgetEventFilter::addContextMenuActions(QMenu *popup)
{
QMenu *pageMenu = 0;
const int count = m_tabWidget->count();
- m_actionDeletePage->setEnabled(count > 1);
+ m_actionDeletePage->setEnabled(count);
if (count) {
const int currentIndex = m_tabWidget->currentIndex();
const QString pageSubMenuLabel = tr("Page %1 of %2").arg(currentIndex + 1).arg(count);
@@ -381,11 +381,13 @@ QMenu *QTabWidgetEventFilter::addContextMenuActions(QMenu *popup)
qdesigner_internal::PromotionTaskMenu::SuppressGlobalEdit,
pageMenu);
}
+ QMenu *insertPageMenu = popup->addMenu(tr("Insert Page"));
+ insertPageMenu->addAction(m_actionInsertPageAfter);
+ insertPageMenu->addAction(m_actionInsertPage);
+ } else {
+ QAction *insertPageAction = popup->addAction(tr("Insert Page"));
+ connect(insertPageAction, SIGNAL(triggered()), this, SLOT(addPage()));
}
-
- QMenu *insertPageMenu = popup->addMenu(tr("Insert Page"));
- insertPageMenu->addAction(m_actionInsertPageAfter);
- insertPageMenu->addAction(m_actionInsertPage);
popup->addSeparator();
return pageMenu;
}
diff --git a/tools/designer/src/lib/shared/qdesigner_taskmenu.cpp b/tools/designer/src/lib/shared/qdesigner_taskmenu.cpp
index 93b1fa6..ae31c33 100644
--- a/tools/designer/src/lib/shared/qdesigner_taskmenu.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_taskmenu.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::QDesignerTaskMenu
-*/
-
#include "qdesigner_taskmenu_p.h"
#include "qdesigner_command_p.h"
#include "richtexteditor_p.h"
diff --git a/tools/designer/src/lib/shared/qdesigner_toolbar.cpp b/tools/designer/src/lib/shared/qdesigner_toolbar.cpp
index f0e51de..2693452 100644
--- a/tools/designer/src/lib/shared/qdesigner_toolbar.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_toolbar.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::Sentinel
-*/
-
#include "qdesigner_toolbar_p.h"
#include "qdesigner_command_p.h"
#include "actionrepository_p.h"
@@ -65,7 +61,6 @@ TRANSLATOR qdesigner_internal::Sentinel
#include <QtGui/QMenu>
#include <QtGui/qevent.h>
#include <QtGui/QApplication>
-#include <QtGui/private/qtoolbarlayout_p.h>
#include <QtCore/QDebug>
Q_DECLARE_METATYPE(QAction*)
@@ -445,11 +440,17 @@ QAction *ToolBarEventFilter::actionAt(const QToolBar *tb, const QPoint &pos)
return tb->actions().at(index);
}
+//that's a trick to get acces to the initStyleOption which is a protected member
+class FriendlyToolBar : public QToolBar {
+public:
+ friend class ToolBarEventFilter;
+};
+
QRect ToolBarEventFilter::handleArea(const QToolBar *tb)
{
- const QToolBarLayout *tbl = qobject_cast<QToolBarLayout *>(tb->layout());
- Q_ASSERT(tbl);
- return tbl->handleRect();
+ QStyleOptionToolBar opt;
+ static_cast<const FriendlyToolBar*>(tb)->initStyleOption(&opt);
+ return tb->style()->subElementRect(QStyle::SE_ToolBarHandle, &opt, tb);
}
bool ToolBarEventFilter::withinHandleArea(const QToolBar *tb, const QPoint &pos)
diff --git a/tools/designer/src/lib/shared/qdesigner_widgetbox.cpp b/tools/designer/src/lib/shared/qdesigner_widgetbox.cpp
index 34f7016..e25b880 100644
--- a/tools/designer/src/lib/shared/qdesigner_widgetbox.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_widgetbox.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::QDesignerWidgetBox
-*/
-
#include "qdesigner_widgetbox_p.h"
#include "qdesigner_utils_p.h"
diff --git a/tools/designer/src/lib/shared/qsimpleresource.cpp b/tools/designer/src/lib/shared/qsimpleresource.cpp
index 4a9c7fe..63dfb03 100644
--- a/tools/designer/src/lib/shared/qsimpleresource.cpp
+++ b/tools/designer/src/lib/shared/qsimpleresource.cpp
@@ -41,6 +41,7 @@
#include "qsimpleresource_p.h"
#include "widgetfactory_p.h"
+#include "widgetdatabase_p.h"
#include <formscriptrunner_p.h>
#include <properties_p.h>
@@ -57,6 +58,8 @@
#include <QtGui/QWidget>
#include <QtGui/QAction>
#include <QtCore/QDebug>
+#include <QtCore/QCoreApplication>
+
QT_BEGIN_NAMESPACE
@@ -267,6 +270,136 @@ bool QSimpleResource::warningsEnabled()
return m_warningsEnabled;
}
+// Custom widgets handling helpers
+
+// Add unique fake slots and signals to lists
+bool QSimpleResource::addFakeMethods(const DomSlots *domSlots, QStringList &fakeSlots, QStringList &fakeSignals)
+{
+ if (!domSlots)
+ return false;
+
+ bool rc = false;
+ foreach (const QString &fakeSlot, domSlots->elementSlot())
+ if (fakeSlots.indexOf(fakeSlot) == -1) {
+ fakeSlots += fakeSlot;
+ rc = true;
+ }
+
+ foreach (const QString &fakeSignal, domSlots->elementSignal())
+ if (fakeSignals.indexOf(fakeSignal) == -1) {
+ fakeSignals += fakeSignal;
+ rc = true;
+ }
+ return rc;
+}
+
+void QSimpleResource::addFakeMethodsToWidgetDataBase(const DomCustomWidget *domCustomWidget, WidgetDataBaseItem *item)
+{
+ const DomSlots *domSlots = domCustomWidget->elementSlots();
+ if (!domSlots)
+ return;
+
+ // Merge in new slots, signals
+ QStringList fakeSlots = item->fakeSlots();
+ QStringList fakeSignals = item->fakeSignals();
+ if (addFakeMethods(domSlots, fakeSlots, fakeSignals)) {
+ item->setFakeSlots(fakeSlots);
+ item->setFakeSignals(fakeSignals);
+ }
+}
+
+// Perform one iteration of adding the custom widgets to the database,
+// looking up the base class and inheriting its data.
+// Remove the succeeded custom widgets from the list.
+// Classes whose base class could not be found are left in the list.
+
+void QSimpleResource::addCustomWidgetsToWidgetDatabase(const QDesignerFormEditorInterface *core,
+ QList<DomCustomWidget*>& custom_widget_list)
+{
+ QDesignerWidgetDataBaseInterface *db = core->widgetDataBase();
+ for (int i=0; i < custom_widget_list.size(); ) {
+ bool classInserted = false;
+ DomCustomWidget *custom_widget = custom_widget_list[i];
+ const QString customClassName = custom_widget->elementClass();
+ const QString base_class = custom_widget->elementExtends();
+ QString includeFile;
+ IncludeType includeType = IncludeLocal;
+ if (const DomHeader *header = custom_widget->elementHeader()) {
+ includeFile = header->text();
+ if (header->hasAttributeLocation() && header->attributeLocation() == QLatin1String("global"))
+ includeType = IncludeGlobal;
+ }
+ const bool domIsContainer = custom_widget->elementContainer();
+ // Append a new item
+ if (base_class.isEmpty()) {
+ WidgetDataBaseItem *item = new WidgetDataBaseItem(customClassName);
+ item->setPromoted(false);
+ item->setGroup(QCoreApplication::translate("Designer", "Custom Widgets"));
+ item->setIncludeFile(buildIncludeFile(includeFile, includeType));
+ item->setContainer(domIsContainer);
+ item->setCustom(true);
+ addFakeMethodsToWidgetDataBase(custom_widget, item);
+ db->append(item);
+ custom_widget_list.removeAt(i);
+ classInserted = true;
+ } else {
+ // Create a new entry cloned from base class. Note that this will ignore existing
+ // classes, eg, plugin custom widgets.
+ QDesignerWidgetDataBaseItemInterface *item =
+ appendDerived(db, customClassName, QCoreApplication::translate("Designer", "Promoted Widgets"),
+ base_class,
+ buildIncludeFile(includeFile, includeType),
+ true,true);
+ // Ok, base class found.
+ if (item) {
+ // Hack to accommodate for old UI-files in which "container" is not set properly:
+ // Apply "container" from DOM only if true (else, eg classes from QFrame might not accept
+ // dropping child widgets on them as container=false). This also allows for
+ // QWidget-derived stacked pages.
+ if (domIsContainer)
+ item->setContainer(domIsContainer);
+
+ addFakeMethodsToWidgetDataBase(custom_widget, static_cast<WidgetDataBaseItem*>(item));
+ custom_widget_list.removeAt(i);
+ classInserted = true;
+ }
+ }
+ // Skip failed item.
+ if (!classInserted)
+ i++;
+ }
+
+}
+
+void QSimpleResource::handleDomCustomWidgets(const QDesignerFormEditorInterface *core,
+ const DomCustomWidgets *dom_custom_widgets)
+{
+ if (dom_custom_widgets == 0)
+ return;
+ QList<DomCustomWidget*> custom_widget_list = dom_custom_widgets->elementCustomWidget();
+ // Attempt to insert each item derived from its base class.
+ // This should at most require two iterations in the event that the classes are out of order
+ // (derived first, max depth: promoted custom plugin = 2)
+ for (int iteration = 0; iteration < 2; iteration++) {
+ addCustomWidgetsToWidgetDatabase(core, custom_widget_list);
+ if (custom_widget_list.empty())
+ return;
+ }
+ // Oops, there are classes left whose base class could not be found.
+ // Default them to QWidget with warnings.
+ const QString fallBackBaseClass = QLatin1String("QWidget");
+ for (int i=0; i < custom_widget_list.size(); i++ ) {
+ DomCustomWidget *custom_widget = custom_widget_list[i];
+ const QString customClassName = custom_widget->elementClass();
+ const QString base_class = custom_widget->elementExtends();
+ qDebug() << "** WARNING The base class " << base_class << " of the custom widget class " << customClassName
+ << " could not be found. Defaulting to " << fallBackBaseClass << '.';
+ custom_widget->setElementExtends(fallBackBaseClass);
+ }
+ // One more pass.
+ addCustomWidgetsToWidgetDatabase(core, custom_widget_list);
+}
+
// ------------ FormBuilderClipboard
FormBuilderClipboard::FormBuilderClipboard(QWidget *w)
diff --git a/tools/designer/src/lib/shared/qsimpleresource_p.h b/tools/designer/src/lib/shared/qsimpleresource_p.h
index 2608160..8569ef2 100644
--- a/tools/designer/src/lib/shared/qsimpleresource_p.h
+++ b/tools/designer/src/lib/shared/qsimpleresource_p.h
@@ -55,15 +55,21 @@
#include "shared_global_p.h"
#include "abstractformbuilder.h"
+#include <QtCore/QStringList>
QT_BEGIN_NAMESPACE
class DomScript;
+class DomCustomWidgets;
+class DomCustomWidget;
+class DomSlots;
class QDesignerFormEditorInterface;
namespace qdesigner_internal {
+class WidgetDataBaseItem;
+
class QDESIGNER_SHARED_EXPORT QSimpleResource : public QAbstractFormBuilder
{
public:
@@ -92,6 +98,11 @@ public:
static QString customWidgetScript(QDesignerFormEditorInterface *core, const QString &className);
static bool hasCustomWidgetScript(QDesignerFormEditorInterface *core, QObject *object);
+ // Implementation for FormBuilder::createDomCustomWidgets() that adds
+ // the custom widgets to the widget database
+ static void handleDomCustomWidgets(const QDesignerFormEditorInterface *core,
+ const DomCustomWidgets *dom_custom_widgets);
+
protected:
virtual QIcon nameToIcon(const QString &filePath, const QString &qrcPath);
virtual QString iconToFilePath(const QIcon &pm) const;
@@ -105,7 +116,13 @@ protected:
typedef QList<DomScript*> DomScripts;
static void addScript(const QString &script, ScriptSource source, DomScripts &domScripts);
+ static bool addFakeMethods(const DomSlots *domSlots, QStringList &fakeSlots, QStringList &fakeSignals);
+
private:
+ static void addCustomWidgetsToWidgetDatabase(const QDesignerFormEditorInterface *core,
+ QList<DomCustomWidget*>& custom_widget_list);
+ static void addFakeMethodsToWidgetDataBase(const DomCustomWidget *domCustomWidget, WidgetDataBaseItem *item);
+
static bool m_warningsEnabled;
QDesignerFormEditorInterface *m_core;
};
diff --git a/tools/designer/src/lib/shared/qtresourceview.cpp b/tools/designer/src/lib/shared/qtresourceview.cpp
index b6c3612..40be3e6 100644
--- a/tools/designer/src/lib/shared/qtresourceview.cpp
+++ b/tools/designer/src/lib/shared/qtresourceview.cpp
@@ -44,6 +44,7 @@
#include "qtresourcemodel_p.h"
#include "qtresourceeditordialog_p.h"
#include "iconloader_p.h"
+#include "filterwidget_p.h" // For FilterWidget
#include <QtDesigner/QDesignerFormEditorInterface>
@@ -144,6 +145,7 @@ public:
void slotReloadResources();
void slotCopyResourcePath();
void slotListWidgetContextMenuRequested(const QPoint &pos);
+ void slotFilterChanged(const QString &pattern);
void createPaths();
QTreeWidgetItem *createPath(const QString &path, QTreeWidgetItem *parent);
void createResources(const QString &path);
@@ -152,16 +154,20 @@ public:
void restoreSettings();
void saveSettings();
void updateActions();
+ void filterOutResources();
QPixmap makeThumbnail(const QPixmap &pix) const;
QDesignerFormEditorInterface *m_core;
QtResourceModel *m_resourceModel;
QToolBar *m_toolBar;
+ qdesigner_internal::FilterWidget *m_filterWidget;
QTreeWidget *m_treeWidget;
QListWidget *m_listWidget;
QSplitter *m_splitter;
- QMap<QString, QStringList> m_pathToContents; // full path to contents file names
+ QMap<QString, QStringList> m_pathToContents; // full path to contents file names (full path to its resource filenames)
+ QMap<QString, QString> m_pathToParentPath; // full path to full parent path
+ QMap<QString, QStringList> m_pathToSubPaths; // full path to full sub paths
QMap<QString, QTreeWidgetItem *> m_pathToItem;
QMap<QTreeWidgetItem *, QString> m_itemToPath;
QMap<QString, QListWidgetItem *> m_resourceToItem;
@@ -175,6 +181,7 @@ public:
bool m_ignoreGuiSignals;
QString m_settingsKey;
bool m_resourceEditingEnabled;
+ QString m_filterPattern;
};
QtResourceViewPrivate::QtResourceViewPrivate(QDesignerFormEditorInterface *core) :
@@ -251,6 +258,12 @@ void QtResourceViewPrivate::slotListWidgetContextMenuRequested(const QPoint &pos
menu.exec(m_listWidget->mapToGlobal(pos));
}
+void QtResourceViewPrivate::slotFilterChanged(const QString &pattern)
+{
+ m_filterPattern = pattern;
+ filterOutResources();
+}
+
void QtResourceViewPrivate::storeExpansionState()
{
QMapIterator<QString, QTreeWidgetItem *> it(m_pathToItem);
@@ -294,6 +307,7 @@ void QtResourceViewPrivate::updateActions()
m_editResourcesAction->setVisible(m_resourceEditingEnabled);
m_editResourcesAction->setEnabled(resourceActive);
m_reloadResourcesAction->setEnabled(resourceActive);
+ m_filterWidget->setEnabled(resourceActive);
}
void QtResourceViewPrivate::slotResourceSetActivated(QtResourceSet *resourceSet)
@@ -307,6 +321,8 @@ void QtResourceViewPrivate::slotResourceSetActivated(QtResourceSet *resourceSet)
const QString currentResource = m_itemToResource.value(m_listWidget->currentItem());
m_treeWidget->clear();
m_pathToContents.clear();
+ m_pathToParentPath.clear();
+ m_pathToSubPaths.clear();
m_pathToItem.clear();
m_itemToPath.clear();
m_listWidget->clear();
@@ -320,6 +336,7 @@ void QtResourceViewPrivate::slotResourceSetActivated(QtResourceSet *resourceSet)
q_ptr->selectResource(currentResource);
else if (!currentPath.isEmpty())
q_ptr->selectResource(currentPath);
+ filterOutResources();
}
void QtResourceViewPrivate::slotCurrentPathChanged(QTreeWidgetItem *item)
@@ -362,9 +379,6 @@ void QtResourceViewPrivate::createPaths()
const QString root(QLatin1Char(':'));
- QMap<QString, QString> pathToParentPath; // full path to full parent path
- QMap<QString, QStringList> pathToSubPaths; // full path to full sub paths
-
QMap<QString, QString> contents = m_resourceModel->contents();
QMapIterator<QString, QString> itContents(contents);
while (itContents.hasNext()) {
@@ -372,11 +386,11 @@ void QtResourceViewPrivate::createPaths()
const QFileInfo fi(filePath);
QString dirPath = fi.absolutePath();
m_pathToContents[dirPath].append(fi.fileName());
- while (!pathToParentPath.contains(dirPath) && dirPath != root) {
+ while (!m_pathToParentPath.contains(dirPath) && dirPath != root) { // create all parent paths
const QFileInfo fd(dirPath);
const QString parentDirPath = fd.absolutePath();
- pathToParentPath[dirPath] = parentDirPath;
- pathToSubPaths[parentDirPath].append(dirPath);
+ m_pathToParentPath[dirPath] = parentDirPath;
+ m_pathToSubPaths[parentDirPath].append(dirPath);
dirPath = parentDirPath;
}
}
@@ -387,13 +401,126 @@ void QtResourceViewPrivate::createPaths()
QPair<QString, QTreeWidgetItem *> pathToParentItem = pathToParentItemQueue.dequeue();
const QString path = pathToParentItem.first;
QTreeWidgetItem *item = createPath(path, pathToParentItem.second);
- QStringList subPaths = pathToSubPaths.value(path);
+ QStringList subPaths = m_pathToSubPaths.value(path);
QStringListIterator itSubPaths(subPaths);
while (itSubPaths.hasNext())
pathToParentItemQueue.enqueue(qMakePair(itSubPaths.next(), item));
}
}
+void QtResourceViewPrivate::filterOutResources()
+{
+ QMap<QString, bool> pathToMatchingContents; // true means the path has any matching contents
+ QMap<QString, bool> pathToVisible; // true means the path has to be shown
+
+ // 1) we go from root path recursively.
+ // 2) we check every path if it contains at least one matching resource - if empty we add it
+ // to pathToMatchingContents and pathToVisible with false, if non empty
+ // we add it with true and change every parent path in pathToVisible to true.
+ // 3) we hide these items which has pathToVisible value false.
+
+ const bool matchAll = m_filterPattern.isEmpty();
+ const QString root(QLatin1Char(':'));
+
+ QQueue<QString> pathQueue;
+ pathQueue.enqueue(root);
+ while (!pathQueue.isEmpty()) {
+ const QString path = pathQueue.dequeue();
+
+ QStringList fileNames = m_pathToContents.value(path);
+ QStringListIterator it(fileNames);
+ bool hasContents = matchAll;
+ if (!matchAll) { // the case filter is not empty - we check if the path contains anything
+ while (it.hasNext()) {
+ QString fileName = it.next();
+ hasContents = fileName.contains(m_filterPattern, Qt::CaseInsensitive);
+ if (hasContents) // the path contains at least one resource which matches the filter
+ break;
+ }
+ }
+
+ pathToMatchingContents[path] = hasContents;
+ pathToVisible[path] = hasContents;
+
+ if (hasContents) { // if the path is going to be shown we need to show all its parent paths
+ QString parentPath = m_pathToParentPath.value(path);
+ while (!parentPath.isEmpty()) {
+ QString p = parentPath;
+ if (pathToVisible.value(p)) // parent path is already shown, we break the loop
+ break;
+ pathToVisible[p] = true;
+ parentPath = m_pathToParentPath.value(p);
+ }
+ }
+
+ QStringList subPaths = m_pathToSubPaths.value(path); // we do the same for children paths
+ QStringListIterator itSubPaths(subPaths);
+ while (itSubPaths.hasNext())
+ pathQueue.enqueue(itSubPaths.next());
+ }
+
+ // we setup here new path and resource to be activated
+ const QString currentPath = m_itemToPath.value(m_treeWidget->currentItem());
+ QString newCurrentPath = currentPath;
+ QString currentResource = m_itemToResource.value(m_listWidget->currentItem());
+ if (!matchAll) {
+ bool searchForNewPathWithContents = true;
+
+ if (!currentPath.isEmpty()) { // if the currentPath is empty we will search for a new path too
+ QMap<QString, bool>::ConstIterator it = pathToMatchingContents.constFind(currentPath);
+ if (it != pathToMatchingContents.constEnd() && it.value()) // the current item has contents, we don't need to search for another path
+ searchForNewPathWithContents = false;
+ }
+
+ if (searchForNewPathWithContents) {
+ // we find the first path with the matching contents
+ QMap<QString, bool>::ConstIterator itContents = pathToMatchingContents.constBegin();
+ while (itContents != pathToMatchingContents.constEnd()) {
+ if (itContents.value()) {
+ newCurrentPath = itContents.key(); // the new path will be activated
+ break;
+ }
+
+ itContents++;
+ }
+ }
+
+ QFileInfo fi(currentResource);
+ if (!fi.fileName().contains(m_filterPattern, Qt::CaseInsensitive)) { // the case when the current resource is filtered out
+ const QStringList fileNames = m_pathToContents.value(newCurrentPath);
+ QStringListIterator it(fileNames);
+ while (it.hasNext()) { // we try to select the first matching resource from the newCurrentPath
+ QString fileName = it.next();
+ if (fileName.contains(m_filterPattern, Qt::CaseInsensitive)) {
+ QDir dirPath(newCurrentPath);
+ currentResource = dirPath.absoluteFilePath(fileName); // the new resource inside newCurrentPath will be activated
+ break;
+ }
+ }
+ }
+ }
+
+ QTreeWidgetItem *newCurrentItem = m_pathToItem.value(newCurrentPath);
+ if (currentPath != newCurrentPath)
+ m_treeWidget->setCurrentItem(newCurrentItem);
+ else
+ slotCurrentPathChanged(newCurrentItem); // trigger filtering on the current path
+
+ QListWidgetItem *currentResourceItem = m_resourceToItem.value(currentResource);
+ if (currentResourceItem) {
+ m_listWidget->setCurrentItem(currentResourceItem);
+ m_listWidget->scrollToItem(currentResourceItem);
+ }
+
+ QMapIterator<QString, bool> it(pathToVisible); // hide all paths filtered out
+ while (it.hasNext()) {
+ const QString path = it.next().key();
+ QTreeWidgetItem *item = m_pathToItem.value(path);
+ if (item)
+ item->setHidden(!it.value());
+ }
+}
+
QTreeWidgetItem *QtResourceViewPrivate::createPath(const QString &path, QTreeWidgetItem *parent)
{
QTreeWidgetItem *item = 0;
@@ -417,27 +544,32 @@ QTreeWidgetItem *QtResourceViewPrivate::createPath(const QString &path, QTreeWid
void QtResourceViewPrivate::createResources(const QString &path)
{
+ const bool matchAll = m_filterPattern.isEmpty();
+
QDir dir(path);
- QStringList files = m_pathToContents.value(path);
- QStringListIterator it(files);
+ QStringList fileNames = m_pathToContents.value(path);
+ QStringListIterator it(fileNames);
while (it.hasNext()) {
- QString file = it.next();
- QString filePath = dir.absoluteFilePath(file);
- QFileInfo fi(filePath);
- if (fi.isFile()) {
- QListWidgetItem *item = new QListWidgetItem(fi.fileName(), m_listWidget);
- const QPixmap pix = QPixmap(filePath);
- if (pix.isNull()) {
- item->setToolTip(filePath);
- } else {
- item->setIcon(QIcon(makeThumbnail(pix)));
- const QSize size = pix.size();
- item->setToolTip(QtResourceView::tr("Size: %1 x %2\n%3").arg(size.width()).arg(size.height()).arg(filePath));
+ QString fileName = it.next();
+ const bool showProperty = matchAll || fileName.contains(m_filterPattern, Qt::CaseInsensitive);
+ if (showProperty) {
+ QString filePath = dir.absoluteFilePath(fileName);
+ QFileInfo fi(filePath);
+ if (fi.isFile()) {
+ QListWidgetItem *item = new QListWidgetItem(fi.fileName(), m_listWidget);
+ const QPixmap pix = QPixmap(filePath);
+ if (pix.isNull()) {
+ item->setToolTip(filePath);
+ } else {
+ item->setIcon(QIcon(makeThumbnail(pix)));
+ const QSize size = pix.size();
+ item->setToolTip(QtResourceView::tr("Size: %1 x %2\n%3").arg(size.width()).arg(size.height()).arg(filePath));
+ }
+ item->setFlags(item->flags() | Qt::ItemIsDragEnabled);
+ item->setData(Qt::UserRole, filePath);
+ m_itemToResource[item] = filePath;
+ m_resourceToItem[filePath] = item;
}
- item->setFlags(item->flags() | Qt::ItemIsDragEnabled);
- item->setData(Qt::UserRole, filePath);
- m_itemToResource[item] = filePath;
- m_resourceToItem[filePath] = item;
}
}
}
@@ -464,6 +596,11 @@ QtResourceView::QtResourceView(QDesignerFormEditorInterface *core, QWidget *pare
connect(d_ptr->m_copyResourcePathAction, SIGNAL(triggered()), this, SLOT(slotCopyResourcePath()));
d_ptr->m_copyResourcePathAction->setEnabled(false);
+ //d_ptr->m_filterWidget = new qdesigner_internal::FilterWidget(0, qdesigner_internal::FilterWidget::LayoutAlignNone);
+ d_ptr->m_filterWidget = new qdesigner_internal::FilterWidget(d_ptr->m_toolBar);
+ d_ptr->m_toolBar->addWidget(d_ptr->m_filterWidget);
+ connect(d_ptr->m_filterWidget, SIGNAL(filterChanged(QString)), this, SLOT(slotFilterChanged(QString)));
+
d_ptr->m_splitter = new QSplitter;
d_ptr->m_splitter->setChildrenCollapsible(false);
d_ptr->m_splitter->addWidget(d_ptr->m_treeWidget);
diff --git a/tools/designer/src/lib/shared/qtresourceview_p.h b/tools/designer/src/lib/shared/qtresourceview_p.h
index 51a6353..fb8fb83 100644
--- a/tools/designer/src/lib/shared/qtresourceview_p.h
+++ b/tools/designer/src/lib/shared/qtresourceview_p.h
@@ -113,6 +113,7 @@ private:
Q_PRIVATE_SLOT(d_func(), void slotReloadResources())
Q_PRIVATE_SLOT(d_func(), void slotCopyResourcePath())
Q_PRIVATE_SLOT(d_func(), void slotListWidgetContextMenuRequested(const QPoint &pos))
+ Q_PRIVATE_SLOT(d_func(), void slotFilterChanged(const QString &pattern))
};
class QDESIGNER_SHARED_EXPORT QtResourceViewDialog : public QDialog
diff --git a/tools/designer/src/lib/shared/richtexteditor.cpp b/tools/designer/src/lib/shared/richtexteditor.cpp
index 6563358..a4df04f 100644
--- a/tools/designer/src/lib/shared/richtexteditor.cpp
+++ b/tools/designer/src/lib/shared/richtexteditor.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::RichTextEditorDialog
-*/
-
#include "richtexteditor_p.h"
#include "htmlhighlighter_p.h"
#include "iconselector_p.h"
diff --git a/tools/designer/src/lib/shared/scriptdialog.cpp b/tools/designer/src/lib/shared/scriptdialog.cpp
index 3cdf083..847afa3 100644
--- a/tools/designer/src/lib/shared/scriptdialog.cpp
+++ b/tools/designer/src/lib/shared/scriptdialog.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::ScriptDialog
-*/
-
#include "scriptdialog_p.h"
#include "qscripthighlighter_p.h"
diff --git a/tools/designer/src/lib/shared/scripterrordialog.cpp b/tools/designer/src/lib/shared/scripterrordialog.cpp
index f41b444..629fc4e 100644
--- a/tools/designer/src/lib/shared/scripterrordialog.cpp
+++ b/tools/designer/src/lib/shared/scripterrordialog.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::ScriptErrorDialog
-*/
-
#include "scripterrordialog_p.h"
#include <QtGui/QTextEdit>
diff --git a/tools/designer/src/lib/shared/stylesheeteditor.cpp b/tools/designer/src/lib/shared/stylesheeteditor.cpp
index c4e54aa..2066ad8 100644
--- a/tools/designer/src/lib/shared/stylesheeteditor.cpp
+++ b/tools/designer/src/lib/shared/stylesheeteditor.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::StyleSheetEditorDialog
-*/
-
#include "stylesheeteditor_p.h"
#include "csshighlighter_p.h"
#include "iconselector_p.h"
diff --git a/tools/designer/src/lib/shared/widgetfactory.cpp b/tools/designer/src/lib/shared/widgetfactory.cpp
index 6fabe18..6c45daf 100644
--- a/tools/designer/src/lib/shared/widgetfactory.cpp
+++ b/tools/designer/src/lib/shared/widgetfactory.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
-TRANSLATOR qdesigner_internal::WidgetFactory
-*/
-
#include "widgetfactory_p.h"
#include "widgetdatabase_p.h"
#include "metadatabase_p.h"
diff --git a/tools/designer/src/lib/shared/zoomwidget.cpp b/tools/designer/src/lib/shared/zoomwidget.cpp
index d37e814..08d6082 100644
--- a/tools/designer/src/lib/shared/zoomwidget.cpp
+++ b/tools/designer/src/lib/shared/zoomwidget.cpp
@@ -143,9 +143,10 @@ ZoomView::ZoomView(QWidget *parent) :
m_zoom(100),
m_zoomFactor(1.0),
m_zoomContextMenuEnabled(false),
- m_autoScrollSuppressed(true),
m_zoomMenu(0)
{
+ setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setFrameShape(QFrame::NoFrame);
setScene(m_scene);
if (debugZoomWidget)
@@ -187,8 +188,6 @@ void ZoomView::setZoom(int percent)
resetTransform();
scale(m_zoomFactor, m_zoomFactor);
- if (m_autoScrollSuppressed)
- scrollToOrigin();
}
void ZoomView::applyZoom()
@@ -210,16 +209,6 @@ void ZoomView::setZoomContextMenuEnabled(bool e)
m_zoomContextMenuEnabled = e;
}
-bool ZoomView::isAutoScrollSuppressed() const
-{
- return m_autoScrollSuppressed;
-}
-
-void ZoomView::setAutoScrollSuppressed(bool s)
-{
- m_autoScrollSuppressed = s;
-}
-
ZoomMenu *ZoomView::zoomMenu()
{
if (!m_zoomMenu) {
@@ -469,13 +458,16 @@ void ZoomWidget::resizeEvent(QResizeEvent *event)
* and the use the size ZoomView::resizeEvent(event); */
if (m_proxy && !m_viewResizeBlocked) {
if (debugZoomWidget > 1)
- qDebug() << ">ZoomWidget (" << size() << ")::resizeEvent from " << event->oldSize() << " to " << event->size();
+ qDebug() << '>' << Q_FUNC_INFO << size() << ")::resizeEvent from " << event->oldSize() << " to " << event->size();
const QSizeF newViewPortSize = size() - viewPortMargin();
const QSizeF widgetSizeF = newViewPortSize / zoomFactor() - widgetDecorationSizeF();
m_widgetResizeBlocked = true;
m_proxy->widget()->resize(widgetSizeF.toSize());
+ setSceneRect(QRectF(QPointF(0, 0), widgetSizeF));
scrollToOrigin();
m_widgetResizeBlocked = false;
+ if (debugZoomWidget > 1)
+ qDebug() << '<' << Q_FUNC_INFO << widgetSizeF << m_proxy->widget()->size() << m_proxy->size();
}
}
@@ -559,7 +551,7 @@ QGraphicsProxyWidget *ZoomWidget::createProxyWidget(QGraphicsItem *parent, Qt::W
void ZoomWidget::dump() const
{
- qDebug() << "ZoomWidget " << geometry() << " Viewport " << viewport()->geometry()
+ qDebug() << "ZoomWidget::dump " << geometry() << " Viewport " << viewport()->geometry()
<< "Scroll: " << scrollPosition() << "Matrix: " << matrix() << " SceneRect: " << sceneRect();
if (m_proxy) {
qDebug() << "Proxy Pos: " << m_proxy->pos() << "Proxy " << m_proxy->size()
diff --git a/tools/designer/src/lib/shared/zoomwidget_p.h b/tools/designer/src/lib/shared/zoomwidget_p.h
index 83b2972..8d5e07c 100644
--- a/tools/designer/src/lib/shared/zoomwidget_p.h
+++ b/tools/designer/src/lib/shared/zoomwidget_p.h
@@ -104,8 +104,6 @@ class QDESIGNER_SHARED_EXPORT ZoomView : public QGraphicsView
{
Q_PROPERTY(int zoom READ zoom WRITE setZoom DESIGNABLE true SCRIPTABLE true)
Q_PROPERTY(bool zoomContextMenuEnabled READ isZoomContextMenuEnabled WRITE setZoomContextMenuEnabled DESIGNABLE true SCRIPTABLE true)
- Q_PROPERTY(bool autoScrollSuppressed READ isAutoScrollSuppressed WRITE setAutoScrollSuppressed DESIGNABLE true SCRIPTABLE true)
-
Q_OBJECT
Q_DISABLE_COPY(ZoomView)
public:
@@ -120,10 +118,6 @@ public:
bool isZoomContextMenuEnabled() const;
void setZoomContextMenuEnabled(bool e);
- // Suppress scrolling when changing zoom. Default: on
- bool isAutoScrollSuppressed() const;
- void setAutoScrollSuppressed(bool s);
-
QGraphicsScene &scene() { return *m_scene; }
const QGraphicsScene &scene() const { return *m_scene; }
@@ -149,8 +143,7 @@ private:
int m_zoom;
qreal m_zoomFactor;
- bool m_zoomContextMenuEnabled;
- bool m_autoScrollSuppressed;
+ bool m_zoomContextMenuEnabled;
bool m_resizeBlocked;
ZoomMenu *m_zoomMenu;
};
diff --git a/tools/designer/src/lib/uilib/abstractformbuilder.cpp b/tools/designer/src/lib/uilib/abstractformbuilder.cpp
index e15e5ac..05e05c1 100644
--- a/tools/designer/src/lib/uilib/abstractformbuilder.cpp
+++ b/tools/designer/src/lib/uilib/abstractformbuilder.cpp
@@ -135,7 +135,7 @@ public:
QAbstractFormBuilder provides a standard interface and a default
implementation for constructing forms from user interface
files. It is not intended to be instantiated directly. Use the
- QFormBuilder class to create user interfaces from \c{.ui} files at
+ QFormBuilder class to create user interfaces from UI files at
run-time. For example:
\snippet doc/src/snippets/code/tools_designer_src_lib_uilib_abstractformbuilder.cpp 0
@@ -145,10 +145,10 @@ public:
functions:
\list
- \o load() handles reading of \c{.ui} format files from arbitrary
+ \o load() handles reading of UI format files from arbitrary
QIODevices, and construction of widgets from the XML data
that they contain.
- \o save() handles saving of widget details in \c{.ui} format to
+ \o save() handles saving of widget details in UI format to
arbitrary QIODevices.
\o workingDirectory() and setWorkingDirectory() control the
directory in which forms are held. The form builder looks for
@@ -208,13 +208,13 @@ QWidget *QAbstractFormBuilder::load(QIODevice *dev, QWidget *parentWidget)
}
}
if (reader.hasError()) {
- uiLibWarning(QCoreApplication::translate("QAbstractFormBuilder", "An error has occurred while reading the ui file at line %1, column %2: %3")
+ uiLibWarning(QCoreApplication::translate("QAbstractFormBuilder", "An error has occurred while reading the UI file at line %1, column %2: %3")
.arg(reader.lineNumber()).arg(reader.columnNumber())
.arg(reader.errorString()));
return 0;
}
if (!initialized) {
- uiLibWarning(QCoreApplication::translate("QAbstractFormBuilder", "Invalid ui file: The root element <ui> is missing."));
+ uiLibWarning(QCoreApplication::translate("QAbstractFormBuilder", "Invalid UI file: The root element <ui> is missing."));
return 0;
}
@@ -403,6 +403,7 @@ QAction *QAbstractFormBuilder::create(DomAction *ui_action, QObject *parent)
if (!a)
return 0;
+ m_actions.insert(ui_action->attributeName(), a);
applyProperties(a, ui_action->elementProperty());
return a;
}
@@ -415,7 +416,7 @@ QActionGroup *QAbstractFormBuilder::create(DomActionGroup *ui_action_group, QObj
QActionGroup *a = createActionGroup(parent, ui_action_group->attributeName());
if (!a)
return 0;
-
+ m_actionGroups.insert(ui_action_group->attributeName(), a);
applyProperties(a, ui_action_group->elementProperty());
foreach (DomAction *ui_action, ui_action_group->elementAction()) {
@@ -656,7 +657,7 @@ void QAbstractFormBuilder::layoutInfo(DomLayout *ui_layout, QObject *parent, int
spac = p->elementNumber();
#ifdef Q_OS_MAC
- // here we recognize ui file < 4.3 (no we don't store margin property)
+ // here we recognize UI file < 4.3 (no we don't store margin property)
if (mar != INT_MIN) {
const int defaultMargin = parent->inherits("QLayoutWidget") ? 0 : 9;
if (mar == defaultMargin)
@@ -1184,8 +1185,6 @@ QAction *QAbstractFormBuilder::createAction(QObject *parent, const QString &name
{
QAction *action = new QAction(parent);
action->setObjectName(name);
- m_actions.insert(name, action);
-
return action;
}
@@ -1196,8 +1195,6 @@ QActionGroup *QAbstractFormBuilder::createActionGroup(QObject *parent, const QSt
{
QActionGroup *g = new QActionGroup(parent);
g->setObjectName(name);
- m_actionGroups.insert(name, g);
-
return g;
}
@@ -1205,7 +1202,7 @@ QActionGroup *QAbstractFormBuilder::createActionGroup(QObject *parent, const QSt
\fn void QAbstractFormBuilder::save(QIODevice *device, QWidget *widget)
Saves an XML representation of the given \a widget to the
- specified \a device in the standard \c{.ui} file format.
+ specified \a device in the standard UI file format.
\sa load()*/
void QAbstractFormBuilder::save(QIODevice *dev, QWidget *widget)
diff --git a/tools/designer/src/lib/uilib/formbuilder.cpp b/tools/designer/src/lib/uilib/formbuilder.cpp
index a627e74..f737311 100644
--- a/tools/designer/src/lib/uilib/formbuilder.cpp
+++ b/tools/designer/src/lib/uilib/formbuilder.cpp
@@ -57,12 +57,12 @@ namespace QFormInternal {
\class QFormBuilder
\brief The QFormBuilder class is used to dynamically construct
- user interfaces from .ui files at run-time.
+ user interfaces from UI files at run-time.
\inmodule QtDesigner
The QFormBuilder class provides a mechanism for dynamically
- creating user interfaces at run-time, based on \c{.ui} files
+ creating user interfaces at run-time, based on UI files
created with \QD. For example:
\snippet doc/src/snippets/code/tools_designer_src_lib_uilib_formbuilder.cpp 0
@@ -120,7 +120,10 @@ QFormBuilder::~QFormBuilder()
*/
QWidget *QFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidget)
{
- QFormBuilderExtra::instance(this)->setProcessingLayoutWidget(false);
+ QFormBuilderExtra *fb = QFormBuilderExtra::instance(this);
+ if (!fb->parentWidgetIsSet())
+ fb->setParentWidget(parentWidget);
+ fb->setProcessingLayoutWidget(false);
if (ui_widget->attributeClass() == QFormBuilderStrings::instance().qWidgetClass && !ui_widget->hasAttributeNative()
&& parentWidget
#ifndef QT_NO_MAINWINDOW
@@ -145,7 +148,7 @@ QWidget *QFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidget)
&& !qobject_cast<QDockWidget *>(parentWidget)
#endif
)
- QFormBuilderExtra::instance(this)->setProcessingLayoutWidget(true);
+ fb->setProcessingLayoutWidget(true);
return QAbstractFormBuilder::create(ui_widget, parentWidget);
}
@@ -228,9 +231,6 @@ QWidget *QFormBuilder::createWidget(const QString &widgetName, QWidget *parentWi
if (qobject_cast<QDialog *>(w))
w->setParent(parentWidget);
- if (!fb->rootWidget())
- fb->setRootWidget(w);
-
return w;
}
@@ -369,9 +369,10 @@ QWidget *QFormBuilder::create(DomUI *ui, QWidget *parentWidget)
*/
QLayout *QFormBuilder::create(DomLayout *ui_layout, QLayout *layout, QWidget *parentWidget)
{
+ QFormBuilderExtra *fb = QFormBuilderExtra::instance(this);
// Is this a temporary layout widget used to represent QLayout hierarchies in Designer?
// Set its margins to 0.
- bool layoutWidget = QFormBuilderExtra::instance(this)->processingLayoutWidget();
+ bool layoutWidget = fb->processingLayoutWidget();
QLayout *l = QAbstractFormBuilder::create(ui_layout, layout, parentWidget);
if (layoutWidget) {
const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
@@ -392,7 +393,7 @@ QLayout *QFormBuilder::create(DomLayout *ui_layout, QLayout *layout, QWidget *pa
bottom = prop->elementNumber();
l->setContentsMargins(left, top, right, bottom);
- QFormBuilderExtra::instance(this)->setProcessingLayoutWidget(false);
+ fb->setProcessingLayoutWidget(false);
}
return l;
}
@@ -525,6 +526,7 @@ QList<QDesignerCustomWidgetInterface*> QFormBuilder::customWidgets() const
/*!
\internal
*/
+
void QFormBuilder::applyProperties(QObject *o, const QList<DomProperty*> &properties)
{
typedef QList<DomProperty*> DomPropertyList;
@@ -542,11 +544,12 @@ void QFormBuilder::applyProperties(QObject *o, const QList<DomProperty*> &proper
continue;
const QString attributeName = (*it)->attributeName();
- if (o == fb->rootWidget() && attributeName == strings.geometryProperty) {
- // apply only the size for the rootWidget
- fb->rootWidget()->resize(qvariant_cast<QRect>(v).size());
+ const bool isWidget = o->isWidgetType();
+ if (isWidget && o->parent() == fb->parentWidget() && attributeName == strings.geometryProperty) {
+ // apply only the size part of a geometry for the root widget
+ static_cast<QWidget*>(o)->resize(qvariant_cast<QRect>(v).size());
} else if (fb->applyPropertyInternally(o, attributeName, v)) {
- } else if (!qstrcmp("QFrame", o->metaObject()->className ()) && attributeName == strings.orientationProperty) {
+ } else if (isWidget && !qstrcmp("QFrame", o->metaObject()->className ()) && attributeName == strings.orientationProperty) {
// ### special-casing for Line (QFrame) -- try to fix me
o->setProperty("frameShape", v); // v is of QFrame::Shape enum
} else {
diff --git a/tools/designer/src/lib/uilib/formbuilderextra.cpp b/tools/designer/src/lib/uilib/formbuilderextra.cpp
index 87491b7..c07d253 100644
--- a/tools/designer/src/lib/uilib/formbuilderextra.cpp
+++ b/tools/designer/src/lib/uilib/formbuilderextra.cpp
@@ -81,7 +81,8 @@ QFormBuilderExtra::~QFormBuilderExtra()
void QFormBuilderExtra::clear()
{
m_buddies.clear();
- m_rootWidget = 0;
+ m_parentWidget = 0;
+ m_parentWidgetIsSet = false;
#ifndef QT_FORMBUILDER_NO_SCRIPT
m_FormScriptRunner.clearErrors();
m_customWidgetScriptHash.clear();
@@ -136,14 +137,21 @@ bool QFormBuilderExtra::applyBuddy(const QString &buddyName, BuddyMode applyMode
return false;
}
-const QPointer<QWidget> &QFormBuilderExtra::rootWidget() const
+const QPointer<QWidget> &QFormBuilderExtra::parentWidget() const
{
- return m_rootWidget;
+ return m_parentWidget;
}
-void QFormBuilderExtra::setRootWidget(const QPointer<QWidget> &w)
+bool QFormBuilderExtra::parentWidgetIsSet() const
{
- m_rootWidget = w;
+ return m_parentWidgetIsSet;
+}
+
+void QFormBuilderExtra::setParentWidget(const QPointer<QWidget> &w)
+{
+ // Parent widget requires special handling of the geometry property.
+ m_parentWidget = w;
+ m_parentWidgetIsSet = true;
}
#ifndef QT_FORMBUILDER_NO_SCRIPT
diff --git a/tools/designer/src/lib/uilib/formbuilderextra_p.h b/tools/designer/src/lib/uilib/formbuilderextra_p.h
index ec06050..418c70c 100644
--- a/tools/designer/src/lib/uilib/formbuilderextra_p.h
+++ b/tools/designer/src/lib/uilib/formbuilderextra_p.h
@@ -101,8 +101,9 @@ public:
void applyInternalProperties() const;
static bool applyBuddy(const QString &buddyName, BuddyMode applyMode, QLabel *label);
- const QPointer<QWidget> &rootWidget() const;
- void setRootWidget(const QPointer<QWidget> &w);
+ const QPointer<QWidget> &parentWidget() const;
+ bool parentWidgetIsSet() const;
+ void setParentWidget(const QPointer<QWidget> &w);
#ifndef QT_FORMBUILDER_NO_SCRIPT
QFormScriptRunner &formScriptRunner();
@@ -182,7 +183,8 @@ private:
QResourceBuilder *m_resourceBuilder;
QTextBuilder *m_textBuilder;
- QPointer<QWidget> m_rootWidget;
+ QPointer<QWidget> m_parentWidget;
+ bool m_parentWidgetIsSet;
};
void uiLibWarning(const QString &message);
diff --git a/tools/designer/src/lib/uilib/ui4.cpp b/tools/designer/src/lib/uilib/ui4.cpp
index 7faee24..1578155 100644
--- a/tools/designer/src/lib/uilib/ui4.cpp
+++ b/tools/designer/src/lib/uilib/ui4.cpp
@@ -2368,6 +2368,7 @@ void DomCustomWidget::clear(bool clear_all)
delete m_script;
delete m_properties;
delete m_slots;
+ delete m_propertyspecifications;
if (clear_all) {
m_text.clear();
@@ -2381,6 +2382,7 @@ void DomCustomWidget::clear(bool clear_all)
m_script = 0;
m_properties = 0;
m_slots = 0;
+ m_propertyspecifications = 0;
}
DomCustomWidget::DomCustomWidget()
@@ -2393,6 +2395,7 @@ DomCustomWidget::DomCustomWidget()
m_script = 0;
m_properties = 0;
m_slots = 0;
+ m_propertyspecifications = 0;
}
DomCustomWidget::~DomCustomWidget()
@@ -2403,6 +2406,7 @@ DomCustomWidget::~DomCustomWidget()
delete m_script;
delete m_properties;
delete m_slots;
+ delete m_propertyspecifications;
}
void DomCustomWidget::read(QXmlStreamReader &reader)
@@ -2468,6 +2472,12 @@ void DomCustomWidget::read(QXmlStreamReader &reader)
setElementSlots(v);
continue;
}
+ if (tag == QLatin1String("propertyspecifications")) {
+ DomPropertySpecifications *v = new DomPropertySpecifications();
+ v->read(reader);
+ setElementPropertyspecifications(v);
+ continue;
+ }
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
@@ -2548,6 +2558,12 @@ void DomCustomWidget::read(const QDomElement &node)
setElementSlots(v);
continue;
}
+ if (tag == QLatin1String("propertyspecifications")) {
+ DomPropertySpecifications *v = new DomPropertySpecifications();
+ v->read(e);
+ setElementPropertyspecifications(v);
+ continue;
+ }
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
@@ -2605,6 +2621,10 @@ void DomCustomWidget::write(QXmlStreamWriter &writer, const QString &tagName) co
m_slots->write(writer, QLatin1String("slots"));
}
+ if (m_children & Propertyspecifications) {
+ m_propertyspecifications->write(writer, QLatin1String("propertyspecifications"));
+ }
+
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -2731,6 +2751,21 @@ void DomCustomWidget::setElementSlots(DomSlots* a)
m_slots = a;
}
+DomPropertySpecifications* DomCustomWidget::takeElementPropertyspecifications()
+{
+ DomPropertySpecifications* a = m_propertyspecifications;
+ m_propertyspecifications = 0;
+ m_children ^= Propertyspecifications;
+ return a;
+}
+
+void DomCustomWidget::setElementPropertyspecifications(DomPropertySpecifications* a)
+{
+ delete m_propertyspecifications;
+ m_children |= Propertyspecifications;
+ m_propertyspecifications = a;
+}
+
void DomCustomWidget::clearElementClass()
{
m_children &= ~Class;
@@ -2798,6 +2833,13 @@ void DomCustomWidget::clearElementSlots()
m_children &= ~Slots;
}
+void DomCustomWidget::clearElementPropertyspecifications()
+{
+ delete m_propertyspecifications;
+ m_propertyspecifications = 0;
+ m_children &= ~Propertyspecifications;
+}
+
void DomProperties::clear(bool clear_all)
{
qDeleteAll(m_property);
@@ -10883,5 +10925,208 @@ void DomSlots::setElementSlot(const QStringList& a)
m_slot = a;
}
+void DomPropertySpecifications::clear(bool clear_all)
+{
+ qDeleteAll(m_stringpropertyspecification);
+ m_stringpropertyspecification.clear();
+
+ if (clear_all) {
+ m_text.clear();
+ }
+
+ m_children = 0;
+}
+
+DomPropertySpecifications::DomPropertySpecifications()
+{
+ m_children = 0;
+}
+
+DomPropertySpecifications::~DomPropertySpecifications()
+{
+ qDeleteAll(m_stringpropertyspecification);
+ m_stringpropertyspecification.clear();
+}
+
+void DomPropertySpecifications::read(QXmlStreamReader &reader)
+{
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("stringpropertyspecification")) {
+ DomStringPropertySpecification *v = new DomStringPropertySpecification();
+ v->read(reader);
+ m_stringpropertyspecification.append(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomPropertySpecifications::read(const QDomElement &node)
+{
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("stringpropertyspecification")) {
+ DomStringPropertySpecification *v = new DomStringPropertySpecification();
+ v->read(e);
+ m_stringpropertyspecification.append(v);
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomPropertySpecifications::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("propertyspecifications") : tagName.toLower());
+
+ for (int i = 0; i < m_stringpropertyspecification.size(); ++i) {
+ DomStringPropertySpecification* v = m_stringpropertyspecification[i];
+ v->write(writer, QLatin1String("stringpropertyspecification"));
+ }
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomPropertySpecifications::setElementStringpropertyspecification(const QList<DomStringPropertySpecification*>& a)
+{
+ m_children |= Stringpropertyspecification;
+ m_stringpropertyspecification = a;
+}
+
+void DomStringPropertySpecification::clear(bool clear_all)
+{
+
+ if (clear_all) {
+ m_text.clear();
+ m_has_attr_name = false;
+ m_has_attr_type = false;
+ m_has_attr_notr = false;
+ }
+
+ m_children = 0;
+}
+
+DomStringPropertySpecification::DomStringPropertySpecification()
+{
+ m_children = 0;
+ m_has_attr_name = false;
+ m_has_attr_type = false;
+ m_has_attr_notr = false;
+}
+
+DomStringPropertySpecification::~DomStringPropertySpecification()
+{
+}
+
+void DomStringPropertySpecification::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("name")) {
+ setAttributeName(attribute.value().toString());
+ continue;
+ }
+ if (name == QLatin1String("type")) {
+ setAttributeType(attribute.value().toString());
+ continue;
+ }
+ if (name == QLatin1String("notr")) {
+ setAttributeNotr(attribute.value().toString());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomStringPropertySpecification::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("name")))
+ setAttributeName(node.attribute(QLatin1String("name")));
+ if (node.hasAttribute(QLatin1String("type")))
+ setAttributeType(node.attribute(QLatin1String("type")));
+ if (node.hasAttribute(QLatin1String("notr")))
+ setAttributeNotr(node.attribute(QLatin1String("notr")));
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomStringPropertySpecification::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("stringpropertyspecification") : tagName.toLower());
+
+ if (hasAttributeName())
+ writer.writeAttribute(QLatin1String("name"), attributeName());
+
+ if (hasAttributeType())
+ writer.writeAttribute(QLatin1String("type"), attributeType());
+
+ if (hasAttributeNotr())
+ writer.writeAttribute(QLatin1String("notr"), attributeNotr());
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
QT_END_NAMESPACE
diff --git a/tools/designer/src/lib/uilib/ui4_p.h b/tools/designer/src/lib/uilib/ui4_p.h
index 505c61b..3c53d13 100644
--- a/tools/designer/src/lib/uilib/ui4_p.h
+++ b/tools/designer/src/lib/uilib/ui4_p.h
@@ -161,6 +161,8 @@ class DomScript;
class DomWidgetData;
class DomDesignerData;
class DomSlots;
+class DomPropertySpecifications;
+class DomStringPropertySpecification;
/*******************************************************************************
** Declarations
@@ -1015,6 +1017,12 @@ public:
inline bool hasElementSlots() const { return m_children & Slots; }
void clearElementSlots();
+ inline DomPropertySpecifications* elementPropertyspecifications() const { return m_propertyspecifications; }
+ DomPropertySpecifications* takeElementPropertyspecifications();
+ void setElementPropertyspecifications(DomPropertySpecifications* a);
+ inline bool hasElementPropertyspecifications() const { return m_children & Propertyspecifications; }
+ void clearElementPropertyspecifications();
+
private:
QString m_text;
void clear(bool clear_all = true);
@@ -1033,6 +1041,7 @@ private:
DomScript* m_script;
DomProperties* m_properties;
DomSlots* m_slots;
+ DomPropertySpecifications* m_propertyspecifications;
enum Child {
Class = 1,
Extends = 2,
@@ -1044,7 +1053,8 @@ private:
Pixmap = 128,
Script = 256,
Properties = 512,
- Slots = 1024
+ Slots = 1024,
+ Propertyspecifications = 2048
};
DomCustomWidget(const DomCustomWidget &other);
@@ -3686,6 +3696,91 @@ private:
void operator = (const DomSlots&other);
};
+class QDESIGNER_UILIB_EXPORT DomPropertySpecifications {
+public:
+ DomPropertySpecifications();
+ ~DomPropertySpecifications();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ // child element accessors
+ inline QList<DomStringPropertySpecification*> elementStringpropertyspecification() const { return m_stringpropertyspecification; }
+ void setElementStringpropertyspecification(const QList<DomStringPropertySpecification*>& a);
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ // child element data
+ uint m_children;
+ QList<DomStringPropertySpecification*> m_stringpropertyspecification;
+ enum Child {
+ Stringpropertyspecification = 1
+ };
+
+ DomPropertySpecifications(const DomPropertySpecifications &other);
+ void operator = (const DomPropertySpecifications&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomStringPropertySpecification {
+public:
+ DomStringPropertySpecification();
+ ~DomStringPropertySpecification();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributeName() const { return m_has_attr_name; }
+ inline QString attributeName() const { return m_attr_name; }
+ inline void setAttributeName(const QString& a) { m_attr_name = a; m_has_attr_name = true; }
+ inline void clearAttributeName() { m_has_attr_name = false; }
+
+ inline bool hasAttributeType() const { return m_has_attr_type; }
+ inline QString attributeType() const { return m_attr_type; }
+ inline void setAttributeType(const QString& a) { m_attr_type = a; m_has_attr_type = true; }
+ inline void clearAttributeType() { m_has_attr_type = false; }
+
+ inline bool hasAttributeNotr() const { return m_has_attr_notr; }
+ inline QString attributeNotr() const { return m_attr_notr; }
+ inline void setAttributeNotr(const QString& a) { m_attr_notr = a; m_has_attr_notr = true; }
+ inline void clearAttributeNotr() { m_has_attr_notr = false; }
+
+ // child element accessors
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ QString m_attr_name;
+ bool m_has_attr_name;
+
+ QString m_attr_type;
+ bool m_has_attr_type;
+
+ QString m_attr_notr;
+ bool m_has_attr_notr;
+
+ // child element data
+ uint m_children;
+
+ DomStringPropertySpecification(const DomStringPropertySpecification &other);
+ void operator = (const DomStringPropertySpecification&other);
+};
+
#ifdef QFORMINTERNAL_NAMESPACE
}
diff --git a/tools/designer/src/plugins/activeqt/qaxwidgettaskmenu.cpp b/tools/designer/src/plugins/activeqt/qaxwidgettaskmenu.cpp
index 1158e35..1cbf1c1 100644
--- a/tools/designer/src/plugins/activeqt/qaxwidgettaskmenu.cpp
+++ b/tools/designer/src/plugins/activeqt/qaxwidgettaskmenu.cpp
@@ -162,7 +162,7 @@ void QAxWidgetTaskMenu::setActiveXControl()
tr("The control requires a design-time license"));
clsid = QUuid();
} else {
- key = QString::fromUtf16((ushort *)bKey);
+ key = QString::fromWCharArray(bKey);
}
cf2->Release();
diff --git a/tools/designer/src/uitools/quiloader.cpp b/tools/designer/src/uitools/quiloader.cpp
index 48e142b..1c7d1cc 100644
--- a/tools/designer/src/uitools/quiloader.cpp
+++ b/tools/designer/src/uitools/quiloader.cpp
@@ -574,20 +574,20 @@ void QUiLoaderPrivate::setupWidgetMap() const
\brief The QUiLoader class enables standalone applications to
dynamically create user interfaces at run-time using the
- information stored in .ui files or specified in plugin paths.
+ information stored in UI files or specified in plugin paths.
In addition, you can customize or create your own user interface by
deriving your own loader class.
If you have a custom component or an application that embeds \QD, you can
also use the QFormBuilder class provided by the QtDesigner module to create
- user interfaces from \c{.ui} files.
+ user interfaces from UI files.
The QUiLoader class provides a collection of functions allowing you to
- create widgets based on the information stored in \c .ui files (created
+ create widgets based on the information stored in UI files (created
with \QD) or available in the specified plugin paths. The specified plugin
paths can be retrieved using the pluginPaths() function. Similarly, the
- contents of a \c{.ui} file can be retrieved using the load() function. For
+ contents of a UI file can be retrieved using the load() function. For
example:
\snippet doc/src/snippets/quiloader/mywidget.cpp 0
@@ -613,8 +613,7 @@ void QUiLoaderPrivate::setupWidgetMap() const
reason, you can subclass the QUiLoader class and reimplement these
functions to intervene the process of constructing a user interface. For
example, you might want to have a list of the actions created when loading
- a form or creating a custom widget. However, in your reimplementation, you
- must call QUiLoader's original implementation of these functions first.
+ a form or creating a custom widget.
For a complete example using the QUiLoader class, see the
\l{Calculator Builder Example}.