summaryrefslogtreecommitdiffstats
path: root/tools/designer/src/lib
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2009-04-24 14:03:55 (GMT)
committeraxis <qt-info@nokia.com>2009-04-27 07:09:01 (GMT)
commite74c8dc65e2feffb9a55d00aee5ca634fba41df8 (patch)
tree3a131f9235fb6a455793178d8313655e4fd0036e /tools/designer/src/lib
parent8f427b2b914d5b575a4a7c0ed65d2fb8f45acc76 (diff)
parent211bea9838bcc2acd7f54b65468fe1be2d81b1e0 (diff)
downloadQt-e74c8dc65e2feffb9a55d00aee5ca634fba41df8.zip
Qt-e74c8dc65e2feffb9a55d00aee5ca634fba41df8.tar.gz
Qt-e74c8dc65e2feffb9a55d00aee5ca634fba41df8.tar.bz2
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt
Configure.exe recompiled with MSVC6. Conflicts: configure.exe examples/network/network.pro src/gui/dialogs/qfiledialog_p.h src/gui/dialogs/qfilesystemmodel_p.h src/gui/kernel/qapplication.cpp tests/auto/_Categories/qmake.txt tests/auto/qfile/test/test.pro tests/auto/qfile/tst_qfile.cpp tests/auto/qlibrary/tst_qlibrary.cpp tests/auto/qline/tst_qline.cpp tests/auto/qstyle/tst_qstyle.cpp tests/auto/qtextstream/tst_qtextstream.cpp tests/auto/qtranslator/qtranslator.pro tests/auto/qwaitcondition/tst_qwaitcondition.cpp translations/qt_ja_JP.ts
Diffstat (limited to 'tools/designer/src/lib')
-rw-r--r--tools/designer/src/lib/shared/actioneditor.cpp8
-rw-r--r--tools/designer/src/lib/shared/actionrepository.cpp17
-rw-r--r--tools/designer/src/lib/shared/actionrepository_p.h7
-rw-r--r--tools/designer/src/lib/shared/newactiondialog.cpp4
-rw-r--r--tools/designer/src/lib/shared/newactiondialog_p.h2
-rw-r--r--tools/designer/src/lib/shared/plugindialog_p.h11
-rw-r--r--tools/designer/src/lib/shared/qdesigner_utils.cpp2
-rw-r--r--tools/designer/src/lib/shared/textpropertyeditor.cpp1
-rw-r--r--tools/designer/src/lib/uilib/resourcebuilder.cpp16
9 files changed, 46 insertions, 22 deletions
diff --git a/tools/designer/src/lib/shared/actioneditor.cpp b/tools/designer/src/lib/shared/actioneditor.cpp
index 6a66442..7f96a15 100644
--- a/tools/designer/src/lib/shared/actioneditor.cpp
+++ b/tools/designer/src/lib/shared/actioneditor.cpp
@@ -456,7 +456,7 @@ void ActionEditor::slotNewAction()
if (actionData.checkable)
setInitialProperty(sheet, QLatin1String(checkablePropertyC), QVariant(true));
- if (!actionData.keysequence.isEmpty())
+ if (!actionData.keysequence.value().isEmpty())
setInitialProperty(sheet, QLatin1String(shortcutPropertyC), qVariantFromValue(actionData.keysequence));
sheet->setProperty(sheet->indexOf(QLatin1String(iconPropertyC)), qVariantFromValue(actionData.icon));
@@ -491,10 +491,10 @@ static QDesignerFormWindowCommand *setIconPropertyCommand(const PropertySheetIco
// return a FormWindow command to apply a QKeySequence or a reset command
// in case it is empty.
-static QDesignerFormWindowCommand *setKeySequencePropertyCommand(const QKeySequence &ks, QAction *action, QDesignerFormWindowInterface *fw)
+static QDesignerFormWindowCommand *setKeySequencePropertyCommand(const PropertySheetKeySequenceValue &ks, QAction *action, QDesignerFormWindowInterface *fw)
{
const QString shortcutProperty = QLatin1String(shortcutPropertyC);
- if (ks.isEmpty()) {
+ if (ks.value().isEmpty()) {
ResetPropertyCommand *cmd = new ResetPropertyCommand(fw);
cmd->init(action, shortcutProperty);
return cmd;
@@ -544,7 +544,7 @@ void ActionEditor::editAction(QAction *action)
oldActionData.text = action->text();
oldActionData.toolTip = textPropertyValue(sheet, QLatin1String(toolTipPropertyC));
oldActionData.icon = qVariantValue<PropertySheetIconValue>(sheet->property(sheet->indexOf(QLatin1String(iconPropertyC))));
- oldActionData.keysequence = qVariantValue<QKeySequence>(sheet->property(sheet->indexOf(QLatin1String(shortcutPropertyC))));
+ oldActionData.keysequence = ActionModel::actionShortCut(sheet);
oldActionData.checkable = action->isCheckable();
dlg.setActionData(oldActionData);
diff --git a/tools/designer/src/lib/shared/actionrepository.cpp b/tools/designer/src/lib/shared/actionrepository.cpp
index 941a9ba..1b638c3 100644
--- a/tools/designer/src/lib/shared/actionrepository.cpp
+++ b/tools/designer/src/lib/shared/actionrepository.cpp
@@ -42,6 +42,7 @@
#include "actionrepository_p.h"
#include "qtresourceview_p.h"
#include "iconloader_p.h"
+#include "qdesigner_utils_p.h"
#include <QtDesigner/QDesignerFormEditorInterface>
#include <QtDesigner/QDesignerPropertySheetExtension>
@@ -168,16 +169,20 @@ QWidgetList ActionModel::associatedWidgets(const QAction *action)
}
// shortcut is a fake property, need to retrieve it via property sheet.
-static QString actionShortCut(QDesignerFormEditorInterface *core, QAction *action)
+PropertySheetKeySequenceValue ActionModel::actionShortCut(QDesignerFormEditorInterface *core, QAction *action)
{
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core->extensionManager(), action);
if (!sheet)
- return QString();
+ return PropertySheetKeySequenceValue();
+ return actionShortCut(sheet);
+}
+
+PropertySheetKeySequenceValue ActionModel::actionShortCut(const QDesignerPropertySheetExtension *sheet)
+{
const int index = sheet->indexOf(QLatin1String("shortcut"));
if (index == -1)
- return QString();
- const QKeySequence keysequence = qvariant_cast<QKeySequence>(sheet->property(index));
- return keysequence.toString();
+ return PropertySheetKeySequenceValue();
+ return qvariant_cast<PropertySheetKeySequenceValue>(sheet->property(index));
}
void ActionModel::setItems(QDesignerFormEditorInterface *core, QAction *action, QStandardItemList &sl)
@@ -221,7 +226,7 @@ void ActionModel::setItems(QDesignerFormEditorInterface *core, QAction *action,
item->setText(action->text());
item->setToolTip(action->text());
// shortcut
- const QString shortcut = actionShortCut(core, action);
+ const QString shortcut = actionShortCut(core, action).value().toString();
item = sl[ShortCutColumn];
item->setText(shortcut);
item->setToolTip(shortcut);
diff --git a/tools/designer/src/lib/shared/actionrepository_p.h b/tools/designer/src/lib/shared/actionrepository_p.h
index 9d1af5a..66d77ce 100644
--- a/tools/designer/src/lib/shared/actionrepository_p.h
+++ b/tools/designer/src/lib/shared/actionrepository_p.h
@@ -65,9 +65,12 @@ QT_BEGIN_NAMESPACE
class QPixmap;
class QDesignerFormEditorInterface;
+class QDesignerPropertySheetExtension;
namespace qdesigner_internal {
+class PropertySheetKeySequenceValue;
+
// Shared model of actions, to be used for several views (detailed/icon view).
class QDESIGNER_SHARED_EXPORT ActionModel: public QStandardItemModel
{
@@ -99,6 +102,10 @@ public:
// Find the associated menus and toolbars, ignore toolbuttons
static QWidgetList associatedWidgets(const QAction *action);
+ // Retrieve shortcut via property sheet as it is a fake property
+ static PropertySheetKeySequenceValue actionShortCut(QDesignerFormEditorInterface *core, QAction *action);
+ static PropertySheetKeySequenceValue actionShortCut(const QDesignerPropertySheetExtension *ps);
+
signals:
void resourceImageDropped(const QString &path, QAction *action);
diff --git a/tools/designer/src/lib/shared/newactiondialog.cpp b/tools/designer/src/lib/shared/newactiondialog.cpp
index 53aec4b..bb163d6 100644
--- a/tools/designer/src/lib/shared/newactiondialog.cpp
+++ b/tools/designer/src/lib/shared/newactiondialog.cpp
@@ -134,7 +134,7 @@ ActionData NewActionDialog::actionData() const
rc.toolTip = m_ui->tooltipEditor->text();
rc.icon = m_ui->iconSelector->icon();
rc.checkable = m_ui->checkableCheckBox->checkState() == Qt::Checked;
- rc.keysequence = m_ui->keySequenceEdit->keySequence();
+ rc.keysequence = PropertySheetKeySequenceValue(m_ui->keySequenceEdit->keySequence());
return rc;
}
@@ -144,7 +144,7 @@ void NewActionDialog::setActionData(const ActionData &d)
m_ui->editObjectName->setText(d.name);
m_ui->iconSelector->setIcon(d.icon);
m_ui->tooltipEditor->setText(d.toolTip);
- m_ui->keySequenceEdit->setKeySequence(d.keysequence);
+ m_ui->keySequenceEdit->setKeySequence(d.keysequence.value());
m_ui->checkableCheckBox->setCheckState(d.checkable ? Qt::Checked : Qt::Unchecked);
m_auto_update_object_name = false;
diff --git a/tools/designer/src/lib/shared/newactiondialog_p.h b/tools/designer/src/lib/shared/newactiondialog_p.h
index c8bd34c..d4e9b5b 100644
--- a/tools/designer/src/lib/shared/newactiondialog_p.h
+++ b/tools/designer/src/lib/shared/newactiondialog_p.h
@@ -84,7 +84,7 @@ struct ActionData {
QString toolTip;
PropertySheetIconValue icon;
bool checkable;
- QKeySequence keysequence;
+ PropertySheetKeySequenceValue keysequence;
};
inline bool operator==(const ActionData &a1, const ActionData &a2) { return a1.compare(a2) == 0u; }
diff --git a/tools/designer/src/lib/shared/plugindialog_p.h b/tools/designer/src/lib/shared/plugindialog_p.h
index d50a804..a2601d4 100644
--- a/tools/designer/src/lib/shared/plugindialog_p.h
+++ b/tools/designer/src/lib/shared/plugindialog_p.h
@@ -42,6 +42,17 @@
#ifndef PLUGINDIALOG_H
#define PLUGINDIALOG_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include "ui_plugindialog.h"
QT_BEGIN_NAMESPACE
diff --git a/tools/designer/src/lib/shared/qdesigner_utils.cpp b/tools/designer/src/lib/shared/qdesigner_utils.cpp
index d2f092e..75fa180 100644
--- a/tools/designer/src/lib/shared/qdesigner_utils.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_utils.cpp
@@ -397,7 +397,7 @@ namespace qdesigner_internal
QMapIterator<QPair<QIcon::Mode, QIcon::State>, PropertySheetPixmapValue> itPath(paths);
while (itPath.hasNext()) {
QPair<QIcon::Mode, QIcon::State> pair = itPath.next().key();
- icon.addPixmap(m_pixmapCache->pixmap(itPath.value()), pair.first, pair.second);
+ icon.addFile(itPath.value().path(), QSize(), pair.first, pair.second);
}
m_cache.insert(value, icon);
return icon;
diff --git a/tools/designer/src/lib/shared/textpropertyeditor.cpp b/tools/designer/src/lib/shared/textpropertyeditor.cpp
index cf12842..95a9f85 100644
--- a/tools/designer/src/lib/shared/textpropertyeditor.cpp
+++ b/tools/designer/src/lib/shared/textpropertyeditor.cpp
@@ -293,6 +293,7 @@ namespace qdesigner_internal {
}
setFocusProxy(m_lineEdit);
+ setText(m_cachedText);
markIntermediateState();
}
diff --git a/tools/designer/src/lib/uilib/resourcebuilder.cpp b/tools/designer/src/lib/uilib/resourcebuilder.cpp
index 3679f92..5df10e9 100644
--- a/tools/designer/src/lib/uilib/resourcebuilder.cpp
+++ b/tools/designer/src/lib/uilib/resourcebuilder.cpp
@@ -98,21 +98,21 @@ QVariant QResourceBuilder::loadResource(const QDir &workingDirectory, const DomP
if (const int flags = iconStateFlags(dpi)) { // new, post 4.4 format
QIcon icon;
if (flags & NormalOff)
- icon.addPixmap(QFileInfo(workingDirectory, dpi->elementNormalOff()->text()).absoluteFilePath(), QIcon::Normal, QIcon::Off);
+ icon.addFile(QFileInfo(workingDirectory, dpi->elementNormalOff()->text()).absoluteFilePath(), QSize(), QIcon::Normal, QIcon::Off);
if (flags & NormalOn)
- icon.addPixmap(QFileInfo(workingDirectory, dpi->elementNormalOn()->text()).absoluteFilePath(), QIcon::Normal, QIcon::On);
+ icon.addFile(QFileInfo(workingDirectory, dpi->elementNormalOn()->text()).absoluteFilePath(), QSize(), QIcon::Normal, QIcon::On);
if (flags & DisabledOff)
- icon.addPixmap(QFileInfo(workingDirectory, dpi->elementDisabledOff()->text()).absoluteFilePath(), QIcon::Disabled, QIcon::Off);
+ icon.addFile(QFileInfo(workingDirectory, dpi->elementDisabledOff()->text()).absoluteFilePath(), QSize(), QIcon::Disabled, QIcon::Off);
if (flags & DisabledOn)
- icon.addPixmap(QFileInfo(workingDirectory, dpi->elementDisabledOn()->text()).absoluteFilePath(), QIcon::Disabled, QIcon::On);
+ icon.addFile(QFileInfo(workingDirectory, dpi->elementDisabledOn()->text()).absoluteFilePath(), QSize(), QIcon::Disabled, QIcon::On);
if (flags & ActiveOff)
- icon.addPixmap(QFileInfo(workingDirectory, dpi->elementActiveOff()->text()).absoluteFilePath(), QIcon::Active, QIcon::Off);
+ icon.addFile(QFileInfo(workingDirectory, dpi->elementActiveOff()->text()).absoluteFilePath(), QSize(), QIcon::Active, QIcon::Off);
if (flags & ActiveOn)
- icon.addPixmap(QFileInfo(workingDirectory, dpi->elementActiveOn()->text()).absoluteFilePath(), QIcon::Active, QIcon::On);
+ icon.addFile(QFileInfo(workingDirectory, dpi->elementActiveOn()->text()).absoluteFilePath(), QSize(), QIcon::Active, QIcon::On);
if (flags & SelectedOff)
- icon.addPixmap(QFileInfo(workingDirectory, dpi->elementSelectedOff()->text()).absoluteFilePath(), QIcon::Selected, QIcon::Off);
+ icon.addFile(QFileInfo(workingDirectory, dpi->elementSelectedOff()->text()).absoluteFilePath(), QSize(), QIcon::Selected, QIcon::Off);
if (flags & SelectedOn)
- icon.addPixmap(QFileInfo(workingDirectory, dpi->elementSelectedOn()->text()).absoluteFilePath(), QIcon::Selected, QIcon::On);
+ icon.addFile(QFileInfo(workingDirectory, dpi->elementSelectedOn()->text()).absoluteFilePath(), QSize(), QIcon::Selected, QIcon::On);
return qVariantFromValue(icon);
} else { // 4.3 legacy
const QIcon icon(QFileInfo(workingDirectory, dpi->text()).absoluteFilePath());