summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-04-14 01:20:24 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-04-14 01:20:24 (GMT)
commit0def696a8d569f0895010706fb989e78b25c13c1 (patch)
tree56834f2d8df43b797fc842529f8499b4493c66bc /tools
parentc46c06d363b7c90fecd84e7ef333ffa449f1d71c (diff)
parent6f8364ac0c128eb8afe897b5d8f3f4e26b9105f5 (diff)
downloadQt-0def696a8d569f0895010706fb989e78b25c13c1.zip
Qt-0def696a8d569f0895010706fb989e78b25c13c1.tar.gz
Qt-0def696a8d569f0895010706fb989e78b25c13c1.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-multimedia-staging into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-multimedia-staging: Fix writing duplicate headers' properties in designer. Fix dealing with the default dynamic properties of string type. Use unifiedToolBarOnMac, by default don't show some tool action.
Diffstat (limited to 'tools')
-rw-r--r--tools/designer/src/components/formeditor/qdesigner_resource.cpp61
-rw-r--r--tools/designer/src/components/formeditor/qdesigner_resource.h4
-rw-r--r--tools/designer/src/designer/mainwindow.cpp20
-rw-r--r--tools/designer/src/designer/qdesigner_actions.cpp19
-rw-r--r--tools/designer/src/designer/qdesigner_actions.h4
-rw-r--r--tools/designer/src/designer/qdesigner_workbench.cpp1
-rw-r--r--tools/designer/src/lib/shared/qdesigner_propertysheet.cpp22
7 files changed, 58 insertions, 73 deletions
diff --git a/tools/designer/src/components/formeditor/qdesigner_resource.cpp b/tools/designer/src/components/formeditor/qdesigner_resource.cpp
index b659179..1d78695 100644
--- a/tools/designer/src/components/formeditor/qdesigner_resource.cpp
+++ b/tools/designer/src/components/formeditor/qdesigner_resource.cpp
@@ -53,7 +53,6 @@
#include "qtresourcemodel_p.h"
#include "qmdiarea_container.h"
#include "qwizard_container.h"
-#include "itemview_propertysheet.h"
#include "layout_propertysheet.h"
#include <ui4_p.h>
@@ -106,8 +105,6 @@
#include <QtGui/QMenuBar>
#include <QtGui/QFileDialog>
#include <QtGui/QHeaderView>
-#include <QtGui/QTreeView>
-#include <QtGui/QTableView>
#include <QtGui/QWizardPage>
#include <private/qlayoutengine_p.h>
@@ -1275,10 +1272,6 @@ DomWidget *QDesignerResource::createDom(QWidget *widget, DomWidget *ui_parentWid
w = saveWidget(dockWidget, ui_parentWidget);
else if (QDesignerContainerExtension *container = qt_extension<QDesignerContainerExtension*>(core()->extensionManager(), widget))
w = saveWidget(widget, container, ui_parentWidget);
- else if (QTreeView *treeView = qobject_cast<QTreeView*>(widget))
- w = saveWidget(treeView, ui_parentWidget);
- else if (QTableView *tableView = qobject_cast<QTableView*>(widget))
- w = saveWidget(tableView, ui_parentWidget);
else if (QWizardPage *wizardPage = qobject_cast<QWizardPage*>(widget))
w = saveWidget(wizardPage, ui_parentWidget);
else
@@ -1553,60 +1546,6 @@ DomWidget *QDesignerResource::saveWidget(QDesignerDockWidget *dockWidget, DomWid
return ui_widget;
}
-DomWidget *QDesignerResource::saveWidget(QTreeView *treeView, DomWidget *ui_parentWidget)
-{
- DomWidget *ui_widget = QAbstractFormBuilder::createDom(treeView, ui_parentWidget, true);
-
- QDesignerPropertySheetExtension *sheet
- = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), treeView);
- ItemViewPropertySheet *itemViewSheet = static_cast<ItemViewPropertySheet*>(sheet);
-
- if (itemViewSheet) {
- QHash<QString,QString> nameMap = itemViewSheet->propertyNameMap();
- foreach (const QString &fakeName, nameMap.keys()) {
- int index = itemViewSheet->indexOf(fakeName);
- if (sheet->isChanged(index)) {
- DomProperty *domAttr = createProperty(treeView->header(), nameMap.value(fakeName),
- itemViewSheet->property(index));
- domAttr->setAttributeName(fakeName);
- ui_widget->setElementAttribute(ui_widget->elementAttribute() << domAttr);
- }
- }
- }
-
- return ui_widget;
-}
-
-DomWidget *QDesignerResource::saveWidget(QTableView *tableView, DomWidget *ui_parentWidget)
-{
- DomWidget *ui_widget = QAbstractFormBuilder::createDom(tableView, ui_parentWidget, true);
-
- QDesignerPropertySheetExtension *sheet
- = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), tableView);
- ItemViewPropertySheet *itemViewSheet = static_cast<ItemViewPropertySheet*>(sheet);
-
- if (itemViewSheet) {
- QHash<QString,QString> nameMap = itemViewSheet->propertyNameMap();
- foreach (const QString &fakeName, nameMap.keys()) {
- int index = itemViewSheet->indexOf(fakeName);
- if (sheet->isChanged(index)) {
- DomProperty *domAttr;
- if (fakeName.startsWith(QLatin1String("horizontal"))) {
- domAttr = createProperty(tableView->horizontalHeader(), nameMap.value(fakeName),
- itemViewSheet->property(index));
- } else {
- domAttr = createProperty(tableView->verticalHeader(), nameMap.value(fakeName),
- itemViewSheet->property(index));
- }
- domAttr->setAttributeName(fakeName);
- ui_widget->setElementAttribute(ui_widget->elementAttribute() << domAttr);
- }
- }
- }
-
- return ui_widget;
-}
-
static void saveStringProperty(DomProperty *property, const PropertySheetStringValue &value)
{
DomString *str = new DomString();
diff --git a/tools/designer/src/components/formeditor/qdesigner_resource.h b/tools/designer/src/components/formeditor/qdesigner_resource.h
index 33b5b88..47dd263 100644
--- a/tools/designer/src/components/formeditor/qdesigner_resource.h
+++ b/tools/designer/src/components/formeditor/qdesigner_resource.h
@@ -64,8 +64,6 @@ class QTabWidget;
class QStackedWidget;
class QToolBox;
class QToolBar;
-class QTreeView;
-class QTableView;
class QDesignerDockWidget;
class QLayoutWidget;
class QWizardPage;
@@ -138,8 +136,6 @@ protected:
DomWidget *saveWidget(QWidget *widget, QDesignerContainerExtension *container, DomWidget *ui_parentWidget);
DomWidget *saveWidget(QToolBar *toolBar, DomWidget *ui_parentWidget);
DomWidget *saveWidget(QDesignerDockWidget *dockWidget, DomWidget *ui_parentWidget);
- DomWidget *saveWidget(QTreeView *treeView, DomWidget *ui_parentWidget);
- DomWidget *saveWidget(QTableView *tableView, DomWidget *ui_parentWidget);
DomWidget *saveWidget(QWizardPage *wizardPage, DomWidget *ui_parentWidget);
virtual DomCustomWidgets *saveCustomWidgets();
diff --git a/tools/designer/src/designer/mainwindow.cpp b/tools/designer/src/designer/mainwindow.cpp
index c27e2b4..86bc47e 100644
--- a/tools/designer/src/designer/mainwindow.cpp
+++ b/tools/designer/src/designer/mainwindow.cpp
@@ -75,7 +75,7 @@ static void addActionsToToolBar(const ActionList &actions, QToolBar *t)
const ActionList::const_iterator cend = actions.constEnd();
for (ActionList::const_iterator it = actions.constBegin(); it != cend; ++it) {
QAction *action = *it;
- if (!action->icon().isNull())
+ if (action->property(QDesignerActions::defaultToolbarPropertyName).toBool())
t->addAction(action);
}
}
@@ -113,6 +113,8 @@ void MainWindowBase::closeEvent(QCloseEvent *e)
QList<QToolBar *> MainWindowBase::createToolBars(const QDesignerActions *actions, bool singleToolBar)
{
+ // Note that whenever you want to add a new tool bar here, you also have to update the default
+ // action groups added to the toolbar manager in the mainwindow constructor
QList<QToolBar *> rc;
if (singleToolBar) {
//: Not currently used (main tool bar)
@@ -252,6 +254,22 @@ ToolBarManager::ToolBarManager(QMainWindow *configureableMainWindow,
m_manager->addAction(action, dockTitle);
}
+ QString category(tr("File"));
+ foreach(QAction *action, actions->fileActions()->actions())
+ m_manager->addAction(action, category);
+
+ category = tr("Edit");
+ foreach(QAction *action, actions->editActions()->actions())
+ m_manager->addAction(action, category);
+
+ category = tr("Tools");
+ foreach(QAction *action, actions->toolActions()->actions())
+ m_manager->addAction(action, category);
+
+ category = tr("Form");
+ foreach(QAction *action, actions->formActions()->actions())
+ m_manager->addAction(action, category);
+
m_manager->addAction(m_configureAction, tr("Toolbars"));
updateToolBarMenu();
}
diff --git a/tools/designer/src/designer/qdesigner_actions.cpp b/tools/designer/src/designer/qdesigner_actions.cpp
index 6776351..a593a76 100644
--- a/tools/designer/src/designer/qdesigner_actions.cpp
+++ b/tools/designer/src/designer/qdesigner_actions.cpp
@@ -107,6 +107,8 @@ QT_BEGIN_NAMESPACE
using namespace qdesigner_internal;
+const char *QDesignerActions::defaultToolbarPropertyName = "__qt_defaultToolBarAction";
+
//#ifdef Q_WS_MAC
# define NONMODAL_PREVIEW
//#endif
@@ -236,6 +238,10 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench)
m_helpActions = createHelpActions();
+ m_newFormAction->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+ m_openFormAction->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+ m_saveFormAction->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+
QDesignerFormWindowManagerInterface *formWindowManager = m_core->formWindowManager();
Q_ASSERT(formWindowManager != 0);
@@ -322,6 +328,9 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench)
m_editActions->addAction(formWindowManager->actionLower());
m_editActions->addAction(formWindowManager->actionRaise());
+ formWindowManager->actionLower()->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+ formWindowManager->actionRaise()->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+
//
// edit mode actions
//
@@ -349,6 +358,7 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench)
if (QDesignerFormEditorPluginInterface *formEditorPlugin = qobject_cast<QDesignerFormEditorPluginInterface*>(plugin)) {
if (QAction *action = formEditorPlugin->action()) {
m_toolActions->addAction(action);
+ action->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
action->setCheckable(true);
}
}
@@ -376,6 +386,15 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench)
m_formActions->addAction(formWindowManager->actionSimplifyLayout());
m_formActions->addAction(createSeparator(this));
+ formWindowManager->actionHorizontalLayout()->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+ formWindowManager->actionVerticalLayout()->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+ formWindowManager->actionSplitHorizontal()->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+ formWindowManager->actionSplitVertical()->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+ formWindowManager->actionGridLayout()->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+ formWindowManager->actionFormLayout()->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+ formWindowManager->actionBreakLayout()->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+ formWindowManager->actionAdjustSize()->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+
m_previewFormAction->setShortcut(tr("CTRL+R"));
m_formActions->addAction(m_previewFormAction);
connect(m_previewManager, SIGNAL(firstPreviewOpened()), this, SLOT(updateCloseAction()));
diff --git a/tools/designer/src/designer/qdesigner_actions.h b/tools/designer/src/designer/qdesigner_actions.h
index 9dfcef1..d8f9e42 100644
--- a/tools/designer/src/designer/qdesigner_actions.h
+++ b/tools/designer/src/designer/qdesigner_actions.h
@@ -113,6 +113,10 @@ public:
QString uiExtension() const;
+ // Boolean dynamic property set on actions to
+ // show them in the default toolbar layout
+ static const char *defaultToolbarPropertyName;
+
public slots:
void activeFormWindowChanged(QDesignerFormWindowInterface *formWindow);
void createForm();
diff --git a/tools/designer/src/designer/qdesigner_workbench.cpp b/tools/designer/src/designer/qdesigner_workbench.cpp
index b65ce7e..168c468 100644
--- a/tools/designer/src/designer/qdesigner_workbench.cpp
+++ b/tools/designer/src/designer/qdesigner_workbench.cpp
@@ -419,6 +419,7 @@ void QDesignerWorkbench::switchToDockedMode()
m_mode = DockedMode;
const QDesignerSettings settings(m_core);
m_dockedMainWindow = new DockedMainWindow(this, m_toolbarMenu, m_toolWindows);
+ m_dockedMainWindow->setUnifiedTitleAndToolBarOnMac(true);
m_dockedMainWindow->setCloseEventPolicy(MainWindowBase::EmitCloseEventSignal);
connect(m_dockedMainWindow, SIGNAL(closeEventReceived(QCloseEvent*)), this, SLOT(handleCloseEvent(QCloseEvent*)));
connect(m_dockedMainWindow, SIGNAL(fileDropped(QString)), this, SLOT(slotFileDropped(QString)));
diff --git a/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp b/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp
index 77ab2a6..08fedd2 100644
--- a/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp
@@ -722,10 +722,11 @@ int QDesignerPropertySheet::addDynamicProperty(const QString &propName, const QV
else if (value.type() == QVariant::Pixmap)
v = qVariantFromValue(qdesigner_internal::PropertySheetPixmapValue());
else if (value.type() == QVariant::String)
- v = qVariantFromValue(qdesigner_internal::PropertySheetStringValue());
- else if (value.type() == QVariant::KeySequence)
- v = qVariantFromValue(qdesigner_internal::PropertySheetKeySequenceValue());
-
+ v = qVariantFromValue(qdesigner_internal::PropertySheetStringValue(value.toString()));
+ else if (value.type() == QVariant::KeySequence) {
+ const QKeySequence keySequence = qVariantValue<QKeySequence>(value);
+ v = qVariantFromValue(qdesigner_internal::PropertySheetKeySequenceValue(keySequence));
+ }
if (d->m_addIndex.contains(propName)) {
const int idx = d->m_addIndex.value(propName);
@@ -1130,7 +1131,7 @@ void QDesignerPropertySheet::setProperty(int index, const QVariant &value)
}
}
- if (isDynamicProperty(index)) {
+ if (isDynamicProperty(index) || isDefaultDynamicProperty(index)) {
if (d->isResourceProperty(index))
d->setResourceProperty(index, value);
if (d->isStringProperty(index))
@@ -1200,10 +1201,17 @@ bool QDesignerPropertySheet::reset(int index)
} else if (isDynamic(index)) {
const QString propName = propertyName(index);
const QVariant oldValue = d->m_addProperties.value(index);
- const QVariant newValue = d->m_info.value(index).defaultValue;
+ const QVariant defaultValue = d->m_info.value(index).defaultValue;
+ QVariant newValue = defaultValue;
+ if (d->isStringProperty(index)) {
+ newValue = qVariantFromValue(qdesigner_internal::PropertySheetStringValue(newValue.toString()));
+ } else if (d->isKeySequenceProperty(index)) {
+ const QKeySequence keySequence = qVariantValue<QKeySequence>(newValue);
+ newValue = qVariantFromValue(qdesigner_internal::PropertySheetKeySequenceValue(keySequence));
+ }
if (oldValue == newValue)
return true;
- d->m_object->setProperty(propName.toUtf8(), newValue);
+ d->m_object->setProperty(propName.toUtf8(), defaultValue);
d->m_addProperties[index] = newValue;
return true;
} else if (!d->m_info.value(index).defaultValue.isNull()) {