彻底改版2.0
28
third/designer/designer.pro
Normal file
@@ -0,0 +1,28 @@
|
||||
QT += xml network
|
||||
LIBS += -lQtDesignerComponents -lQtDesigner
|
||||
|
||||
TARGET = designer
|
||||
TEMPLATE = app
|
||||
MOC_DIR = temp/moc
|
||||
RCC_DIR = temp/rcc
|
||||
UI_DIR = temp/ui
|
||||
OBJECTS_DIR = temp/obj
|
||||
DESTDIR = $$PWD/../bin
|
||||
RC_FILE = main.rc
|
||||
TRANSLATIONS = designer_zh_CN.ts
|
||||
|
||||
SOURCES += main.cpp
|
||||
CONFIG += warn_off release
|
||||
RESOURCES += designer.qrc
|
||||
|
||||
include($$PWD/form/form.pri)
|
||||
include($$PWD/qdesigner/qdesigner.pri)
|
||||
|
||||
INCLUDEPATH += $$PWD
|
||||
INCLUDEPATH += $$PWD/form
|
||||
INCLUDEPATH += $$PWD/qdesigner
|
||||
|
||||
INCLUDEPATH += $$PWD/lib/sdk
|
||||
INCLUDEPATH += $$PWD/lib/extension
|
||||
INCLUDEPATH += $$PWD/lib/shared
|
||||
INCLUDEPATH += $$PWD/lib/uilib
|
||||
12
third/designer/designer.qrc
Normal file
@@ -0,0 +1,12 @@
|
||||
<RCC>
|
||||
<qresource prefix="/trolltech/designer">
|
||||
<file>images/designer.png</file>
|
||||
<file>images/back.png</file>
|
||||
<file>images/down.png</file>
|
||||
<file>images/forward.png</file>
|
||||
<file>images/minus.png</file>
|
||||
<file>images/plus.png</file>
|
||||
<file>images/up.png</file>
|
||||
<file>images/designer_zh_CN.qm</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
429
third/designer/form/appfontdialog.cpp
Normal file
@@ -0,0 +1,429 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "appfontdialog.h"
|
||||
|
||||
#include <iconloader_p.h>
|
||||
#include <abstractsettings_p.h>
|
||||
|
||||
#include <QtGui/QTreeView>
|
||||
#include <QtGui/QToolButton>
|
||||
#include <QtGui/QHBoxLayout>
|
||||
#include <QtGui/QVBoxLayout>
|
||||
#include <QtGui/QSpacerItem>
|
||||
#include <QtGui/QFileDialog>
|
||||
#include <QtGui/QStandardItemModel>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QFontDatabase>
|
||||
#include <QtGui/QDialogButtonBox>
|
||||
|
||||
#include <QtCore/QSettings>
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QtAlgorithms>
|
||||
#include <QtCore/QVector>
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
enum {FileNameRole = Qt::UserRole + 1, IdRole = Qt::UserRole + 2 };
|
||||
enum { debugAppFontWidget = 0 };
|
||||
|
||||
static const char fontFileKeyC[] = "fontFiles";
|
||||
|
||||
// AppFontManager: Singleton that maintains the mapping of loaded application font
|
||||
// ids to the file names (which are not stored in QFontDatabase)
|
||||
// and provides API for loading/unloading fonts as well for saving/restoring settings.
|
||||
|
||||
class AppFontManager
|
||||
{
|
||||
Q_DISABLE_COPY(AppFontManager)
|
||||
AppFontManager();
|
||||
public:
|
||||
static AppFontManager &instance();
|
||||
|
||||
void save(QDesignerSettingsInterface *s, const QString &prefix) const;
|
||||
void restore(const QDesignerSettingsInterface *s, const QString &prefix);
|
||||
|
||||
// Return id or -1
|
||||
int add(const QString &fontFile, QString *errorMessage);
|
||||
|
||||
bool remove(int id, QString *errorMessage);
|
||||
bool remove(const QString &fontFile, QString *errorMessage);
|
||||
bool removeAt(int index, QString *errorMessage);
|
||||
|
||||
// Store loaded fonts as pair of file name and Id
|
||||
typedef QPair<QString,int> FileNameFontIdPair;
|
||||
typedef QList<FileNameFontIdPair> FileNameFontIdPairs;
|
||||
const FileNameFontIdPairs &fonts() const;
|
||||
|
||||
private:
|
||||
FileNameFontIdPairs m_fonts;
|
||||
};
|
||||
|
||||
AppFontManager::AppFontManager()
|
||||
{
|
||||
}
|
||||
|
||||
AppFontManager &AppFontManager::instance()
|
||||
{
|
||||
static AppFontManager rc;
|
||||
return rc;
|
||||
}
|
||||
|
||||
void AppFontManager::save(QDesignerSettingsInterface *s, const QString &prefix) const
|
||||
{
|
||||
// Store as list of file names
|
||||
QStringList fontFiles;
|
||||
const FileNameFontIdPairs::const_iterator cend = m_fonts.constEnd();
|
||||
for (FileNameFontIdPairs::const_iterator it = m_fonts.constBegin(); it != cend; ++it)
|
||||
fontFiles.push_back(it->first);
|
||||
|
||||
s->beginGroup(prefix);
|
||||
s->setValue(QLatin1String(fontFileKeyC), fontFiles);
|
||||
s->endGroup();
|
||||
|
||||
if (debugAppFontWidget)
|
||||
qDebug() << "AppFontManager::saved" << fontFiles.size() << "fonts under " << prefix;
|
||||
}
|
||||
|
||||
void AppFontManager::restore(const QDesignerSettingsInterface *s, const QString &prefix)
|
||||
{
|
||||
QString key = prefix;
|
||||
key += QLatin1Char('/');
|
||||
key += QLatin1String(fontFileKeyC);
|
||||
const QStringList fontFiles = s->value(key, QStringList()).toStringList();
|
||||
|
||||
if (debugAppFontWidget)
|
||||
qDebug() << "AppFontManager::restoring" << fontFiles.size() << "fonts from " << prefix;
|
||||
if (!fontFiles.empty()) {
|
||||
QString errorMessage;
|
||||
const QStringList::const_iterator cend = fontFiles.constEnd();
|
||||
for (QStringList::const_iterator it = fontFiles.constBegin(); it != cend; ++it)
|
||||
if (add(*it, &errorMessage) == -1)
|
||||
qWarning("%s", qPrintable(errorMessage));
|
||||
}
|
||||
}
|
||||
|
||||
int AppFontManager::add(const QString &fontFile, QString *errorMessage)
|
||||
{
|
||||
const QFileInfo inf(fontFile);
|
||||
if (!inf.isFile()) {
|
||||
*errorMessage = QCoreApplication::translate("AppFontManager", "'%1' is not a file.").arg(fontFile);
|
||||
return -1;
|
||||
}
|
||||
if (!inf.isReadable()) {
|
||||
*errorMessage = QCoreApplication::translate("AppFontManager", "The font file '%1' does not have read permissions.").arg(fontFile);
|
||||
return -1;
|
||||
}
|
||||
const QString fullPath = inf.absoluteFilePath();
|
||||
// Check if already loaded
|
||||
const FileNameFontIdPairs::const_iterator cend = m_fonts.constEnd();
|
||||
for (FileNameFontIdPairs::const_iterator it = m_fonts.constBegin(); it != cend; ++it) {
|
||||
if (it->first == fullPath) {
|
||||
*errorMessage = QCoreApplication::translate("AppFontManager", "The font file '%1' is already loaded.").arg(fontFile);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
const int id = QFontDatabase::addApplicationFont(fullPath);
|
||||
if (id == -1) {
|
||||
*errorMessage = QCoreApplication::translate("AppFontManager", "The font file '%1' could not be loaded.").arg(fontFile);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (debugAppFontWidget)
|
||||
qDebug() << "AppFontManager::add" << fontFile << id;
|
||||
m_fonts.push_back(FileNameFontIdPair(fullPath, id));
|
||||
return id;
|
||||
}
|
||||
|
||||
bool AppFontManager::remove(int id, QString *errorMessage)
|
||||
{
|
||||
const int count = m_fonts.size();
|
||||
for (int i = 0; i < count; i++)
|
||||
if (m_fonts[i].second == id)
|
||||
return removeAt(i, errorMessage);
|
||||
|
||||
*errorMessage = QCoreApplication::translate("AppFontManager", "'%1' is not a valid font id.").arg(id);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AppFontManager::remove(const QString &fontFile, QString *errorMessage)
|
||||
{
|
||||
const int count = m_fonts.size();
|
||||
for (int i = 0; i < count; i++)
|
||||
if (m_fonts[i].first == fontFile)
|
||||
return removeAt(i, errorMessage);
|
||||
|
||||
*errorMessage = QCoreApplication::translate("AppFontManager", "There is no loaded font matching the id '%1'.").arg(fontFile);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AppFontManager::removeAt(int index, QString *errorMessage)
|
||||
{
|
||||
Q_ASSERT(index >= 0 && index < m_fonts.size());
|
||||
|
||||
const QString fontFile = m_fonts[index].first;
|
||||
const int id = m_fonts[index].second;
|
||||
|
||||
if (debugAppFontWidget)
|
||||
qDebug() << "AppFontManager::removeAt" << index << '(' << fontFile << id << ')';
|
||||
|
||||
if (!QFontDatabase::removeApplicationFont(id)) {
|
||||
*errorMessage = QCoreApplication::translate("AppFontManager", "The font '%1' (%2) could not be unloaded.").arg(fontFile).arg(id);
|
||||
return false;
|
||||
}
|
||||
m_fonts.removeAt(index);
|
||||
return true;
|
||||
}
|
||||
|
||||
const AppFontManager::FileNameFontIdPairs &AppFontManager::fonts() const
|
||||
{
|
||||
return m_fonts;
|
||||
}
|
||||
|
||||
// ------------- AppFontModel
|
||||
class AppFontModel : public QStandardItemModel {
|
||||
Q_DISABLE_COPY(AppFontModel)
|
||||
public:
|
||||
AppFontModel(QObject *parent = 0);
|
||||
|
||||
void init(const AppFontManager &mgr);
|
||||
void add(const QString &fontFile, int id);
|
||||
int idAt(const QModelIndex &idx) const;
|
||||
};
|
||||
|
||||
AppFontModel::AppFontModel(QObject * parent) :
|
||||
QStandardItemModel(parent)
|
||||
{
|
||||
setHorizontalHeaderLabels(QStringList(AppFontWidget::tr("Fonts")));
|
||||
}
|
||||
|
||||
void AppFontModel::init(const AppFontManager &mgr)
|
||||
{
|
||||
typedef AppFontManager::FileNameFontIdPairs FileNameFontIdPairs;
|
||||
|
||||
const FileNameFontIdPairs &fonts = mgr.fonts();
|
||||
const FileNameFontIdPairs::const_iterator cend = fonts.constEnd();
|
||||
for (FileNameFontIdPairs::const_iterator it = fonts.constBegin(); it != cend; ++it)
|
||||
add(it->first, it->second);
|
||||
}
|
||||
|
||||
void AppFontModel::add(const QString &fontFile, int id)
|
||||
{
|
||||
const QFileInfo inf(fontFile);
|
||||
// Root item with base name
|
||||
QStandardItem *fileItem = new QStandardItem(inf.completeBaseName());
|
||||
const QString fullPath = inf.absoluteFilePath();
|
||||
fileItem->setData(fullPath, FileNameRole);
|
||||
fileItem->setToolTip(fullPath);
|
||||
fileItem->setData(id, IdRole);
|
||||
fileItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled);
|
||||
|
||||
appendRow(fileItem);
|
||||
const QStringList families = QFontDatabase::applicationFontFamilies(id);
|
||||
const QStringList::const_iterator cend = families.constEnd();
|
||||
for (QStringList::const_iterator it = families.constBegin(); it != cend; ++it) {
|
||||
QStandardItem *familyItem = new QStandardItem(*it);
|
||||
familyItem->setToolTip(fullPath);
|
||||
familyItem->setFont(QFont(*it));
|
||||
familyItem->setFlags(Qt::ItemIsEnabled);
|
||||
fileItem->appendRow(familyItem);
|
||||
}
|
||||
}
|
||||
|
||||
int AppFontModel::idAt(const QModelIndex &idx) const
|
||||
{
|
||||
if (const QStandardItem *item = itemFromIndex(idx))
|
||||
return item->data(IdRole).toInt();
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ------------- AppFontWidget
|
||||
AppFontWidget::AppFontWidget(QWidget *parent) :
|
||||
QGroupBox(parent),
|
||||
m_view(new QTreeView),
|
||||
m_addButton(new QToolButton),
|
||||
m_removeButton(new QToolButton),
|
||||
m_removeAllButton(new QToolButton),
|
||||
m_model(new AppFontModel(this))
|
||||
{
|
||||
m_model->init(AppFontManager::instance());
|
||||
m_view->setModel(m_model);
|
||||
m_view->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
m_view->expandAll();
|
||||
connect(m_view->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(selectionChanged(QItemSelection,QItemSelection)));
|
||||
|
||||
m_addButton->setToolTip(tr("Add font files"));
|
||||
m_addButton->setIcon(qdesigner_internal::createIconSet(QString::fromUtf8("plus.png")));
|
||||
connect(m_addButton, SIGNAL(clicked()), this, SLOT(addFiles()));
|
||||
|
||||
m_removeButton->setEnabled(false);
|
||||
m_removeButton->setToolTip(tr("Remove current font file"));
|
||||
m_removeButton->setIcon(qdesigner_internal::createIconSet(QString::fromUtf8("minus.png")));
|
||||
connect(m_removeButton, SIGNAL(clicked()), this, SLOT(slotRemoveFiles()));
|
||||
|
||||
m_removeAllButton->setToolTip(tr("Remove all font files"));
|
||||
m_removeAllButton->setIcon(qdesigner_internal::createIconSet(QString::fromUtf8("editdelete.png")));
|
||||
connect(m_removeAllButton, SIGNAL(clicked()), this, SLOT(slotRemoveAll()));
|
||||
|
||||
QHBoxLayout *hLayout = new QHBoxLayout;
|
||||
hLayout->addWidget(m_addButton);
|
||||
hLayout->addWidget(m_removeButton);
|
||||
hLayout->addWidget(m_removeAllButton);
|
||||
hLayout->addItem(new QSpacerItem(0, 0,QSizePolicy::MinimumExpanding));
|
||||
|
||||
QVBoxLayout *vLayout = new QVBoxLayout;
|
||||
vLayout->addWidget(m_view);
|
||||
vLayout->addLayout(hLayout);
|
||||
setLayout(vLayout);
|
||||
}
|
||||
|
||||
void AppFontWidget::addFiles()
|
||||
{
|
||||
const QStringList files =
|
||||
QFileDialog::getOpenFileNames(this, tr("Add Font Files"), QString(),
|
||||
tr("Font files (*.ttf)"));
|
||||
if (files.empty())
|
||||
return;
|
||||
|
||||
QString errorMessage;
|
||||
|
||||
AppFontManager &fmgr = AppFontManager::instance();
|
||||
const QStringList::const_iterator cend = files.constEnd();
|
||||
for (QStringList::const_iterator it = files.constBegin(); it != cend; ++it) {
|
||||
const int id = fmgr.add(*it, &errorMessage);
|
||||
if (id != -1) {
|
||||
m_model->add(*it, id);
|
||||
} else {
|
||||
QMessageBox::critical(this, tr("Error Adding Fonts"), errorMessage);
|
||||
}
|
||||
}
|
||||
m_view->expandAll();
|
||||
}
|
||||
|
||||
static void removeFonts(const QModelIndexList &selectedIndexes, AppFontModel *model, QWidget *dialogParent)
|
||||
{
|
||||
if (selectedIndexes.empty())
|
||||
return;
|
||||
|
||||
// Reverse sort top level rows and remove
|
||||
AppFontManager &fmgr = AppFontManager::instance();
|
||||
QVector<int> rows;
|
||||
rows.reserve(selectedIndexes.size());
|
||||
|
||||
QString errorMessage;
|
||||
const QModelIndexList::const_iterator cend = selectedIndexes.constEnd();
|
||||
for (QModelIndexList::const_iterator it = selectedIndexes.constBegin(); it != cend; ++it) {
|
||||
const int id = model->idAt(*it);
|
||||
if (id != -1) {
|
||||
if (fmgr.remove(id, &errorMessage)) {
|
||||
rows.push_back(it->row());
|
||||
} else {
|
||||
QMessageBox::critical(dialogParent, AppFontWidget::tr("Error Removing Fonts"), errorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
qStableSort(rows.begin(), rows.end());
|
||||
for (int i = rows.size() - 1; i >= 0; i--)
|
||||
model->removeRow(rows[i]);
|
||||
}
|
||||
|
||||
void AppFontWidget::slotRemoveFiles()
|
||||
{
|
||||
removeFonts(m_view->selectionModel()->selectedIndexes(), m_model, this);
|
||||
}
|
||||
|
||||
void AppFontWidget::slotRemoveAll()
|
||||
{
|
||||
const int count = m_model->rowCount();
|
||||
if (!count)
|
||||
return;
|
||||
|
||||
const QMessageBox::StandardButton answer =
|
||||
QMessageBox::question(this, tr("Remove Fonts"), tr("Would you like to remove all fonts?"),
|
||||
QMessageBox::Yes|QMessageBox::No, QMessageBox::No);
|
||||
if (answer == QMessageBox::No)
|
||||
return;
|
||||
|
||||
QModelIndexList topLevels;
|
||||
for (int i = 0; i < count; i++)
|
||||
topLevels.push_back(m_model->index(i, 0));
|
||||
removeFonts(topLevels, m_model, this);
|
||||
}
|
||||
|
||||
void AppFontWidget::selectionChanged(const QItemSelection &selected, const QItemSelection & /*deselected*/)
|
||||
{
|
||||
m_removeButton->setEnabled(!selected.indexes().empty());
|
||||
}
|
||||
|
||||
void AppFontWidget::save(QDesignerSettingsInterface *s, const QString &prefix)
|
||||
{
|
||||
AppFontManager::instance().save(s, prefix);
|
||||
}
|
||||
|
||||
void AppFontWidget::restore(const QDesignerSettingsInterface *s, const QString &prefix)
|
||||
{
|
||||
AppFontManager::instance().restore(s, prefix);
|
||||
}
|
||||
|
||||
// ------------ AppFontDialog
|
||||
AppFontDialog::AppFontDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
m_appFontWidget(new AppFontWidget)
|
||||
{
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
setWindowTitle(tr("Additional Fonts"));
|
||||
setModal(false);
|
||||
QVBoxLayout *vl = new QVBoxLayout;
|
||||
vl->addWidget(m_appFontWidget);
|
||||
|
||||
QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Close);
|
||||
QDialog::connect(bb, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
vl->addWidget(bb);
|
||||
setLayout(vl);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
101
third/designer/form/appfontdialog.h
Normal file
@@ -0,0 +1,101 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QDESIGNER_APPFONTWIDGET_H
|
||||
#define QDESIGNER_APPFONTWIDGET_H
|
||||
|
||||
#include <QtGui/QGroupBox>
|
||||
#include <QtGui/QDialog>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class AppFontModel;
|
||||
|
||||
class QTreeView;
|
||||
class QToolButton;
|
||||
class QItemSelection;
|
||||
class QDesignerSettingsInterface;
|
||||
|
||||
// AppFontWidget: Manages application fonts which the user can load and
|
||||
// provides API for saving/restoring them.
|
||||
|
||||
class AppFontWidget : public QGroupBox
|
||||
{
|
||||
Q_DISABLE_COPY(AppFontWidget)
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit AppFontWidget(QWidget *parent = 0);
|
||||
|
||||
QStringList fontFiles() const;
|
||||
|
||||
static void save(QDesignerSettingsInterface *s, const QString &prefix);
|
||||
static void restore(const QDesignerSettingsInterface *s, const QString &prefix);
|
||||
|
||||
private slots:
|
||||
void addFiles();
|
||||
void slotRemoveFiles();
|
||||
void slotRemoveAll();
|
||||
void selectionChanged(const QItemSelection & selected, const QItemSelection & deselected);
|
||||
|
||||
private:
|
||||
QTreeView *m_view;
|
||||
QToolButton *m_addButton;
|
||||
QToolButton *m_removeButton;
|
||||
QToolButton *m_removeAllButton;
|
||||
AppFontModel *m_model;
|
||||
};
|
||||
|
||||
// AppFontDialog: Non modal dialog for AppFontWidget which has Qt::WA_DeleteOnClose set.
|
||||
|
||||
class AppFontDialog : public QDialog
|
||||
{
|
||||
Q_DISABLE_COPY(AppFontDialog)
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit AppFontDialog(QWidget *parent = 0);
|
||||
|
||||
private:
|
||||
AppFontWidget *m_appFontWidget;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QDESIGNER_APPFONTWIDGET_H
|
||||
175
third/designer/form/assistantclient.cpp
Normal file
@@ -0,0 +1,175 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "assistantclient.h"
|
||||
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QProcess>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QLibraryInfo>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QTextStream>
|
||||
#include <QtCore/QCoreApplication>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
enum { debugAssistantClient = 0 };
|
||||
|
||||
AssistantClient::AssistantClient() :
|
||||
m_process(0)
|
||||
{
|
||||
}
|
||||
|
||||
AssistantClient::~AssistantClient()
|
||||
{
|
||||
if (isRunning()) {
|
||||
m_process->terminate();
|
||||
m_process->waitForFinished();
|
||||
}
|
||||
delete m_process;
|
||||
}
|
||||
|
||||
bool AssistantClient::showPage(const QString &path, QString *errorMessage)
|
||||
{
|
||||
QString cmd = QLatin1String("SetSource ");
|
||||
cmd += path;
|
||||
return sendCommand(cmd, errorMessage);
|
||||
}
|
||||
|
||||
bool AssistantClient::activateIdentifier(const QString &identifier, QString *errorMessage)
|
||||
{
|
||||
QString cmd = QLatin1String("ActivateIdentifier ");
|
||||
cmd += identifier;
|
||||
return sendCommand(cmd, errorMessage);
|
||||
}
|
||||
|
||||
bool AssistantClient::activateKeyword(const QString &keyword, QString *errorMessage)
|
||||
{
|
||||
QString cmd = QLatin1String("ActivateKeyword ");
|
||||
cmd += keyword;
|
||||
return sendCommand(cmd, errorMessage);
|
||||
}
|
||||
|
||||
bool AssistantClient::sendCommand(const QString &cmd, QString *errorMessage)
|
||||
{
|
||||
if (debugAssistantClient)
|
||||
qDebug() << "sendCommand " << cmd;
|
||||
if (!ensureRunning(errorMessage))
|
||||
return false;
|
||||
if (!m_process->isWritable() || m_process->bytesToWrite() > 0) {
|
||||
*errorMessage = QCoreApplication::translate("AssistantClient", "Unable to send request: Assistant is not responding.");
|
||||
return false;
|
||||
}
|
||||
QTextStream str(m_process);
|
||||
str << cmd << QLatin1Char('\n') << endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssistantClient::isRunning() const
|
||||
{
|
||||
return m_process && m_process->state() != QProcess::NotRunning;
|
||||
}
|
||||
|
||||
QString AssistantClient::binary()
|
||||
{
|
||||
QString app = QLibraryInfo::location(QLibraryInfo::BinariesPath) + QDir::separator();
|
||||
#if !defined(Q_OS_MAC)
|
||||
app += QLatin1String("assistant");
|
||||
#else
|
||||
app += QLatin1String("Assistant.app/Contents/MacOS/Assistant");
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
app += QLatin1String(".exe");
|
||||
#endif
|
||||
|
||||
return app;
|
||||
}
|
||||
|
||||
bool AssistantClient::ensureRunning(QString *errorMessage)
|
||||
{
|
||||
if (isRunning())
|
||||
return true;
|
||||
|
||||
if (!m_process)
|
||||
m_process = new QProcess;
|
||||
|
||||
const QString app = binary();
|
||||
if (!QFileInfo(app).isFile()) {
|
||||
*errorMessage = QCoreApplication::translate("AssistantClient", "The binary '%1' does not exist.").arg(app);
|
||||
return false;
|
||||
}
|
||||
if (debugAssistantClient)
|
||||
qDebug() << "Running " << app;
|
||||
// run
|
||||
QStringList args(QLatin1String("-enableRemoteControl"));
|
||||
m_process->start(app, args);
|
||||
if (!m_process->waitForStarted()) {
|
||||
*errorMessage = QCoreApplication::translate("AssistantClient", "Unable to launch assistant (%1).").arg(app);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
QString AssistantClient::documentUrl(const QString &prefix, int qtVersion)
|
||||
{
|
||||
if (qtVersion == 0)
|
||||
qtVersion = QT_VERSION;
|
||||
QString rc;
|
||||
QTextStream(&rc) << QLatin1String("qthelp://com.trolltech.") << prefix << QLatin1Char('.')
|
||||
<< (qtVersion >> 16) << ((qtVersion >> 8) & 0xFF) << (qtVersion & 0xFF)
|
||||
<< QLatin1String("/qdoc/");
|
||||
return rc;
|
||||
}
|
||||
|
||||
QString AssistantClient::designerManualUrl(int qtVersion)
|
||||
{
|
||||
return documentUrl(QLatin1String("designer"), qtVersion);
|
||||
}
|
||||
|
||||
QString AssistantClient::qtReferenceManualUrl(int qtVersion)
|
||||
{
|
||||
return documentUrl(QLatin1String("qt"), qtVersion);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
83
third/designer/form/assistantclient.h
Normal file
@@ -0,0 +1,83 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef ASSISTANTCLIENT_H
|
||||
#define ASSISTANTCLIENT_H
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QProcess;
|
||||
class QString;
|
||||
|
||||
class AssistantClient
|
||||
{
|
||||
AssistantClient(const AssistantClient &);
|
||||
AssistantClient &operator=(const AssistantClient &);
|
||||
|
||||
public:
|
||||
AssistantClient();
|
||||
~AssistantClient();
|
||||
|
||||
bool showPage(const QString &path, QString *errorMessage);
|
||||
bool activateIdentifier(const QString &identifier, QString *errorMessage);
|
||||
bool activateKeyword(const QString &keyword, QString *errorMessage);
|
||||
|
||||
bool isRunning() const;
|
||||
|
||||
static QString documentUrl(const QString &prefix, int qtVersion = 0);
|
||||
// Root of the Qt Designer documentation
|
||||
static QString designerManualUrl(int qtVersion = 0);
|
||||
// Root of the Qt Reference documentation
|
||||
static QString qtReferenceManualUrl(int qtVersion = 0);
|
||||
|
||||
private:
|
||||
static QString binary();
|
||||
bool sendCommand(const QString &cmd, QString *errorMessage);
|
||||
bool ensureRunning(QString *errorMessage);
|
||||
|
||||
QProcess *m_process;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // ASSISTANTCLIENT_H
|
||||
308
third/designer/form/fontpanel.cpp
Normal file
@@ -0,0 +1,308 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the tools applications of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "fontpanel.h"
|
||||
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QtGui/QFormLayout>
|
||||
#include <QtGui/QSpacerItem>
|
||||
#include <QtGui/QFontComboBox>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtGui/QLineEdit>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
FontPanel::FontPanel(QWidget *parentWidget) :
|
||||
QGroupBox(parentWidget),
|
||||
m_previewLineEdit(new QLineEdit),
|
||||
m_writingSystemComboBox(new QComboBox),
|
||||
m_familyComboBox(new QFontComboBox),
|
||||
m_styleComboBox(new QComboBox),
|
||||
m_pointSizeComboBox(new QComboBox),
|
||||
m_previewFontUpdateTimer(0)
|
||||
{
|
||||
setTitle(tr("Font"));
|
||||
|
||||
QFormLayout *formLayout = new QFormLayout(this);
|
||||
// writing systems
|
||||
m_writingSystemComboBox->setEditable(false);
|
||||
|
||||
QList<QFontDatabase::WritingSystem> writingSystems = m_fontDatabase.writingSystems();
|
||||
writingSystems.push_front(QFontDatabase::Any);
|
||||
foreach (QFontDatabase::WritingSystem ws, writingSystems)
|
||||
m_writingSystemComboBox->addItem(QFontDatabase::writingSystemName(ws), QVariant(ws));
|
||||
connect(m_writingSystemComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotWritingSystemChanged(int)));
|
||||
formLayout->addRow(tr("&Writing system"), m_writingSystemComboBox);
|
||||
|
||||
connect(m_familyComboBox, SIGNAL(currentFontChanged(QFont)), this, SLOT(slotFamilyChanged(QFont)));
|
||||
formLayout->addRow(tr("&Family"), m_familyComboBox);
|
||||
|
||||
m_styleComboBox->setEditable(false);
|
||||
connect(m_styleComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotStyleChanged(int)));
|
||||
formLayout->addRow(tr("&Style"), m_styleComboBox);
|
||||
|
||||
m_pointSizeComboBox->setEditable(false);
|
||||
connect(m_pointSizeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotPointSizeChanged(int)));
|
||||
formLayout->addRow(tr("&Point size"), m_pointSizeComboBox);
|
||||
|
||||
m_previewLineEdit->setReadOnly(true);
|
||||
formLayout->addRow(m_previewLineEdit);
|
||||
|
||||
setWritingSystem(QFontDatabase::Any);
|
||||
}
|
||||
|
||||
QFont FontPanel::selectedFont() const
|
||||
{
|
||||
QFont rc = m_familyComboBox->currentFont();
|
||||
const QString family = rc.family();
|
||||
rc.setPointSize(pointSize());
|
||||
const QString styleDescription = styleString();
|
||||
if (styleDescription.contains(QLatin1String("Italic")))
|
||||
rc.setStyle(QFont::StyleItalic);
|
||||
else if (styleDescription.contains(QLatin1String("Oblique")))
|
||||
rc.setStyle(QFont::StyleOblique);
|
||||
else
|
||||
rc.setStyle(QFont::StyleNormal);
|
||||
rc.setBold(m_fontDatabase.bold(family, styleDescription));
|
||||
|
||||
// Weight < 0 asserts...
|
||||
const int weight = m_fontDatabase.weight(family, styleDescription);
|
||||
if (weight >= 0)
|
||||
rc.setWeight(weight);
|
||||
return rc;
|
||||
}
|
||||
|
||||
void FontPanel::setSelectedFont(const QFont &f)
|
||||
{
|
||||
m_familyComboBox->setCurrentFont(f);
|
||||
if (m_familyComboBox->currentIndex() < 0) {
|
||||
// family not in writing system - find the corresponding one?
|
||||
QList<QFontDatabase::WritingSystem> familyWritingSystems = m_fontDatabase.writingSystems(f.family());
|
||||
if (familyWritingSystems.empty())
|
||||
return;
|
||||
|
||||
setWritingSystem(familyWritingSystems.front());
|
||||
m_familyComboBox->setCurrentFont(f);
|
||||
}
|
||||
|
||||
updateFamily(family());
|
||||
|
||||
const int pointSizeIndex = closestPointSizeIndex(f.pointSize());
|
||||
m_pointSizeComboBox->setCurrentIndex( pointSizeIndex);
|
||||
|
||||
const QString styleString = m_fontDatabase.styleString(f);
|
||||
const int styleIndex = m_styleComboBox->findText(styleString);
|
||||
m_styleComboBox->setCurrentIndex(styleIndex);
|
||||
slotUpdatePreviewFont();
|
||||
}
|
||||
|
||||
|
||||
QFontDatabase::WritingSystem FontPanel::writingSystem() const
|
||||
{
|
||||
const int currentIndex = m_writingSystemComboBox->currentIndex();
|
||||
if ( currentIndex == -1)
|
||||
return QFontDatabase::Latin;
|
||||
return static_cast<QFontDatabase::WritingSystem>(m_writingSystemComboBox->itemData(currentIndex).toInt());
|
||||
}
|
||||
|
||||
QString FontPanel::family() const
|
||||
{
|
||||
const int currentIndex = m_familyComboBox->currentIndex();
|
||||
return currentIndex != -1 ? m_familyComboBox->currentFont().family() : QString();
|
||||
}
|
||||
|
||||
int FontPanel::pointSize() const
|
||||
{
|
||||
const int currentIndex = m_pointSizeComboBox->currentIndex();
|
||||
return currentIndex != -1 ? m_pointSizeComboBox->itemData(currentIndex).toInt() : 9;
|
||||
}
|
||||
|
||||
QString FontPanel::styleString() const
|
||||
{
|
||||
const int currentIndex = m_styleComboBox->currentIndex();
|
||||
return currentIndex != -1 ? m_styleComboBox->itemText(currentIndex) : QString();
|
||||
}
|
||||
|
||||
void FontPanel::setWritingSystem(QFontDatabase::WritingSystem ws)
|
||||
{
|
||||
m_writingSystemComboBox->setCurrentIndex(m_writingSystemComboBox->findData(QVariant(ws)));
|
||||
updateWritingSystem(ws);
|
||||
}
|
||||
|
||||
|
||||
void FontPanel::slotWritingSystemChanged(int)
|
||||
{
|
||||
updateWritingSystem(writingSystem());
|
||||
delayedPreviewFontUpdate();
|
||||
}
|
||||
|
||||
void FontPanel::slotFamilyChanged(const QFont &)
|
||||
{
|
||||
updateFamily(family());
|
||||
delayedPreviewFontUpdate();
|
||||
}
|
||||
|
||||
void FontPanel::slotStyleChanged(int)
|
||||
{
|
||||
updatePointSizes(family(), styleString());
|
||||
delayedPreviewFontUpdate();
|
||||
}
|
||||
|
||||
void FontPanel::slotPointSizeChanged(int)
|
||||
{
|
||||
delayedPreviewFontUpdate();
|
||||
}
|
||||
|
||||
void FontPanel::updateWritingSystem(QFontDatabase::WritingSystem ws)
|
||||
{
|
||||
|
||||
m_previewLineEdit->setText(QFontDatabase::writingSystemSample(ws));
|
||||
m_familyComboBox->setWritingSystem (ws);
|
||||
// Current font not in WS ... set index 0.
|
||||
if (m_familyComboBox->currentIndex() < 0) {
|
||||
m_familyComboBox->setCurrentIndex(0);
|
||||
updateFamily(family());
|
||||
}
|
||||
}
|
||||
|
||||
void FontPanel::updateFamily(const QString &family)
|
||||
{
|
||||
// Update styles and trigger update of point sizes.
|
||||
// Try to maintain selection or select normal
|
||||
const QString oldStyleString = styleString();
|
||||
|
||||
const QStringList styles = m_fontDatabase.styles(family);
|
||||
const bool hasStyles = !styles.empty();
|
||||
|
||||
m_styleComboBox->setCurrentIndex(-1);
|
||||
m_styleComboBox->clear();
|
||||
m_styleComboBox->setEnabled(hasStyles);
|
||||
|
||||
int normalIndex = -1;
|
||||
const QString normalStyle = QLatin1String("Normal");
|
||||
|
||||
if (hasStyles) {
|
||||
foreach (const QString &style, styles) {
|
||||
// try to maintain selection or select 'normal' preferably
|
||||
const int newIndex = m_styleComboBox->count();
|
||||
m_styleComboBox->addItem(style);
|
||||
if (oldStyleString == style) {
|
||||
m_styleComboBox->setCurrentIndex(newIndex);
|
||||
} else {
|
||||
if (oldStyleString == normalStyle)
|
||||
normalIndex = newIndex;
|
||||
}
|
||||
}
|
||||
if (m_styleComboBox->currentIndex() == -1 && normalIndex != -1)
|
||||
m_styleComboBox->setCurrentIndex(normalIndex);
|
||||
}
|
||||
updatePointSizes(family, styleString());
|
||||
}
|
||||
|
||||
int FontPanel::closestPointSizeIndex(int desiredPointSize) const
|
||||
{
|
||||
// try to maintain selection or select closest.
|
||||
int closestIndex = -1;
|
||||
int closestAbsError = 0xFFFF;
|
||||
|
||||
const int pointSizeCount = m_pointSizeComboBox->count();
|
||||
for (int i = 0; i < pointSizeCount; i++) {
|
||||
const int itemPointSize = m_pointSizeComboBox->itemData(i).toInt();
|
||||
const int absError = qAbs(desiredPointSize - itemPointSize);
|
||||
if (absError < closestAbsError) {
|
||||
closestIndex = i;
|
||||
closestAbsError = absError;
|
||||
if (closestAbsError == 0)
|
||||
break;
|
||||
} else { // past optimum
|
||||
if (absError > closestAbsError) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return closestIndex;
|
||||
}
|
||||
|
||||
|
||||
void FontPanel::updatePointSizes(const QString &family, const QString &styleString)
|
||||
{
|
||||
const int oldPointSize = pointSize();
|
||||
|
||||
QList<int> pointSizes = m_fontDatabase.pointSizes(family, styleString);
|
||||
if (pointSizes.empty())
|
||||
pointSizes = QFontDatabase::standardSizes();
|
||||
|
||||
const bool hasSizes = !pointSizes.empty();
|
||||
m_pointSizeComboBox->clear();
|
||||
m_pointSizeComboBox->setEnabled(hasSizes);
|
||||
m_pointSizeComboBox->setCurrentIndex(-1);
|
||||
|
||||
// try to maintain selection or select closest.
|
||||
if (hasSizes) {
|
||||
QString n;
|
||||
foreach (int pointSize, pointSizes)
|
||||
m_pointSizeComboBox->addItem(n.setNum(pointSize), QVariant(pointSize));
|
||||
const int closestIndex = closestPointSizeIndex(oldPointSize);
|
||||
if (closestIndex != -1)
|
||||
m_pointSizeComboBox->setCurrentIndex(closestIndex);
|
||||
}
|
||||
}
|
||||
|
||||
void FontPanel::slotUpdatePreviewFont()
|
||||
{
|
||||
m_previewLineEdit->setFont(selectedFont());
|
||||
}
|
||||
|
||||
void FontPanel::delayedPreviewFontUpdate()
|
||||
{
|
||||
if (!m_previewFontUpdateTimer) {
|
||||
m_previewFontUpdateTimer = new QTimer(this);
|
||||
connect(m_previewFontUpdateTimer, SIGNAL(timeout()), this, SLOT(slotUpdatePreviewFont()));
|
||||
m_previewFontUpdateTimer->setInterval(0);
|
||||
m_previewFontUpdateTimer->setSingleShot(true);
|
||||
}
|
||||
if (m_previewFontUpdateTimer->isActive())
|
||||
return;
|
||||
m_previewFontUpdateTimer->start();
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
108
third/designer/form/fontpanel.h
Normal file
@@ -0,0 +1,108 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the tools applications of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of the Qt tools. This header
|
||||
// file may change from version to version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#ifndef FONTPANEL_H
|
||||
#define FONTPANEL_H
|
||||
|
||||
#include <QtGui/QGroupBox>
|
||||
#include <QtGui/QFont>
|
||||
#include <QtGui/QFontDatabase>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QComboBox;
|
||||
class QFontComboBox;
|
||||
class QTimer;
|
||||
class QLineEdit;
|
||||
|
||||
class FontPanel: public QGroupBox
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
FontPanel(QWidget *parentWidget = 0);
|
||||
|
||||
QFont selectedFont() const;
|
||||
void setSelectedFont(const QFont &);
|
||||
|
||||
QFontDatabase::WritingSystem writingSystem() const;
|
||||
void setWritingSystem(QFontDatabase::WritingSystem ws);
|
||||
|
||||
private slots:
|
||||
void slotWritingSystemChanged(int);
|
||||
void slotFamilyChanged(const QFont &);
|
||||
void slotStyleChanged(int);
|
||||
void slotPointSizeChanged(int);
|
||||
void slotUpdatePreviewFont();
|
||||
|
||||
private:
|
||||
QString family() const;
|
||||
QString styleString() const;
|
||||
int pointSize() const;
|
||||
int closestPointSizeIndex(int ps) const;
|
||||
|
||||
void updateWritingSystem(QFontDatabase::WritingSystem ws);
|
||||
void updateFamily(const QString &family);
|
||||
void updatePointSizes(const QString &family, const QString &style);
|
||||
void delayedPreviewFontUpdate();
|
||||
|
||||
QFontDatabase m_fontDatabase;
|
||||
QLineEdit *m_previewLineEdit;
|
||||
QComboBox *m_writingSystemComboBox;
|
||||
QFontComboBox* m_familyComboBox;
|
||||
QComboBox *m_styleComboBox;
|
||||
QComboBox *m_pointSizeComboBox;
|
||||
QTimer *m_previewFontUpdateTimer;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // FONTPANEL_H
|
||||
26
third/designer/form/form.pri
Normal file
@@ -0,0 +1,26 @@
|
||||
FORMS += \
|
||||
$$PWD/preferencesdialog.ui \
|
||||
$$PWD/qttoolbardialog.ui \
|
||||
$$PWD/saveformastemplate.ui
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/appfontdialog.h \
|
||||
$$PWD/assistantclient.h \
|
||||
$$PWD/fontpanel.h \
|
||||
$$PWD/mainwindow.h \
|
||||
$$PWD/newform.h \
|
||||
$$PWD/preferencesdialog.h \
|
||||
$$PWD/qttoolbardialog.h \
|
||||
$$PWD/saveformastemplate.h \
|
||||
$$PWD/versiondialog.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/appfontdialog.cpp \
|
||||
$$PWD/assistantclient.cpp \
|
||||
$$PWD/fontpanel.cpp \
|
||||
$$PWD/mainwindow.cpp \
|
||||
$$PWD/newform.cpp \
|
||||
$$PWD/preferencesdialog.cpp \
|
||||
$$PWD/qttoolbardialog.cpp \
|
||||
$$PWD/saveformastemplate.cpp \
|
||||
$$PWD/versiondialog.cpp
|
||||
419
third/designer/form/mainwindow.cpp
Normal file
@@ -0,0 +1,419 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "qdesigner.h"
|
||||
#include "qdesigner_actions.h"
|
||||
#include "qdesigner_workbench.h"
|
||||
#include "qdesigner_formwindow.h"
|
||||
#include "qdesigner_toolwindow.h"
|
||||
#include "qdesigner_settings.h"
|
||||
#include "qttoolbardialog.h"
|
||||
|
||||
#include <QtDesigner/QDesignerFormWindowInterface>
|
||||
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QCloseEvent>
|
||||
#include <QtGui/QToolBar>
|
||||
#include <QtGui/QMdiSubWindow>
|
||||
#include <QtGui/QStatusBar>
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/QLayout>
|
||||
#include <QtGui/QDockWidget>
|
||||
|
||||
#include <QtCore/QUrl>
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
static const char *uriListMimeFormatC = "text/uri-list";
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
typedef QList<QAction *> ActionList;
|
||||
|
||||
// Helpers for creating toolbars and menu
|
||||
|
||||
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->property(QDesignerActions::defaultToolbarPropertyName).toBool())
|
||||
t->addAction(action);
|
||||
}
|
||||
}
|
||||
static QToolBar *createToolBar(const QString &title, const QString &objectName, const ActionList &actions)
|
||||
{
|
||||
QToolBar *rc = new QToolBar;
|
||||
rc->setObjectName(objectName);
|
||||
rc->setWindowTitle(title);
|
||||
addActionsToToolBar(actions, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
// ---------------- MainWindowBase
|
||||
|
||||
MainWindowBase::MainWindowBase(QWidget *parent, Qt::WindowFlags flags) :
|
||||
QMainWindow(parent, flags),
|
||||
m_policy(AcceptCloseEvents)
|
||||
{
|
||||
#ifndef Q_WS_MAC
|
||||
setWindowIcon(qDesigner->windowIcon());
|
||||
#endif
|
||||
}
|
||||
|
||||
void MainWindowBase::closeEvent(QCloseEvent *e)
|
||||
{
|
||||
switch (m_policy) {
|
||||
case AcceptCloseEvents:
|
||||
QMainWindow::closeEvent(e);
|
||||
break;
|
||||
case EmitCloseEventSignal:
|
||||
emit closeEventReceived(e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
QToolBar *main = createToolBar(tr("Main"), QLatin1String("mainToolBar"), actions->fileActions()->actions());
|
||||
addActionsToToolBar(actions->editActions()->actions(), main);
|
||||
addActionsToToolBar(actions->toolActions()->actions(), main);
|
||||
addActionsToToolBar(actions->formActions()->actions(), main);
|
||||
rc.push_back(main);
|
||||
} else {
|
||||
rc.push_back(createToolBar(tr("File"), QLatin1String("fileToolBar"), actions->fileActions()->actions()));
|
||||
rc.push_back(createToolBar(tr("Edit"), QLatin1String("editToolBar"), actions->editActions()->actions()));
|
||||
rc.push_back(createToolBar(tr("Tools"), QLatin1String("toolsToolBar"), actions->toolActions()->actions()));
|
||||
rc.push_back(createToolBar(tr("Form"), QLatin1String("formToolBar"), actions->formActions()->actions()));
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
QString MainWindowBase::mainWindowTitle()
|
||||
{
|
||||
return tr("Qt Designer");
|
||||
}
|
||||
|
||||
// Use the minor Qt version as settings versions to avoid conflicts
|
||||
int MainWindowBase::settingsVersion()
|
||||
{
|
||||
const int version = QT_VERSION;
|
||||
return (version & 0x00FF00) >> 8;
|
||||
}
|
||||
|
||||
// ----------------- DockedMdiArea
|
||||
|
||||
DockedMdiArea::DockedMdiArea(const QString &extension, QWidget *parent) :
|
||||
QMdiArea(parent),
|
||||
m_extension(extension)
|
||||
{
|
||||
setAcceptDrops(true);
|
||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
}
|
||||
|
||||
QStringList DockedMdiArea::uiFiles(const QMimeData *d) const
|
||||
{
|
||||
// Extract dropped UI files from Mime data.
|
||||
QStringList rc;
|
||||
if (!d->hasFormat(QLatin1String(uriListMimeFormatC)))
|
||||
return rc;
|
||||
const QList<QUrl> urls = d->urls();
|
||||
if (urls.empty())
|
||||
return rc;
|
||||
const QList<QUrl>::const_iterator cend = urls.constEnd();
|
||||
for (QList<QUrl>::const_iterator it = urls.constBegin(); it != cend; ++it) {
|
||||
const QString fileName = it->toLocalFile();
|
||||
if (!fileName.isEmpty() && fileName.endsWith(m_extension))
|
||||
rc.push_back(fileName);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
bool DockedMdiArea::event(QEvent *event)
|
||||
{
|
||||
// Listen for desktop file manager drop and emit a signal once a file is
|
||||
// dropped.
|
||||
switch (event->type()) {
|
||||
case QEvent::DragEnter: {
|
||||
QDragEnterEvent *e = static_cast<QDragEnterEvent*>(event);
|
||||
if (!uiFiles(e->mimeData()).empty()) {
|
||||
e->acceptProposedAction();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case QEvent::Drop: {
|
||||
QDropEvent *e = static_cast<QDropEvent*>(event);
|
||||
const QStringList files = uiFiles(e->mimeData());
|
||||
const QStringList::const_iterator cend = files.constEnd();
|
||||
for (QStringList::const_iterator it = files.constBegin(); it != cend; ++it) {
|
||||
emit fileDropped(*it);
|
||||
}
|
||||
e->acceptProposedAction();
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return QMdiArea::event(event);
|
||||
}
|
||||
|
||||
// ------------- ToolBarManager:
|
||||
|
||||
static void addActionsToToolBarManager(const ActionList &al, const QString &title, QtToolBarManager *tbm)
|
||||
{
|
||||
const ActionList::const_iterator cend = al.constEnd();
|
||||
for (ActionList::const_iterator it = al.constBegin(); it != cend; ++it)
|
||||
tbm->addAction(*it, title);
|
||||
}
|
||||
|
||||
ToolBarManager::ToolBarManager(QMainWindow *configureableMainWindow,
|
||||
QWidget *parent,
|
||||
QMenu *toolBarMenu,
|
||||
const QDesignerActions *actions,
|
||||
const QList<QToolBar *> &toolbars,
|
||||
const QList<QDesignerToolWindow*> &toolWindows) :
|
||||
QObject(parent),
|
||||
m_configureableMainWindow(configureableMainWindow),
|
||||
m_parent(parent),
|
||||
m_toolBarMenu(toolBarMenu),
|
||||
m_manager(new QtToolBarManager(this)),
|
||||
m_configureAction(new QAction(tr("Configure Toolbars..."), this)),
|
||||
m_toolbars(toolbars)
|
||||
{
|
||||
m_configureAction->setMenuRole(QAction::NoRole);
|
||||
m_configureAction->setObjectName(QLatin1String("__qt_configure_tool_bars_action"));
|
||||
connect(m_configureAction, SIGNAL(triggered()), this, SLOT(configureToolBars()));
|
||||
|
||||
m_manager->setMainWindow(configureableMainWindow);
|
||||
|
||||
foreach(QToolBar *tb, m_toolbars) {
|
||||
const QString title = tb->windowTitle();
|
||||
m_manager->addToolBar(tb, title);
|
||||
addActionsToToolBarManager(tb->actions(), title, m_manager);
|
||||
}
|
||||
|
||||
addActionsToToolBarManager(actions->windowActions()->actions(), tr("Window"), m_manager);
|
||||
addActionsToToolBarManager(actions->helpActions()->actions(), tr("Help"), m_manager);
|
||||
|
||||
// Filter out the device profile preview actions which have int data().
|
||||
ActionList previewActions = actions->styleActions()->actions();
|
||||
ActionList::iterator it = previewActions.begin();
|
||||
for ( ; (*it)->isSeparator() || (*it)->data().type() == QVariant::Int; ++it) ;
|
||||
previewActions.erase(previewActions.begin(), it);
|
||||
addActionsToToolBarManager(previewActions, tr("Style"), m_manager);
|
||||
|
||||
const QString dockTitle = tr("Dock views");
|
||||
foreach (QDesignerToolWindow *tw, toolWindows) {
|
||||
if (QAction *action = tw->action())
|
||||
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();
|
||||
}
|
||||
|
||||
// sort function for sorting tool bars alphabetically by title [non-static since called from template]
|
||||
|
||||
bool toolBarTitleLessThan(const QToolBar *t1, const QToolBar *t2)
|
||||
{
|
||||
return t1->windowTitle() < t2->windowTitle();
|
||||
}
|
||||
|
||||
void ToolBarManager::updateToolBarMenu()
|
||||
{
|
||||
// Sort tool bars alphabetically by title
|
||||
qStableSort(m_toolbars.begin(), m_toolbars.end(), toolBarTitleLessThan);
|
||||
// add to menu
|
||||
m_toolBarMenu->clear();
|
||||
foreach (QToolBar *tb, m_toolbars)
|
||||
m_toolBarMenu->addAction(tb->toggleViewAction());
|
||||
m_toolBarMenu->addAction(m_configureAction);
|
||||
}
|
||||
|
||||
void ToolBarManager::configureToolBars()
|
||||
{
|
||||
// QtToolBarDialog dlg(m_parent);
|
||||
// dlg.setWindowFlags(dlg.windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
// dlg.setToolBarManager(m_manager);
|
||||
// dlg.exec();
|
||||
// updateToolBarMenu();
|
||||
}
|
||||
|
||||
QByteArray ToolBarManager::saveState(int version) const
|
||||
{
|
||||
return m_manager->saveState(version);
|
||||
}
|
||||
|
||||
bool ToolBarManager::restoreState(const QByteArray &state, int version)
|
||||
{
|
||||
return m_manager->restoreState(state, version);
|
||||
}
|
||||
|
||||
// ---------- DockedMainWindow
|
||||
|
||||
DockedMainWindow::DockedMainWindow(QDesignerWorkbench *wb,
|
||||
QMenu *toolBarMenu,
|
||||
const QList<QDesignerToolWindow*> &toolWindows) :
|
||||
m_toolBarManager(0)
|
||||
{
|
||||
setObjectName(QLatin1String("MDIWindow"));
|
||||
setWindowTitle(mainWindowTitle());
|
||||
|
||||
const QList<QToolBar *> toolbars = createToolBars(wb->actionManager(), false);
|
||||
foreach (QToolBar *tb, toolbars)
|
||||
addToolBar(tb);
|
||||
DockedMdiArea *dma = new DockedMdiArea(wb->actionManager()->uiExtension());
|
||||
connect(dma, SIGNAL(fileDropped(QString)),
|
||||
this, SIGNAL(fileDropped(QString)));
|
||||
connect(dma, SIGNAL(subWindowActivated(QMdiSubWindow*)),
|
||||
this, SLOT(slotSubWindowActivated(QMdiSubWindow*)));
|
||||
setCentralWidget(dma);
|
||||
|
||||
QStatusBar *sb = statusBar();
|
||||
Q_UNUSED(sb)
|
||||
|
||||
m_toolBarManager = new ToolBarManager(this, this, toolBarMenu, wb->actionManager(), toolbars, toolWindows);
|
||||
}
|
||||
|
||||
QMdiArea *DockedMainWindow::mdiArea() const
|
||||
{
|
||||
return static_cast<QMdiArea *>(centralWidget());
|
||||
}
|
||||
|
||||
void DockedMainWindow::slotSubWindowActivated(QMdiSubWindow* subWindow)
|
||||
{
|
||||
if (subWindow) {
|
||||
QWidget *widget = subWindow->widget();
|
||||
if (QDesignerFormWindow *fw = qobject_cast<QDesignerFormWindow*>(widget)) {
|
||||
emit formWindowActivated(fw);
|
||||
mdiArea()->setActiveSubWindow(subWindow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create a MDI subwindow for the form.
|
||||
QMdiSubWindow *DockedMainWindow::createMdiSubWindow(QWidget *fw, Qt::WindowFlags f, const QKeySequence &designerCloseActionShortCut)
|
||||
{
|
||||
QMdiSubWindow *rc = mdiArea()->addSubWindow(fw, f);
|
||||
// Make action shortcuts respond only if focused to avoid conflicts with
|
||||
// designer menu actions
|
||||
if (designerCloseActionShortCut == QKeySequence(QKeySequence::Close)) {
|
||||
const ActionList systemMenuActions = rc->systemMenu()->actions();
|
||||
if (!systemMenuActions.empty()) {
|
||||
const ActionList::const_iterator cend = systemMenuActions.constEnd();
|
||||
for (ActionList::const_iterator it = systemMenuActions.constBegin(); it != cend; ++it) {
|
||||
if ( (*it)->shortcut() == designerCloseActionShortCut) {
|
||||
(*it)->setShortcutContext(Qt::WidgetShortcut);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
DockedMainWindow::DockWidgetList DockedMainWindow::addToolWindows(const DesignerToolWindowList &tls)
|
||||
{
|
||||
DockWidgetList rc;
|
||||
foreach (QDesignerToolWindow *tw, tls) {
|
||||
QDockWidget *dockWidget = new QDockWidget;
|
||||
dockWidget->setObjectName(tw->objectName() + QLatin1String("_dock"));
|
||||
dockWidget->setWindowTitle(tw->windowTitle());
|
||||
addDockWidget(tw->dockWidgetAreaHint(), dockWidget);
|
||||
dockWidget->setWidget(tw);
|
||||
rc.push_back(dockWidget);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
// Settings consist of MainWindow state and tool bar manager state
|
||||
void DockedMainWindow::restoreSettings(const QDesignerSettings &s, const DockWidgetList &dws, const QRect &desktopArea)
|
||||
{
|
||||
const int version = settingsVersion();
|
||||
m_toolBarManager->restoreState(s.toolBarsState(DockedMode), version);
|
||||
|
||||
// If there are no old geometry settings, show the window maximized
|
||||
s.restoreGeometry(this, QRect(desktopArea.topLeft(), QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX)));
|
||||
|
||||
const QByteArray mainWindowState = s.mainWindowState(DockedMode);
|
||||
const bool restored = !mainWindowState.isEmpty() && restoreState(mainWindowState, version);
|
||||
if (!restored) {
|
||||
// Default: Tabify less relevant windows bottom/right.
|
||||
tabifyDockWidget(dws.at(QDesignerToolWindow::SignalSlotEditor),
|
||||
dws.at(QDesignerToolWindow::ActionEditor));
|
||||
tabifyDockWidget(dws.at(QDesignerToolWindow::ActionEditor),
|
||||
dws.at(QDesignerToolWindow::ResourceEditor));
|
||||
}
|
||||
}
|
||||
|
||||
void DockedMainWindow::saveSettings(QDesignerSettings &s) const
|
||||
{
|
||||
const int version = settingsVersion();
|
||||
s.setToolBarsState(DockedMode, m_toolBarManager->saveState(version));
|
||||
s.saveGeometryFor(this);
|
||||
s.setMainWindowState(DockedMode, saveState(version));
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
187
third/designer/form/mainwindow.h
Normal file
@@ -0,0 +1,187 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtCore/QList>
|
||||
#include <QtGui/QMdiArea>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QDesignerActions;
|
||||
class QDesignerWorkbench;
|
||||
class QDesignerToolWindow;
|
||||
class QDesignerFormWindow;
|
||||
class QDesignerSettings;
|
||||
|
||||
class QtToolBarManager;
|
||||
class QToolBar;
|
||||
class QMdiArea;
|
||||
class QMenu;
|
||||
class QByteArray;
|
||||
class QMimeData;
|
||||
|
||||
/* A main window that has a configureable policy on handling close events. If
|
||||
* enabled, it can forward the close event to external handlers.
|
||||
* Base class for windows that can switch roles between tool windows
|
||||
* and main windows. */
|
||||
|
||||
class MainWindowBase: public QMainWindow
|
||||
{
|
||||
Q_DISABLE_COPY(MainWindowBase)
|
||||
Q_OBJECT
|
||||
protected:
|
||||
explicit MainWindowBase(QWidget *parent = 0, Qt::WindowFlags flags = Qt::Window);
|
||||
|
||||
public:
|
||||
enum CloseEventPolicy {
|
||||
/* Always accept close events */
|
||||
AcceptCloseEvents,
|
||||
/* Emit a signal with the event, have it handled elsewhere */
|
||||
EmitCloseEventSignal };
|
||||
|
||||
CloseEventPolicy closeEventPolicy() const { return m_policy; }
|
||||
void setCloseEventPolicy(CloseEventPolicy pol) { m_policy = pol; }
|
||||
|
||||
static QList<QToolBar *> createToolBars(const QDesignerActions *actions, bool singleToolBar);
|
||||
static QString mainWindowTitle();
|
||||
|
||||
// Use the minor Qt version as settings versions to avoid conflicts
|
||||
static int settingsVersion();
|
||||
|
||||
signals:
|
||||
void closeEventReceived(QCloseEvent *e);
|
||||
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent *e);
|
||||
private:
|
||||
CloseEventPolicy m_policy;
|
||||
};
|
||||
|
||||
/* An MdiArea that listens for desktop file manager file drop events and emits
|
||||
* a signal to open a dropped file. */
|
||||
class DockedMdiArea : public QMdiArea
|
||||
{
|
||||
Q_DISABLE_COPY(DockedMdiArea)
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DockedMdiArea(const QString &extension, QWidget *parent = 0);
|
||||
|
||||
signals:
|
||||
void fileDropped(const QString &);
|
||||
|
||||
protected:
|
||||
bool event (QEvent *event);
|
||||
|
||||
private:
|
||||
QStringList uiFiles(const QMimeData *d) const;
|
||||
|
||||
const QString m_extension;
|
||||
};
|
||||
|
||||
// Convenience class that manages a QtToolBarManager and an action to trigger
|
||||
// it on a mainwindow.
|
||||
class ToolBarManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(ToolBarManager)
|
||||
public:
|
||||
explicit ToolBarManager(QMainWindow *configureableMainWindow,
|
||||
QWidget *parent,
|
||||
QMenu *toolBarMenu,
|
||||
const QDesignerActions *actions,
|
||||
const QList<QToolBar *> &toolbars,
|
||||
const QList<QDesignerToolWindow*> &toolWindows);
|
||||
|
||||
QByteArray saveState(int version = 0) const;
|
||||
bool restoreState(const QByteArray &state, int version = 0);
|
||||
|
||||
private slots:
|
||||
void configureToolBars();
|
||||
void updateToolBarMenu();
|
||||
|
||||
private:
|
||||
QMainWindow *m_configureableMainWindow;
|
||||
QWidget *m_parent;
|
||||
QMenu *m_toolBarMenu;
|
||||
QtToolBarManager *m_manager;
|
||||
QAction *m_configureAction;
|
||||
QList<QToolBar *> m_toolbars;
|
||||
};
|
||||
|
||||
/* Main window to be used for docked mode */
|
||||
class DockedMainWindow : public MainWindowBase {
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(DockedMainWindow)
|
||||
public:
|
||||
typedef QList<QDesignerToolWindow*> DesignerToolWindowList;
|
||||
typedef QList<QDockWidget *> DockWidgetList;
|
||||
|
||||
explicit DockedMainWindow(QDesignerWorkbench *wb,
|
||||
QMenu *toolBarMenu,
|
||||
const DesignerToolWindowList &toolWindows);
|
||||
|
||||
// Create a MDI subwindow for the form.
|
||||
QMdiSubWindow *createMdiSubWindow(QWidget *fw, Qt::WindowFlags f, const QKeySequence &designerCloseActionShortCut);
|
||||
|
||||
QMdiArea *mdiArea() const;
|
||||
|
||||
DockWidgetList addToolWindows(const DesignerToolWindowList &toolWindows);
|
||||
|
||||
void restoreSettings(const QDesignerSettings &s, const DockWidgetList &dws, const QRect &desktopArea);
|
||||
void saveSettings(QDesignerSettings &) const;
|
||||
|
||||
signals:
|
||||
void fileDropped(const QString &);
|
||||
void formWindowActivated(QDesignerFormWindow *);
|
||||
|
||||
private slots:
|
||||
void slotSubWindowActivated(QMdiSubWindow*);
|
||||
|
||||
private:
|
||||
ToolBarManager *m_toolBarManager;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
229
third/designer/form/newform.cpp
Normal file
@@ -0,0 +1,229 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "newform.h"
|
||||
#include "qdesigner_workbench.h"
|
||||
#include "qdesigner_actions.h"
|
||||
#include "qdesigner_formwindow.h"
|
||||
#include "qdesigner_settings.h"
|
||||
|
||||
#include <newformwidget_p.h>
|
||||
|
||||
#include <QtDesigner/QDesignerFormEditorInterface>
|
||||
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QTemporaryFile>
|
||||
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QVBoxLayout>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QDialogButtonBox>
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/QCheckBox>
|
||||
#include <QtGui/QFrame>
|
||||
#include <QtGui/QMessageBox>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
NewForm::NewForm(QDesignerWorkbench *workbench, QWidget *parentWidget, const QString &fileName)
|
||||
: QDialog(parentWidget,
|
||||
#ifdef Q_WS_MAC
|
||||
Qt::Tool |
|
||||
#endif
|
||||
Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
|
||||
m_fileName(fileName),
|
||||
m_newFormWidget(QDesignerNewFormWidgetInterface::createNewFormWidget(workbench->core())),
|
||||
m_workbench(workbench),
|
||||
m_chkShowOnStartup(new QCheckBox(tr("Show this Dialog on Startup"))),
|
||||
m_createButton(new QPushButton(QApplication::translate("NewForm", "C&reate", 0, QApplication::UnicodeUTF8))),
|
||||
m_recentButton(new QPushButton(QApplication::translate("NewForm", "Recent", 0, QApplication::UnicodeUTF8))),
|
||||
m_buttonBox(0)
|
||||
{
|
||||
setWindowTitle(tr("New Form"));
|
||||
QDesignerSettings settings(m_workbench->core());
|
||||
|
||||
QVBoxLayout *vBoxLayout = new QVBoxLayout;
|
||||
|
||||
connect(m_newFormWidget, SIGNAL(templateActivated()), this, SLOT(slotTemplateActivated()));
|
||||
connect(m_newFormWidget, SIGNAL(currentTemplateChanged(bool)), this, SLOT(slotCurrentTemplateChanged(bool)));
|
||||
vBoxLayout->addWidget(m_newFormWidget);
|
||||
|
||||
QFrame *horizontalLine = new QFrame;
|
||||
horizontalLine->setFrameShape(QFrame::HLine);
|
||||
horizontalLine->setFrameShadow(QFrame::Sunken);
|
||||
vBoxLayout->addWidget(horizontalLine);
|
||||
|
||||
m_chkShowOnStartup->setChecked(settings.showNewFormOnStartup());
|
||||
vBoxLayout->addWidget(m_chkShowOnStartup);
|
||||
|
||||
m_buttonBox = createButtonBox();
|
||||
vBoxLayout->addWidget(m_buttonBox);
|
||||
setLayout(vBoxLayout);
|
||||
|
||||
resize(500, 400);
|
||||
slotCurrentTemplateChanged(m_newFormWidget->hasCurrentTemplate());
|
||||
}
|
||||
|
||||
QDialogButtonBox *NewForm::createButtonBox()
|
||||
{
|
||||
// Dialog buttons with 'recent files'
|
||||
QDialogButtonBox *buttonBox = new QDialogButtonBox;
|
||||
buttonBox->addButton(QApplication::translate("NewForm", "&Close", 0,
|
||||
QApplication::UnicodeUTF8), QDialogButtonBox::RejectRole);
|
||||
buttonBox->addButton(m_createButton, QDialogButtonBox::AcceptRole);
|
||||
buttonBox->addButton(QApplication::translate("NewForm", "&Open...", 0,
|
||||
QApplication::UnicodeUTF8), QDialogButtonBox::ActionRole);
|
||||
buttonBox->addButton(m_recentButton, QDialogButtonBox::ActionRole);
|
||||
|
||||
QDesignerActions *da = m_workbench->actionManager();
|
||||
|
||||
QMenu *recentFilesMenu = new QMenu(tr("&Recent Forms"), m_recentButton);
|
||||
// Pop the "Recent Files" stuff in here.
|
||||
const QList<QAction *> recentActions = da->recentFilesActions()->actions();
|
||||
if (!recentActions.empty()) {
|
||||
const QList<QAction *>::const_iterator acend = recentActions.constEnd();
|
||||
for (QList<QAction *>::const_iterator it = recentActions.constBegin(); it != acend; ++it) {
|
||||
recentFilesMenu->addAction(*it);
|
||||
connect(*it, SIGNAL(triggered()), this, SLOT(recentFileChosen()));
|
||||
}
|
||||
}
|
||||
m_recentButton->setMenu(recentFilesMenu);
|
||||
connect(buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(slotButtonBoxClicked(QAbstractButton*)));
|
||||
return buttonBox;
|
||||
}
|
||||
|
||||
NewForm::~NewForm()
|
||||
{
|
||||
QDesignerSettings settings (m_workbench->core());
|
||||
settings.setShowNewFormOnStartup(m_chkShowOnStartup->isChecked());
|
||||
}
|
||||
|
||||
void NewForm::recentFileChosen()
|
||||
{
|
||||
QAction *action = qobject_cast<QAction *>(sender());
|
||||
if (!action)
|
||||
return;
|
||||
if (action->objectName() == QLatin1String("__qt_action_clear_menu_"))
|
||||
return;
|
||||
close();
|
||||
}
|
||||
|
||||
void NewForm::slotCurrentTemplateChanged(bool templateSelected)
|
||||
{
|
||||
if (templateSelected) {
|
||||
m_createButton->setEnabled(true);
|
||||
m_createButton->setDefault(true);
|
||||
} else {
|
||||
m_createButton->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void NewForm::slotTemplateActivated()
|
||||
{
|
||||
m_createButton->animateClick(0);
|
||||
}
|
||||
|
||||
void NewForm::slotButtonBoxClicked(QAbstractButton *btn)
|
||||
{
|
||||
switch (m_buttonBox->buttonRole(btn)) {
|
||||
case QDialogButtonBox::RejectRole:
|
||||
reject();
|
||||
break;
|
||||
case QDialogButtonBox::ActionRole:
|
||||
if (btn != m_recentButton) {
|
||||
m_fileName.clear();
|
||||
if (m_workbench->actionManager()->openForm(this))
|
||||
accept();
|
||||
}
|
||||
break;
|
||||
case QDialogButtonBox::AcceptRole: {
|
||||
QString errorMessage;
|
||||
if (openTemplate(&errorMessage)) {
|
||||
accept();
|
||||
} else {
|
||||
QMessageBox::warning(this, tr("Read error"), errorMessage);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool NewForm::openTemplate(QString *ptrToErrorMessage)
|
||||
{
|
||||
const QString contents = m_newFormWidget->currentTemplate(ptrToErrorMessage);
|
||||
if (contents.isEmpty())
|
||||
return false;
|
||||
// Write to temporary file and open
|
||||
QString tempPattern = QDir::tempPath();
|
||||
if (!tempPattern.endsWith(QDir::separator())) // platform-dependant
|
||||
tempPattern += QDir::separator();
|
||||
tempPattern += QLatin1String("XXXXXX.ui");
|
||||
QTemporaryFile tempFormFile(tempPattern);
|
||||
|
||||
tempFormFile.setAutoRemove(true);
|
||||
if (!tempFormFile.open()) {
|
||||
*ptrToErrorMessage = tr("A temporary form file could not be created in %1.").arg(QDir::tempPath());
|
||||
return false;
|
||||
}
|
||||
const QString tempFormFileName = tempFormFile.fileName();
|
||||
tempFormFile.write(contents.toUtf8());
|
||||
if (!tempFormFile.flush()) {
|
||||
*ptrToErrorMessage = tr("The temporary form file %1 could not be written.").arg(tempFormFileName);
|
||||
return false;
|
||||
}
|
||||
tempFormFile.close();
|
||||
return m_workbench->openTemplate(tempFormFileName, m_fileName, ptrToErrorMessage);
|
||||
}
|
||||
|
||||
QImage NewForm::grabForm(QDesignerFormEditorInterface *core,
|
||||
QIODevice &file,
|
||||
const QString &workingDir,
|
||||
const qdesigner_internal::DeviceProfile &dp)
|
||||
{
|
||||
return qdesigner_internal::NewFormWidget::grabForm(core, file, workingDir, dp);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
104
third/designer/form/newform.h
Normal file
@@ -0,0 +1,104 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef NEWFORM_H
|
||||
#define NEWFORM_H
|
||||
|
||||
#include <QtGui/QDialog>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace qdesigner_internal {
|
||||
class DeviceProfile;
|
||||
}
|
||||
|
||||
class QDesignerFormEditorInterface;
|
||||
class QDesignerNewFormWidgetInterface;
|
||||
class QDesignerWorkbench;
|
||||
|
||||
class QCheckBox;
|
||||
class QAbstractButton;
|
||||
class QPushButton;
|
||||
class QDialogButtonBox;
|
||||
class QImage;
|
||||
class QIODevice;
|
||||
|
||||
class NewForm: public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(NewForm)
|
||||
|
||||
public:
|
||||
NewForm(QDesignerWorkbench *workbench,
|
||||
QWidget *parentWidget,
|
||||
// Use that file name instead of a temporary one
|
||||
const QString &fileName = QString());
|
||||
|
||||
virtual ~NewForm();
|
||||
|
||||
// Convenience for implementing file dialogs with preview
|
||||
static QImage grabForm(QDesignerFormEditorInterface *core,
|
||||
QIODevice &file,
|
||||
const QString &workingDir,
|
||||
const qdesigner_internal::DeviceProfile &dp);
|
||||
|
||||
private slots:
|
||||
void slotButtonBoxClicked(QAbstractButton *btn);
|
||||
void recentFileChosen();
|
||||
void slotCurrentTemplateChanged(bool templateSelected);
|
||||
void slotTemplateActivated();
|
||||
|
||||
private:
|
||||
QDialogButtonBox *createButtonBox();
|
||||
bool openTemplate(QString *ptrToErrorMessage);
|
||||
|
||||
QString m_fileName;
|
||||
QDesignerNewFormWidgetInterface *m_newFormWidget;
|
||||
QDesignerWorkbench *m_workbench;
|
||||
QCheckBox *m_chkShowOnStartup;
|
||||
QPushButton *m_createButton;
|
||||
QPushButton *m_recentButton;
|
||||
QDialogButtonBox *m_buttonBox;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // NEWFORM_H
|
||||
118
third/designer/form/preferencesdialog.cpp
Normal file
@@ -0,0 +1,118 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "preferencesdialog.h"
|
||||
#include "ui_preferencesdialog.h"
|
||||
#include "qdesigner_appearanceoptions.h"
|
||||
|
||||
#include <QtDesigner/private/abstractoptionspage_p.h>
|
||||
|
||||
#include <QtDesigner/QDesignerFormEditorInterface>
|
||||
#include <QtGui/QFileDialog>
|
||||
#include <QtGui/QPushButton>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
PreferencesDialog::PreferencesDialog(QDesignerFormEditorInterface *core, QWidget *parentWidget) :
|
||||
QDialog(parentWidget),
|
||||
m_ui(new Ui::PreferencesDialog()),
|
||||
m_core(core)
|
||||
{
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
m_ui->setupUi(this);
|
||||
|
||||
m_optionsPages = core->optionsPages();
|
||||
|
||||
m_ui->m_optionTabWidget->clear();
|
||||
foreach (QDesignerOptionsPageInterface *optionsPage, m_optionsPages) {
|
||||
QWidget *page = optionsPage->createPage(this);
|
||||
m_ui->m_optionTabWidget->addTab(page, optionsPage->name());
|
||||
if (QDesignerAppearanceOptionsWidget *appearanceWidget = qobject_cast<QDesignerAppearanceOptionsWidget *>(page))
|
||||
connect(appearanceWidget, SIGNAL(uiModeChanged(bool)), this, SLOT(slotUiModeChanged(bool)));
|
||||
}
|
||||
|
||||
connect(m_ui->m_dialogButtonBox, SIGNAL(rejected()), this, SLOT(slotRejected()));
|
||||
connect(m_ui->m_dialogButtonBox, SIGNAL(accepted()), this, SLOT(slotAccepted()));
|
||||
connect(applyButton(), SIGNAL(clicked()), this, SLOT(slotApply()));
|
||||
}
|
||||
|
||||
PreferencesDialog::~PreferencesDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
QPushButton *PreferencesDialog::applyButton() const
|
||||
{
|
||||
return m_ui->m_dialogButtonBox->button(QDialogButtonBox::Apply);
|
||||
}
|
||||
|
||||
void PreferencesDialog::slotApply()
|
||||
{
|
||||
foreach (QDesignerOptionsPageInterface *optionsPage, m_optionsPages)
|
||||
optionsPage->apply();
|
||||
}
|
||||
|
||||
void PreferencesDialog::slotAccepted()
|
||||
{
|
||||
slotApply();
|
||||
closeOptionPages();
|
||||
accept();
|
||||
}
|
||||
|
||||
void PreferencesDialog::slotRejected()
|
||||
{
|
||||
closeOptionPages();
|
||||
reject();
|
||||
}
|
||||
|
||||
void PreferencesDialog::slotUiModeChanged(bool modified)
|
||||
{
|
||||
// Cannot "apply" a ui mode change (destroy the dialogs parent)
|
||||
applyButton()->setEnabled(!modified);
|
||||
}
|
||||
|
||||
void PreferencesDialog::closeOptionPages()
|
||||
{
|
||||
foreach (QDesignerOptionsPageInterface *optionsPage, m_optionsPages)
|
||||
optionsPage->finish();
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
82
third/designer/form/preferencesdialog.h
Normal file
@@ -0,0 +1,82 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef PREFERENCESDIALOG_H
|
||||
#define PREFERENCESDIALOG_H
|
||||
|
||||
#include <QtGui/QDialog>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QPushButton;
|
||||
class QDesignerFormEditorInterface;
|
||||
class QDesignerOptionsPageInterface;
|
||||
|
||||
namespace Ui {
|
||||
class PreferencesDialog;
|
||||
}
|
||||
|
||||
class PreferencesDialog: public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit PreferencesDialog(QDesignerFormEditorInterface *core, QWidget *parentWidget = 0);
|
||||
~PreferencesDialog();
|
||||
|
||||
|
||||
private slots:
|
||||
void slotAccepted();
|
||||
void slotRejected();
|
||||
void slotApply();
|
||||
void slotUiModeChanged(bool modified);
|
||||
|
||||
private:
|
||||
QPushButton *applyButton() const;
|
||||
void closeOptionPages();
|
||||
|
||||
Ui::PreferencesDialog *m_ui;
|
||||
QDesignerFormEditorInterface *m_core;
|
||||
QList<QDesignerOptionsPageInterface*> m_optionsPages;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // PREFERENCESDIALOG_H
|
||||
91
third/designer/form/preferencesdialog.ui
Normal file
@@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PreferencesDialog</class>
|
||||
<widget class="QDialog" name="PreferencesDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>474</width>
|
||||
<height>304</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Preferences</string>
|
||||
</property>
|
||||
<property name="modal">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="m_optionTabWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_2">
|
||||
<attribute name="title">
|
||||
<string notr="true">Tab 1</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="m_dialogButtonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Apply|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>m_dialogButtonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>PreferencesDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_dialogButtonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>PreferencesDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
1871
third/designer/form/qttoolbardialog.cpp
Normal file
138
third/designer/form/qttoolbardialog.h
Normal file
@@ -0,0 +1,138 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the tools applications of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of Qt Designer. This header
|
||||
// file may change from version to version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#ifndef QTTOOLBARDIALOG_H
|
||||
#define QTTOOLBARDIALOG_H
|
||||
|
||||
#include <QtGui/QDialog>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QMainWindow;
|
||||
class QAction;
|
||||
class QToolBar;
|
||||
|
||||
class QtToolBarManagerPrivate;
|
||||
|
||||
class QtToolBarManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
explicit QtToolBarManager(QObject *parent = 0);
|
||||
~QtToolBarManager();
|
||||
|
||||
void setMainWindow(QMainWindow *mainWindow);
|
||||
QMainWindow *mainWindow() const;
|
||||
|
||||
void addAction(QAction *action, const QString &category);
|
||||
void removeAction(QAction *action);
|
||||
|
||||
void addToolBar(QToolBar *toolBar, const QString &category);
|
||||
void removeToolBar(QToolBar *toolBar);
|
||||
|
||||
QList<QToolBar *> toolBars() const;
|
||||
|
||||
QByteArray saveState(int version = 0) const;
|
||||
bool restoreState(const QByteArray &state, int version = 0);
|
||||
|
||||
private:
|
||||
|
||||
friend class QtToolBarDialog;
|
||||
QScopedPointer<QtToolBarManagerPrivate> d_ptr;
|
||||
Q_DECLARE_PRIVATE(QtToolBarManager)
|
||||
Q_DISABLE_COPY(QtToolBarManager)
|
||||
};
|
||||
|
||||
class QtToolBarDialogPrivate;
|
||||
|
||||
class QtToolBarDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
explicit QtToolBarDialog(QWidget *parent = 0, Qt::WindowFlags flags = 0);
|
||||
~QtToolBarDialog();
|
||||
|
||||
void setToolBarManager(QtToolBarManager *toolBarManager);
|
||||
|
||||
protected:
|
||||
|
||||
void showEvent(QShowEvent *event);
|
||||
void hideEvent(QHideEvent *event);
|
||||
|
||||
private:
|
||||
|
||||
QScopedPointer<QtToolBarDialogPrivate> d_ptr;
|
||||
Q_DECLARE_PRIVATE(QtToolBarDialog)
|
||||
Q_DISABLE_COPY(QtToolBarDialog)
|
||||
|
||||
Q_PRIVATE_SLOT(d_func(), void newClicked())
|
||||
Q_PRIVATE_SLOT(d_func(), void removeClicked())
|
||||
Q_PRIVATE_SLOT(d_func(), void defaultClicked())
|
||||
Q_PRIVATE_SLOT(d_func(), void okClicked())
|
||||
Q_PRIVATE_SLOT(d_func(), void applyClicked())
|
||||
Q_PRIVATE_SLOT(d_func(), void cancelClicked())
|
||||
Q_PRIVATE_SLOT(d_func(), void upClicked())
|
||||
Q_PRIVATE_SLOT(d_func(), void downClicked())
|
||||
Q_PRIVATE_SLOT(d_func(), void leftClicked())
|
||||
Q_PRIVATE_SLOT(d_func(), void rightClicked())
|
||||
Q_PRIVATE_SLOT(d_func(), void renameClicked())
|
||||
Q_PRIVATE_SLOT(d_func(), void toolBarRenamed(QListWidgetItem *))
|
||||
Q_PRIVATE_SLOT(d_func(), void currentActionChanged(QTreeWidgetItem *))
|
||||
Q_PRIVATE_SLOT(d_func(), void currentToolBarChanged(QListWidgetItem *))
|
||||
Q_PRIVATE_SLOT(d_func(), void currentToolBarActionChanged(QListWidgetItem *))
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
207
third/designer/form/qttoolbardialog.ui
Normal file
@@ -0,0 +1,207 @@
|
||||
<ui version="4.0" >
|
||||
<class>QtToolBarDialog</class>
|
||||
<widget class="QDialog" name="QtToolBarDialog" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>583</width>
|
||||
<height>508</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Customize Toolbars</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item rowspan="3" row="1" column="0" >
|
||||
<widget class="QTreeWidget" name="actionTree" >
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>1</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string>Actions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="2" >
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="text" >
|
||||
<string>Toolbars</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="newButton" >
|
||||
<property name="toolTip" >
|
||||
<string>Add new toolbar</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>New</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="removeButton" >
|
||||
<property name="toolTip" >
|
||||
<string>Remove selected toolbar</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="renameButton" >
|
||||
<property name="toolTip" >
|
||||
<string>Rename toolbar</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Rename</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="1" >
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolButton" name="upButton" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Move action up</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Up</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="leftButton" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Remove action from toolbar</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string><-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="rightButton" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Add action to toolbar</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>-></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="downButton" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Move action down</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Down</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>29</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="2" >
|
||||
<widget class="QListWidget" name="currentToolBarList" />
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2" >
|
||||
<widget class="QLabel" name="label_3" >
|
||||
<property name="text" >
|
||||
<string>Current Toolbar Actions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2" >
|
||||
<widget class="QListWidget" name="toolBarList" />
|
||||
</item>
|
||||
<item row="5" column="0" colspan="3" >
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::RestoreDefaults</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>newButton</tabstop>
|
||||
<tabstop>removeButton</tabstop>
|
||||
<tabstop>renameButton</tabstop>
|
||||
<tabstop>toolBarList</tabstop>
|
||||
<tabstop>upButton</tabstop>
|
||||
<tabstop>leftButton</tabstop>
|
||||
<tabstop>rightButton</tabstop>
|
||||
<tabstop>downButton</tabstop>
|
||||
<tabstop>currentToolBarList</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
173
third/designer/form/saveformastemplate.cpp
Normal file
@@ -0,0 +1,173 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "saveformastemplate.h"
|
||||
#include "qdesigner_settings.h"
|
||||
|
||||
#include <QtCore/QFile>
|
||||
#include <QtGui/QFileDialog>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QPushButton>
|
||||
|
||||
#include <QtDesigner/abstractformeditor.h>
|
||||
#include <QtDesigner/abstractformwindow.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
SaveFormAsTemplate::SaveFormAsTemplate(QDesignerFormEditorInterface *core,
|
||||
QDesignerFormWindowInterface *formWindow,
|
||||
QWidget *parent)
|
||||
: QDialog(parent, Qt::Sheet),
|
||||
m_core(core),
|
||||
m_formWindow(formWindow)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
|
||||
ui.templateNameEdit->setText(formWindow->mainContainer()->objectName());
|
||||
ui.templateNameEdit->selectAll();
|
||||
|
||||
ui.templateNameEdit->setFocus();
|
||||
|
||||
QStringList paths = QDesignerSettings(m_core).formTemplatePaths();
|
||||
ui.categoryCombo->addItems(paths);
|
||||
ui.categoryCombo->addItem(tr("Add path..."));
|
||||
m_addPathIndex = ui.categoryCombo->count() - 1;
|
||||
connect(ui.templateNameEdit, SIGNAL(textChanged(QString)),
|
||||
this, SLOT(updateOKButton(QString)));
|
||||
connect(ui.categoryCombo, SIGNAL(activated(int)), this, SLOT(checkToAddPath(int)));
|
||||
}
|
||||
|
||||
SaveFormAsTemplate::~SaveFormAsTemplate()
|
||||
{
|
||||
}
|
||||
|
||||
void SaveFormAsTemplate::accept()
|
||||
{
|
||||
QString templateFileName = ui.categoryCombo->currentText();
|
||||
templateFileName += QLatin1Char('/');
|
||||
const QString name = ui.templateNameEdit->text();
|
||||
templateFileName += name;
|
||||
const QString extension = QLatin1String(".ui");
|
||||
if (!templateFileName.endsWith(extension))
|
||||
templateFileName.append(extension);
|
||||
QFile file(templateFileName);
|
||||
|
||||
if (file.exists()) {
|
||||
QMessageBox msgBox(QMessageBox::Information, tr("Template Exists"),
|
||||
tr("A template with the name %1 already exists.\n"
|
||||
"Do you want overwrite the template?").arg(name), QMessageBox::Cancel, m_formWindow);
|
||||
msgBox.setDefaultButton(QMessageBox::Cancel);
|
||||
QPushButton *overwriteButton = msgBox.addButton(tr("Overwrite Template"), QMessageBox::AcceptRole);
|
||||
msgBox.exec();
|
||||
if (msgBox.clickedButton() != overwriteButton)
|
||||
return;
|
||||
}
|
||||
|
||||
while (!file.open(QFile::WriteOnly)) {
|
||||
if (QMessageBox::information(m_formWindow, tr("Open Error"),
|
||||
tr("There was an error opening template %1 for writing. Reason: %2").arg(name).arg(file.errorString()),
|
||||
QMessageBox::Retry|QMessageBox::Cancel, QMessageBox::Cancel) == QMessageBox::Cancel) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const QString origName = m_formWindow->fileName();
|
||||
// ensure m_formWindow->contents() will convert properly resource paths to relative paths
|
||||
// (relative to template location, not to the current form location)
|
||||
m_formWindow->setFileName(templateFileName);
|
||||
QByteArray ba = m_formWindow->contents().toUtf8();
|
||||
m_formWindow->setFileName(origName);
|
||||
while (file.write(ba) != ba.size()) {
|
||||
if (QMessageBox::information(m_formWindow, tr("Write Error"),
|
||||
tr("There was an error writing the template %1 to disk. Reason: %2").arg(name).arg(file.errorString()),
|
||||
QMessageBox::Retry|QMessageBox::Cancel, QMessageBox::Cancel) == QMessageBox::Cancel) {
|
||||
file.close();
|
||||
file.remove();
|
||||
return;
|
||||
}
|
||||
file.reset();
|
||||
}
|
||||
// update the list of places too...
|
||||
QStringList sl;
|
||||
for (int i = 0; i < m_addPathIndex; ++i)
|
||||
sl << ui.categoryCombo->itemText(i);
|
||||
|
||||
QDesignerSettings(m_core).setFormTemplatePaths(sl);
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
void SaveFormAsTemplate::updateOKButton(const QString &str)
|
||||
{
|
||||
QPushButton *okButton = ui.buttonBox->button(QDialogButtonBox::Ok);
|
||||
okButton->setEnabled(!str.isEmpty());
|
||||
}
|
||||
|
||||
QString SaveFormAsTemplate::chooseTemplatePath(QWidget *parent)
|
||||
{
|
||||
QString rc = QFileDialog::getExistingDirectory(parent,
|
||||
tr("Pick a directory to save templates in"));
|
||||
if (rc.isEmpty())
|
||||
return rc;
|
||||
|
||||
if (rc.endsWith(QDir::separator()))
|
||||
rc.remove(rc.size() - 1, 1);
|
||||
return rc;
|
||||
}
|
||||
|
||||
void SaveFormAsTemplate::checkToAddPath(int itemIndex)
|
||||
{
|
||||
if (itemIndex != m_addPathIndex)
|
||||
return;
|
||||
|
||||
const QString dir = chooseTemplatePath(this);
|
||||
if (dir.isEmpty()) {
|
||||
ui.categoryCombo->setCurrentIndex(0);
|
||||
return;
|
||||
}
|
||||
|
||||
ui.categoryCombo->insertItem(m_addPathIndex, dir);
|
||||
ui.categoryCombo->setCurrentIndex(m_addPathIndex);
|
||||
++m_addPathIndex;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
77
third/designer/form/saveformastemplate.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef SAVEFORMASTEMPLATE_H
|
||||
#define SAVEFORMASTEMPLATE_H
|
||||
|
||||
#include "ui_saveformastemplate.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QDesignerFormEditorInterface;
|
||||
class QDesignerFormWindowInterface;
|
||||
|
||||
class SaveFormAsTemplate: public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SaveFormAsTemplate(QDesignerFormEditorInterface *m_core,
|
||||
QDesignerFormWindowInterface *formWindow,
|
||||
QWidget *parent = 0);
|
||||
virtual ~SaveFormAsTemplate();
|
||||
|
||||
private slots:
|
||||
void accept();
|
||||
void updateOKButton(const QString &str);
|
||||
void checkToAddPath(int itemIndex);
|
||||
|
||||
private:
|
||||
static QString chooseTemplatePath(QWidget *parent);
|
||||
|
||||
Ui::SaveFormAsTemplate ui;
|
||||
QDesignerFormEditorInterface *m_core;
|
||||
QDesignerFormWindowInterface *m_formWindow;
|
||||
int m_addPathIndex;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // SAVEFORMASTEMPLATE_H
|
||||
166
third/designer/form/saveformastemplate.ui
Normal file
@@ -0,0 +1,166 @@
|
||||
<ui version="4.0" >
|
||||
<comment>*********************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
*********************************************************************</comment>
|
||||
<class>SaveFormAsTemplate</class>
|
||||
<widget class="QDialog" name="SaveFormAsTemplate" >
|
||||
<property name="windowTitle" >
|
||||
<string>Save Form As Template</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<layout class="QFormLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Name:</string>
|
||||
</property>
|
||||
<property name="textFormat" >
|
||||
<enum>Qt::AutoText</enum>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>templateNameEdit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLineEdit" name="templateNameEdit" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>222</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="echoMode" >
|
||||
<enum>QLineEdit::Normal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Category:</string>
|
||||
</property>
|
||||
<property name="textFormat" >
|
||||
<enum>Qt::AutoText</enum>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>categoryCombo</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QComboBox" name="categoryCombo" />
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="horizontalLine" >
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::HLine</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>SaveFormAsTemplate</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>256</x>
|
||||
<y>124</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>113</x>
|
||||
<y>143</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>SaveFormAsTemplate</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>332</x>
|
||||
<y>127</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>372</x>
|
||||
<y>147</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
191
third/designer/form/versiondialog.cpp
Normal file
@@ -0,0 +1,191 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtCore/QVector>
|
||||
#include <QtGui/QMouseEvent>
|
||||
#include <QtGui/QGridLayout>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QDialogButtonBox>
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QPainterPath>
|
||||
#include <QtGui/QStyleOption>
|
||||
#include "versiondialog.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class VersionLabel : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VersionLabel(QWidget *parent = 0);
|
||||
|
||||
signals:
|
||||
void triggered();
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *me);
|
||||
void mouseMoveEvent(QMouseEvent *me);
|
||||
void mouseReleaseEvent(QMouseEvent *me);
|
||||
void paintEvent(QPaintEvent *pe);
|
||||
private:
|
||||
QVector<QPoint> hitPoints;
|
||||
QVector<QPoint> missPoints;
|
||||
QPainterPath m_path;
|
||||
bool secondStage;
|
||||
bool m_pushed;
|
||||
};
|
||||
|
||||
VersionLabel::VersionLabel(QWidget *parent)
|
||||
: QLabel(parent), secondStage(false), m_pushed(false)
|
||||
{
|
||||
setPixmap(QPixmap(QLatin1String(":/trolltech/designer/images/designer.png")));
|
||||
hitPoints.append(QPoint(56, 25));
|
||||
hitPoints.append(QPoint(29, 55));
|
||||
hitPoints.append(QPoint(56, 87));
|
||||
hitPoints.append(QPoint(82, 55));
|
||||
hitPoints.append(QPoint(58, 56));
|
||||
|
||||
secondStage = false;
|
||||
m_pushed = false;
|
||||
}
|
||||
|
||||
void VersionLabel::mousePressEvent(QMouseEvent *me)
|
||||
{
|
||||
if (me->button() == Qt::LeftButton) {
|
||||
if (!secondStage) {
|
||||
m_path = QPainterPath(me->pos());
|
||||
} else {
|
||||
m_pushed = true;
|
||||
update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VersionLabel::mouseMoveEvent(QMouseEvent *me)
|
||||
{
|
||||
if (me->buttons() & Qt::LeftButton)
|
||||
if (!secondStage)
|
||||
m_path.lineTo(me->pos());
|
||||
}
|
||||
|
||||
void VersionLabel::mouseReleaseEvent(QMouseEvent *me)
|
||||
{
|
||||
if (me->button() == Qt::LeftButton) {
|
||||
if (!secondStage) {
|
||||
m_path.lineTo(me->pos());
|
||||
bool gotIt = true;
|
||||
foreach(const QPoint &pt, hitPoints) {
|
||||
if (!m_path.contains(pt)) {
|
||||
gotIt = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (gotIt) {
|
||||
foreach(const QPoint &pt, missPoints) {
|
||||
if (m_path.contains(pt)) {
|
||||
gotIt = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (gotIt && !secondStage) {
|
||||
secondStage = true;
|
||||
m_path = QPainterPath();
|
||||
update();
|
||||
}
|
||||
} else {
|
||||
m_pushed = false;
|
||||
update();
|
||||
emit triggered();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VersionLabel::paintEvent(QPaintEvent *pe)
|
||||
{
|
||||
if (secondStage) {
|
||||
QPainter p(this);
|
||||
QStyleOptionButton opt;
|
||||
opt.init(this);
|
||||
if (!m_pushed)
|
||||
opt.state |= QStyle::State_Raised;
|
||||
else
|
||||
opt.state |= QStyle::State_Sunken;
|
||||
opt.state &= ~QStyle::State_HasFocus;
|
||||
style()->drawControl(QStyle::CE_PushButtonBevel, &opt, &p, this);
|
||||
}
|
||||
QLabel::paintEvent(pe);
|
||||
}
|
||||
|
||||
VersionDialog::VersionDialog(QWidget *parent)
|
||||
: QDialog(parent
|
||||
#ifdef Q_WS_MAC
|
||||
, Qt::Tool
|
||||
#endif
|
||||
)
|
||||
{
|
||||
setWindowFlags((windowFlags() & ~Qt::WindowContextHelpButtonHint) | Qt::MSWindowsFixedSizeDialogHint);
|
||||
QGridLayout *layout = new QGridLayout(this);
|
||||
VersionLabel *label = new VersionLabel;
|
||||
QLabel *lbl = new QLabel;
|
||||
QString version = tr("<h3>%1</h3><br/><br/>Version %2");
|
||||
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/>"));
|
||||
|
||||
lbl->setText(tr("%1"
|
||||
"<br/>Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)."
|
||||
).arg(version));
|
||||
|
||||
lbl->setWordWrap(true);
|
||||
lbl->setOpenExternalLinks(true);
|
||||
|
||||
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
|
||||
connect(buttonBox , SIGNAL(rejected()), this, SLOT(reject()));
|
||||
connect(label, SIGNAL(triggered()), this, SLOT(accept()));
|
||||
layout->addWidget(label, 0, 0, 1, 1);
|
||||
layout->addWidget(lbl, 0, 1, 4, 4);
|
||||
layout->addWidget(buttonBox, 4, 2, 1, 1);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include "versiondialog.moc"
|
||||
58
third/designer/form/versiondialog.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef VERSIONDIALOG_H
|
||||
#define VERSIONDIALOG_H
|
||||
|
||||
#include <QtGui/QDialog>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class VersionDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit VersionDialog(QWidget *parent);
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
BIN
third/designer/images/back.png
Normal file
|
After Width: | Height: | Size: 678 B |
BIN
third/designer/images/designer.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
third/designer/images/designer_zh_CN.qm
Normal file
BIN
third/designer/images/down.png
Normal file
|
After Width: | Height: | Size: 594 B |
BIN
third/designer/images/forward.png
Normal file
|
After Width: | Height: | Size: 655 B |
BIN
third/designer/images/minus.png
Normal file
|
After Width: | Height: | Size: 250 B |
BIN
third/designer/images/plus.png
Normal file
|
After Width: | Height: | Size: 462 B |
BIN
third/designer/images/up.png
Normal file
|
After Width: | Height: | Size: 692 B |
178
third/designer/lib/extension/default_extensionfactory.cpp
Normal file
@@ -0,0 +1,178 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtDesigner/default_extensionfactory.h>
|
||||
#include "qextensionmanager.h"
|
||||
#include <qpointer.h>
|
||||
#include <QtCore/qdebug.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*!
|
||||
\class QExtensionFactory
|
||||
|
||||
\brief The QExtensionFactory class allows you to create a factory
|
||||
that is able to make instances of custom extensions in Qt
|
||||
Designer.
|
||||
|
||||
\inmodule QtDesigner
|
||||
|
||||
In \QD the extensions are not created until they are required. For
|
||||
that reason, when implementing a custom extension, you must also
|
||||
create a QExtensionFactory, i.e. a class that is able to make an
|
||||
instance of your extension, and register it using \QD's \l
|
||||
{QExtensionManager}{extension manager}.
|
||||
|
||||
The QExtensionManager class provides extension management
|
||||
facilities for Qt Designer. When an extension is required, Qt
|
||||
Designer's \l {QExtensionManager}{extension manager} will run
|
||||
through all its registered factories calling
|
||||
QExtensionFactory::createExtension() for each until the first one
|
||||
that is able to create a requested extension for the selected
|
||||
object, is found. This factory will then make an instance of the
|
||||
extension.
|
||||
|
||||
There are four available types of extensions in Qt Designer:
|
||||
QDesignerContainerExtension , QDesignerMemberSheetExtension,
|
||||
QDesignerPropertySheetExtension and QDesignerTaskMenuExtension. Qt
|
||||
Designer's behavior is the same whether the requested extension is
|
||||
associated with a multi page container, a member sheet, a property
|
||||
sheet or a task menu.
|
||||
|
||||
You can either create a new QExtensionFactory and reimplement the
|
||||
QExtensionFactory::createExtension() function. For example:
|
||||
|
||||
\snippet doc/src/snippets/code/tools_designer_src_lib_extension_default_extensionfactory.cpp 0
|
||||
|
||||
Or you can use an existing factory, expanding the
|
||||
QExtensionFactory::createExtension() function to make the factory
|
||||
able to create your extension as well. For example:
|
||||
|
||||
\snippet doc/src/snippets/code/tools_designer_src_lib_extension_default_extensionfactory.cpp 1
|
||||
|
||||
For a complete example using the QExtensionFactory class, see the
|
||||
\l {designer/taskmenuextension}{Task Menu Extension example}. The
|
||||
example shows how to create a custom widget plugin for Qt
|
||||
Designer, and how to to use the QDesignerTaskMenuExtension class
|
||||
to add custom items to Qt Designer's task menu.
|
||||
|
||||
\sa QExtensionManager, QAbstractExtensionFactory
|
||||
*/
|
||||
|
||||
/*!
|
||||
Constructs an extension factory with the given \a parent.
|
||||
*/
|
||||
QExtensionFactory::QExtensionFactory(QExtensionManager *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the extension specified by \a iid for the given \a object.
|
||||
|
||||
\sa createExtension()
|
||||
*/
|
||||
|
||||
QObject *QExtensionFactory::extension(QObject *object, const QString &iid) const
|
||||
{
|
||||
if (!object)
|
||||
return 0;
|
||||
const IdObjectKey key = qMakePair(iid, object);
|
||||
|
||||
ExtensionMap::iterator it = m_extensions.find(key);
|
||||
if (it == m_extensions.end()) {
|
||||
if (QObject *ext = createExtension(object, iid, const_cast<QExtensionFactory*>(this))) {
|
||||
connect(ext, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*)));
|
||||
it = m_extensions.insert(key, ext);
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_extended.contains(object)) {
|
||||
connect(object, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*)));
|
||||
m_extended.insert(object, true);
|
||||
}
|
||||
|
||||
if (it == m_extensions.end())
|
||||
return 0;
|
||||
|
||||
return it.value();
|
||||
}
|
||||
|
||||
void QExtensionFactory::objectDestroyed(QObject *object)
|
||||
{
|
||||
QMutableMapIterator< IdObjectKey, QObject*> it(m_extensions);
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
|
||||
QObject *o = it.key().second;
|
||||
if (o == object || object == it.value()) {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
||||
m_extended.remove(object);
|
||||
}
|
||||
|
||||
/*!
|
||||
Creates an extension specified by \a iid for the given \a object.
|
||||
The extension object is created as a child of the specified \a
|
||||
parent.
|
||||
|
||||
\sa extension()
|
||||
*/
|
||||
QObject *QExtensionFactory::createExtension(QObject *object, const QString &iid, QObject *parent) const
|
||||
{
|
||||
Q_UNUSED(object);
|
||||
Q_UNUSED(iid);
|
||||
Q_UNUSED(parent);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the extension manager for the extension factory.
|
||||
*/
|
||||
QExtensionManager *QExtensionFactory::extensionManager() const
|
||||
{
|
||||
return static_cast<QExtensionManager *>(parent());
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
86
third/designer/lib/extension/default_extensionfactory.h
Normal file
@@ -0,0 +1,86 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef DEFAULT_EXTENSIONFACTORY_H
|
||||
#define DEFAULT_EXTENSIONFACTORY_H
|
||||
|
||||
#include <QtDesigner/extension_global.h>
|
||||
#include <QtDesigner/extension.h>
|
||||
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QPair>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QExtensionManager;
|
||||
|
||||
class QDESIGNER_EXTENSION_EXPORT QExtensionFactory : public QObject, public QAbstractExtensionFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QAbstractExtensionFactory)
|
||||
public:
|
||||
QExtensionFactory(QExtensionManager *parent = 0);
|
||||
|
||||
virtual QObject *extension(QObject *object, const QString &iid) const;
|
||||
QExtensionManager *extensionManager() const;
|
||||
|
||||
private Q_SLOTS:
|
||||
void objectDestroyed(QObject *object);
|
||||
|
||||
protected:
|
||||
virtual QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const;
|
||||
|
||||
private:
|
||||
typedef QPair<QString,QObject*> IdObjectKey;
|
||||
typedef QMap< IdObjectKey, QObject*> ExtensionMap;
|
||||
mutable ExtensionMap m_extensions;
|
||||
typedef QHash<QObject*, bool> ExtendedSet;
|
||||
mutable ExtendedSet m_extended;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // DEFAULT_EXTENSIONFACTORY_H
|
||||
186
third/designer/lib/extension/extension.cpp
Normal file
@@ -0,0 +1,186 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtDesigner/extension.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*!
|
||||
\class QAbstractExtensionFactory
|
||||
|
||||
\brief The QAbstractExtensionFactory class provides an interface
|
||||
for extension factories in Qt Designer.
|
||||
|
||||
\inmodule QtDesigner
|
||||
|
||||
QAbstractExtensionFactory is not intended to be instantiated
|
||||
directly; use the QExtensionFactory instead.
|
||||
|
||||
In \QD, extension factories are used to look up and create named
|
||||
extensions as they are required. For that reason, when
|
||||
implementing a custom extension, you must also create a
|
||||
QExtensionFactory, i.e a class that is able to make an instance of
|
||||
your extension, and register it using \QD's \l
|
||||
{QExtensionManager}{extension manager}.
|
||||
|
||||
When an extension is required, \QD's \l
|
||||
{QExtensionManager}{extension manager} will run through all its
|
||||
registered factories calling QExtensionFactory::createExtension()
|
||||
for each until the first one that is able to create the requested
|
||||
extension for the selected object, is found. This factory will
|
||||
then make an instance of the extension.
|
||||
|
||||
\sa QExtensionFactory, QExtensionManager
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QAbstractExtensionFactory::~QAbstractExtensionFactory()
|
||||
|
||||
Destroys the extension factory.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QObject *QAbstractExtensionFactory::extension(QObject *object, const QString &iid) const
|
||||
|
||||
Returns the extension specified by \a iid for the given \a object.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\class QAbstractExtensionManager
|
||||
|
||||
\brief The QAbstractExtensionManager class provides an interface
|
||||
for extension managers in Qt Designer.
|
||||
|
||||
\inmodule QtDesigner
|
||||
|
||||
QAbstractExtensionManager is not intended to be instantiated
|
||||
directly; use the QExtensionManager instead.
|
||||
|
||||
In \QD, extension are not created until they are required. For
|
||||
that reason, when implementing a custom extension, you must also
|
||||
create a QExtensionFactory, i.e a class that is able to make an
|
||||
instance of your extension, and register it using \QD's \l
|
||||
{QExtensionManager}{extension manager}.
|
||||
|
||||
When an extension is required, \QD's \l
|
||||
{QExtensionManager}{extension manager} will run through all its
|
||||
registered factories calling QExtensionFactory::createExtension()
|
||||
for each until the first one that is able to create the requested
|
||||
extension for the selected object, is found. This factory will
|
||||
then make an instance of the extension.
|
||||
|
||||
\sa QExtensionManager, QExtensionFactory
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QAbstractExtensionManager::~QAbstractExtensionManager()
|
||||
|
||||
Destroys the extension manager.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QAbstractExtensionManager::registerExtensions(QAbstractExtensionFactory *factory, const QString &iid)
|
||||
|
||||
Register the given extension \a factory with the extension
|
||||
specified by \a iid.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QAbstractExtensionManager::unregisterExtensions(QAbstractExtensionFactory *factory, const QString &iid)
|
||||
|
||||
Unregister the given \a factory with the extension specified by \a
|
||||
iid.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QObject *QAbstractExtensionManager::extension(QObject *object, const QString &iid) const
|
||||
|
||||
Returns the extension, specified by \a iid, for the given \a
|
||||
object.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn T qt_extension(QAbstractExtensionManager* manager, QObject *object)
|
||||
|
||||
\relates QExtensionManager
|
||||
|
||||
Returns the extension of the given \a object cast to type T if the
|
||||
object is of type T (or of a subclass); otherwise returns 0. The
|
||||
extension is retrieved using the given extension \a manager.
|
||||
|
||||
\snippet doc/src/snippets/code/tools_designer_src_lib_extension_extension.cpp 0
|
||||
|
||||
When implementing a custom widget plugin, a pointer to \QD's
|
||||
current QDesignerFormEditorInterface object (\c formEditor) is
|
||||
provided by the QDesignerCustomWidgetInterface::initialize()
|
||||
function's parameter.
|
||||
|
||||
If the widget in the example above doesn't have a defined
|
||||
QDesignerPropertySheetExtension, \c propertySheet will be a null
|
||||
pointer.
|
||||
|
||||
*/
|
||||
|
||||
/*!
|
||||
\macro Q_DECLARE_EXTENSION_INTERFACE(ExtensionName, Identifier)
|
||||
|
||||
\relates QExtensionManager
|
||||
|
||||
Associates the given \a Identifier (a string literal) to the
|
||||
extension class called \a ExtensionName. The \a Identifier must be
|
||||
unique. For example:
|
||||
|
||||
\snippet doc/src/snippets/code/tools_designer_src_lib_extension_extension.cpp 1
|
||||
|
||||
Using the company and product names is a good way to ensure
|
||||
uniqueness of the identifier.
|
||||
|
||||
When implementing a custom extension class, you must use
|
||||
Q_DECLARE_EXTENSION_INTERFACE() to enable usage of the
|
||||
qt_extension() function. The macro is normally located right after the
|
||||
class definition for \a ExtensionName, in the associated header
|
||||
file.
|
||||
|
||||
\sa Q_DECLARE_INTERFACE()
|
||||
*/
|
||||
|
||||
QT_END_NAMESPACE
|
||||
109
third/designer/lib/extension/extension.h
Normal file
@@ -0,0 +1,109 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef EXTENSION_H
|
||||
#define EXTENSION_H
|
||||
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QObject>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#define Q_TYPEID(IFace) QLatin1String(IFace##_iid)
|
||||
|
||||
class QAbstractExtensionFactory
|
||||
{
|
||||
public:
|
||||
virtual ~QAbstractExtensionFactory() {}
|
||||
|
||||
virtual QObject *extension(QObject *object, const QString &iid) const = 0;
|
||||
};
|
||||
Q_DECLARE_INTERFACE(QAbstractExtensionFactory, "com.trolltech.Qt.QAbstractExtensionFactory")
|
||||
|
||||
class QAbstractExtensionManager
|
||||
{
|
||||
public:
|
||||
virtual ~QAbstractExtensionManager() {}
|
||||
|
||||
virtual void registerExtensions(QAbstractExtensionFactory *factory, const QString &iid) = 0;
|
||||
virtual void unregisterExtensions(QAbstractExtensionFactory *factory, const QString &iid) = 0;
|
||||
|
||||
virtual QObject *extension(QObject *object, const QString &iid) const = 0;
|
||||
};
|
||||
Q_DECLARE_INTERFACE(QAbstractExtensionManager, "com.trolltech.Qt.QAbstractExtensionManager")
|
||||
|
||||
#if defined(Q_CC_MSVC) && (_MSC_VER < 1300)
|
||||
|
||||
template <class T>
|
||||
inline T qt_extension_helper(QAbstractExtensionManager *, QObject *, T)
|
||||
{ return 0; }
|
||||
|
||||
template <class T>
|
||||
inline T qt_extension(QAbstractExtensionManager* manager, QObject *object)
|
||||
{ return qt_extension_helper(manager, object, T(0)); }
|
||||
|
||||
#define Q_DECLARE_EXTENSION_INTERFACE(IFace, IId) \
|
||||
const char * const IFace##_iid = IId; \
|
||||
Q_DECLARE_INTERFACE(IFace, IId) \
|
||||
template <> inline IFace *qt_extension_helper<IFace *>(QAbstractExtensionManager *manager, QObject *object, IFace *) \
|
||||
{ QObject *extension = manager->extension(object, Q_TYPEID(IFace)); return (IFace *)(extension ? extension->qt_metacast(IFace##_iid) : 0); }
|
||||
|
||||
#else
|
||||
|
||||
template <class T>
|
||||
inline T qt_extension(QAbstractExtensionManager* manager, QObject *object)
|
||||
{ return 0; }
|
||||
|
||||
#define Q_DECLARE_EXTENSION_INTERFACE(IFace, IId) \
|
||||
const char * const IFace##_iid = IId; \
|
||||
Q_DECLARE_INTERFACE(IFace, IId) \
|
||||
template <> inline IFace *qt_extension<IFace *>(QAbstractExtensionManager *manager, QObject *object) \
|
||||
{ QObject *extension = manager->extension(object, Q_TYPEID(IFace)); return extension ? static_cast<IFace *>(extension->qt_metacast(IFace##_iid)) : static_cast<IFace *>(0); }
|
||||
|
||||
#endif
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // EXTENSION_H
|
||||
12
third/designer/lib/extension/extension.pri
Normal file
@@ -0,0 +1,12 @@
|
||||
# Input
|
||||
|
||||
INCLUDEPATH += $$PWD
|
||||
|
||||
HEADERS += $$PWD/default_extensionfactory.h \
|
||||
$$PWD/extension.h \
|
||||
$$PWD/qextensionmanager.h
|
||||
|
||||
SOURCES += $$PWD/default_extensionfactory.cpp \
|
||||
$$PWD/extension.cpp \
|
||||
$$PWD/qextensionmanager.cpp
|
||||
|
||||
64
third/designer/lib/extension/extension_global.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef EXTENSION_GLOBAL_H
|
||||
#define EXTENSION_GLOBAL_H
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#define QDESIGNER_EXTENSION_EXTERN Q_DECL_EXPORT
|
||||
#define QDESIGNER_EXTENSION_IMPORT Q_DECL_IMPORT
|
||||
|
||||
#ifdef QT_DESIGNER_STATIC
|
||||
# define QDESIGNER_EXTENSION_EXPORT
|
||||
#elif defined(QDESIGNER_EXTENSION_LIBRARY)
|
||||
# define QDESIGNER_EXTENSION_EXPORT QDESIGNER_EXTENSION_EXTERN
|
||||
#else
|
||||
# define QDESIGNER_EXTENSION_EXPORT QDESIGNER_EXTENSION_IMPORT
|
||||
#endif
|
||||
|
||||
QT_END_NAMESPACE
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // EXTENSION_GLOBAL_H
|
||||
174
third/designer/lib/extension/qextensionmanager.cpp
Normal file
@@ -0,0 +1,174 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qextensionmanager.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*!
|
||||
\class QExtensionManager
|
||||
|
||||
\brief The QExtensionManager class provides extension management
|
||||
facilities for Qt Designer.
|
||||
|
||||
\inmodule QtDesigner
|
||||
|
||||
In \QD the extensions are not created until they are required. For
|
||||
that reason, when implementing an extension, you must also create
|
||||
a QExtensionFactory, i.e a class that is able to make an instance
|
||||
of your extension, and register it using \QD's extension manager.
|
||||
|
||||
The registration of an extension factory is typically made in the
|
||||
QDesignerCustomWidgetInterface::initialize() function:
|
||||
|
||||
\snippet doc/src/snippets/code/tools_designer_src_lib_extension_qextensionmanager.cpp 0
|
||||
|
||||
The QExtensionManager is not intended to be instantiated
|
||||
directly. You can retrieve an interface to \QD's extension manager
|
||||
using the QDesignerFormEditorInterface::extensionManager()
|
||||
function. A pointer to \QD's current QDesignerFormEditorInterface
|
||||
object (\c formEditor in the example above) is provided by the
|
||||
QDesignerCustomWidgetInterface::initialize() function's
|
||||
parameter. When implementing a custom widget plugin, you must
|
||||
subclass the QDesignerCustomWidgetInterface to expose your plugin
|
||||
to \QD.
|
||||
|
||||
Then, when an extension is required, \QD's extension manager will
|
||||
run through all its registered factories calling
|
||||
QExtensionFactory::createExtension() for each until the first one
|
||||
that is able to create the requested extension for the selected
|
||||
object, is found. This factory will then make an instance of the
|
||||
extension.
|
||||
|
||||
There are four available types of extensions in \QD:
|
||||
QDesignerContainerExtension , QDesignerMemberSheetExtension,
|
||||
QDesignerPropertySheetExtension and
|
||||
QDesignerTaskMenuExtension. \QD's behavior is the same whether the
|
||||
requested extension is associated with a container, a member
|
||||
sheet, a property sheet or a task menu.
|
||||
|
||||
For a complete example using the QExtensionManager class, see the
|
||||
\l {designer/taskmenuextension}{Task Menu Extension example}. The
|
||||
example shows how to create a custom widget plugin for Qt
|
||||
Designer, and how to to use the QDesignerTaskMenuExtension class
|
||||
to add custom items to \QD's task menu.
|
||||
|
||||
\sa QExtensionFactory, QAbstractExtensionManager
|
||||
*/
|
||||
|
||||
/*!
|
||||
Constructs an extension manager with the given \a parent.
|
||||
*/
|
||||
QExtensionManager::QExtensionManager(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
Destroys the extension manager
|
||||
*/
|
||||
QExtensionManager::~QExtensionManager()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Register the extension specified by the given \a factory and
|
||||
extension identifier \a iid.
|
||||
*/
|
||||
void QExtensionManager::registerExtensions(QAbstractExtensionFactory *factory, const QString &iid)
|
||||
{
|
||||
if (iid.isEmpty()) {
|
||||
m_globalExtension.prepend(factory);
|
||||
return;
|
||||
}
|
||||
|
||||
FactoryMap::iterator it = m_extensions.find(iid);
|
||||
if (it == m_extensions.end())
|
||||
it = m_extensions.insert(iid, FactoryList());
|
||||
|
||||
it.value().prepend(factory);
|
||||
}
|
||||
|
||||
/*!
|
||||
Unregister the extension specified by the given \a factory and
|
||||
extension identifier \a iid.
|
||||
*/
|
||||
void QExtensionManager::unregisterExtensions(QAbstractExtensionFactory *factory, const QString &iid)
|
||||
{
|
||||
if (iid.isEmpty()) {
|
||||
m_globalExtension.removeAll(factory);
|
||||
return;
|
||||
}
|
||||
|
||||
const FactoryMap::iterator it = m_extensions.find(iid);
|
||||
if (it == m_extensions.end())
|
||||
return;
|
||||
|
||||
FactoryList &factories = it.value();
|
||||
factories.removeAll(factory);
|
||||
|
||||
if (factories.isEmpty())
|
||||
m_extensions.erase(it);
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the extension specified by \a iid, for the given \a
|
||||
object.
|
||||
*/
|
||||
QObject *QExtensionManager::extension(QObject *object, const QString &iid) const
|
||||
{
|
||||
const FactoryMap::const_iterator it = m_extensions.constFind(iid);
|
||||
if (it != m_extensions.constEnd()) {
|
||||
const FactoryList::const_iterator fcend = it.value().constEnd();
|
||||
for (FactoryList::const_iterator fit = it.value().constBegin(); fit != fcend; ++fit)
|
||||
if (QObject *ext = (*fit)->extension(object, iid))
|
||||
return ext;
|
||||
}
|
||||
const FactoryList::const_iterator gfcend = m_globalExtension.constEnd();
|
||||
for (FactoryList::const_iterator git = m_globalExtension.constBegin(); git != gfcend; ++git)
|
||||
if (QObject *ext = (*git)->extension(object, iid))
|
||||
return ext;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
79
third/designer/lib/extension/qextensionmanager.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QEXTENSIONMANAGER_H
|
||||
#define QEXTENSIONMANAGER_H
|
||||
|
||||
#include <QtDesigner/extension_global.h>
|
||||
#include <QtDesigner/extension.h>
|
||||
#include <QtCore/QHash>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QObject; // Fool syncqt
|
||||
|
||||
class QDESIGNER_EXTENSION_EXPORT QExtensionManager: public QObject, public QAbstractExtensionManager
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QAbstractExtensionManager)
|
||||
public:
|
||||
QExtensionManager(QObject *parent = 0);
|
||||
~QExtensionManager();
|
||||
|
||||
virtual void registerExtensions(QAbstractExtensionFactory *factory, const QString &iid = QString());
|
||||
virtual void unregisterExtensions(QAbstractExtensionFactory *factory, const QString &iid = QString());
|
||||
|
||||
virtual QObject *extension(QObject *object, const QString &iid) const;
|
||||
|
||||
private:
|
||||
typedef QList<QAbstractExtensionFactory*> FactoryList;
|
||||
typedef QHash<QString, FactoryList> FactoryMap;
|
||||
FactoryMap m_extensions;
|
||||
FactoryList m_globalExtension;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // QEXTENSIONMANAGER_H
|
||||
78
third/designer/lib/lib.pro
Normal file
@@ -0,0 +1,78 @@
|
||||
TEMPLATE=lib
|
||||
TARGET=QtDesigner
|
||||
QT += xml
|
||||
contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
|
||||
CONFIG += qt
|
||||
win32|mac: CONFIG += debug_and_release
|
||||
DESTDIR = ../../../../lib
|
||||
!wince*:DLLDESTDIR = ../../../../bin
|
||||
|
||||
isEmpty(QT_MAJOR_VERSION) {
|
||||
VERSION=4.3.0
|
||||
} else {
|
||||
VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION}
|
||||
}
|
||||
|
||||
unix:QMAKE_PKGCONFIG_REQUIRES += QtXml
|
||||
|
||||
include(../../../../src/qt_targets.pri)
|
||||
QMAKE_TARGET_PRODUCT = Designer
|
||||
QMAKE_TARGET_DESCRIPTION = Graphical user interface designer.
|
||||
|
||||
!contains(CONFIG, static) {
|
||||
CONFIG += dll
|
||||
|
||||
DEFINES += \
|
||||
QDESIGNER_SDK_LIBRARY \
|
||||
QDESIGNER_EXTENSION_LIBRARY \
|
||||
QDESIGNER_UILIB_LIBRARY \
|
||||
QDESIGNER_SHARED_LIBRARY
|
||||
} else {
|
||||
DEFINES += QT_DESIGNER_STATIC
|
||||
}
|
||||
|
||||
#load up the headers info
|
||||
CONFIG += qt_install_headers
|
||||
HEADERS_PRI = $$QT_BUILD_TREE/include/QtDesigner/headers.pri
|
||||
include($$HEADERS_PRI, "", true)|clear(HEADERS_PRI)
|
||||
|
||||
#mac frameworks
|
||||
mac:CONFIG += explicitlib
|
||||
mac:!static:contains(QT_CONFIG, qt_framework) {
|
||||
QMAKE_FRAMEWORK_BUNDLE_NAME = $$TARGET
|
||||
CONFIG += lib_bundle qt_no_framework_direct_includes qt_framework
|
||||
CONFIG(debug, debug|release) {
|
||||
!build_pass:CONFIG += build_all
|
||||
} else { #release
|
||||
!debug_and_release|build_pass {
|
||||
CONFIG -= qt_install_headers #no need to install these as well
|
||||
FRAMEWORK_HEADERS.version = Versions
|
||||
FRAMEWORK_HEADERS.files = $$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES
|
||||
FRAMEWORK_HEADERS.path = Headers
|
||||
}
|
||||
QMAKE_BUNDLE_DATA += FRAMEWORK_HEADERS
|
||||
}
|
||||
}
|
||||
|
||||
include(extension/extension.pri)
|
||||
include(sdk/sdk.pri)
|
||||
include(uilib/uilib.pri)
|
||||
include(shared/shared.pri)
|
||||
PRECOMPILED_HEADER=lib_pch.h
|
||||
|
||||
include(../sharedcomponents.pri)
|
||||
include(../components/component.pri)
|
||||
|
||||
target.path=$$[QT_INSTALL_LIBS]
|
||||
INSTALLS += target
|
||||
win32 {
|
||||
dlltarget.path=$$[QT_INSTALL_BINS]
|
||||
INSTALLS += dlltarget
|
||||
}
|
||||
|
||||
|
||||
qt_install_headers {
|
||||
designer_headers.files = $$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES
|
||||
designer_headers.path = $$[QT_INSTALL_HEADERS]/QtDesigner
|
||||
INSTALLS += designer_headers
|
||||
}
|
||||
65
third/designer/lib/lib_pch.h
Normal file
@@ -0,0 +1,65 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include "shared_global_p.h"
|
||||
#include <QtCore/qdebug.h>
|
||||
#include <QtDesigner/abstractformeditor.h>
|
||||
#include <QtDesigner/sdk_global.h>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtDesigner/qextensionmanager.h>
|
||||
#include <QtDesigner/abstractformwindow.h>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtDesigner/propertysheet.h>
|
||||
#include <QtDesigner/extension.h>
|
||||
#include <QtDesigner/abstractmetadatabase.h>
|
||||
#include <QtCore/QList>
|
||||
#include <QtDesigner/abstractwidgetfactory.h>
|
||||
#include <QtDesigner/abstractwidgetdatabase.h>
|
||||
#include <QtGui/QWidget>
|
||||
#include "qdesigner_widget_p.h"
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtCore/qglobal.h>
|
||||
#include <QtCore/QPointer>
|
||||
#include "layout_p.h"
|
||||
#endif
|
||||
123
third/designer/lib/sdk/abstractactioneditor.cpp
Normal file
@@ -0,0 +1,123 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "abstractactioneditor.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*!
|
||||
\class QDesignerActionEditorInterface
|
||||
|
||||
\brief The QDesignerActionEditorInterface class allows you to
|
||||
change the focus of Qt Designer's action editor.
|
||||
|
||||
\inmodule QtDesigner
|
||||
|
||||
The QDesignerActionEditorInterface class is not intended to be
|
||||
instantiated directly. You can retrieve an interface to \QD's
|
||||
action editor using the
|
||||
QDesignerFormEditorInterface::actionEditor() function.
|
||||
|
||||
You can control which actions that are available in the action
|
||||
editor's window using the manageAction() and unmanageAction()
|
||||
functions. An action that is managed by \QD is available in the
|
||||
action editor while an unmanaged action is ignored.
|
||||
|
||||
QDesignerActionEditorInterface also provides the core() function
|
||||
that you can use to retrieve a pointer to \QD's current
|
||||
QDesignerFormEditorInterface object, and the setFormWindow()
|
||||
function that enables you to change the currently selected form
|
||||
window.
|
||||
|
||||
\sa QDesignerFormEditorInterface, QDesignerFormWindowInterface
|
||||
*/
|
||||
|
||||
/*!
|
||||
Constructs an action editor interface with the given \a parent and
|
||||
the specified window \a flags.
|
||||
*/
|
||||
QDesignerActionEditorInterface::QDesignerActionEditorInterface(QWidget *parent, Qt::WindowFlags flags)
|
||||
: QWidget(parent, flags)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Destroys the action editor interface.
|
||||
*/
|
||||
QDesignerActionEditorInterface::~QDesignerActionEditorInterface()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns a pointer to \QD's current QDesignerFormEditorInterface
|
||||
object.
|
||||
*/
|
||||
QDesignerFormEditorInterface *QDesignerActionEditorInterface::core() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn void QDesignerActionEditorInterface::setFormWindow(QDesignerFormWindowInterface *formWindow)
|
||||
|
||||
Sets the currently selected form window to \a formWindow.
|
||||
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerActionEditorInterface::manageAction(QAction *action)
|
||||
|
||||
Instructs \QD to manage the specified \a action. An action that is
|
||||
managed by \QD is available in the action editor.
|
||||
|
||||
\sa unmanageAction()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerActionEditorInterface::unmanageAction(QAction *action)
|
||||
|
||||
Instructs \QD to ignore the specified \a action. An unmanaged
|
||||
action is not available in the action editor.
|
||||
|
||||
\sa manageAction()
|
||||
*/
|
||||
|
||||
QT_END_NAMESPACE
|
||||
76
third/designer/lib/sdk/abstractactioneditor.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef ABSTRACTACTIONEDITOR_H
|
||||
#define ABSTRACTACTIONEDITOR_H
|
||||
|
||||
#include <QtDesigner/sdk_global.h>
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QDesignerFormEditorInterface;
|
||||
class QDesignerFormWindowInterface;
|
||||
|
||||
class QDESIGNER_SDK_EXPORT QDesignerActionEditorInterface: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QDesignerActionEditorInterface(QWidget *parent, Qt::WindowFlags flags = 0);
|
||||
virtual ~QDesignerActionEditorInterface();
|
||||
|
||||
virtual QDesignerFormEditorInterface *core() const;
|
||||
|
||||
virtual void manageAction(QAction *action) = 0;
|
||||
virtual void unmanageAction(QAction *action) = 0;
|
||||
|
||||
public Q_SLOTS:
|
||||
virtual void setFormWindow(QDesignerFormWindowInterface *formWindow) = 0;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // ABSTRACTACTIONEDITOR_H
|
||||
83
third/designer/lib/sdk/abstractbrushmanager.h
Normal file
@@ -0,0 +1,83 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef ABSTRACTBRUSHMANAGER_H
|
||||
#define ABSTRACTBRUSHMANAGER_H
|
||||
|
||||
#include <QtDesigner/sdk_global.h>
|
||||
|
||||
#include <QtCore/qobject.h>
|
||||
#include <QtCore/qmap.h>
|
||||
#include <QtGui/qbrush.h>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QObject;
|
||||
|
||||
class QDESIGNER_SDK_EXPORT QDesignerBrushManagerInterface : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QDesignerBrushManagerInterface(QObject *parentObject = 0) : QObject(parentObject) {}
|
||||
|
||||
virtual QBrush brush(const QString &name) const = 0;
|
||||
virtual QMap<QString, QBrush> brushes() const = 0;
|
||||
virtual QString currentBrush() const = 0;
|
||||
|
||||
virtual QString addBrush(const QString &name, const QBrush &brush) = 0;
|
||||
virtual void removeBrush(const QString &name) = 0;
|
||||
virtual void setCurrentBrush(const QString &name) = 0;
|
||||
|
||||
virtual QPixmap brushPixmap(const QBrush &brush) const = 0;
|
||||
Q_SIGNALS:
|
||||
void brushAdded(const QString &name, const QBrush &brush);
|
||||
void brushRemoved(const QString &name);
|
||||
void currentBrushChanged(const QString &name, const QBrush &brush);
|
||||
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif
|
||||
161
third/designer/lib/sdk/abstractdialoggui.cpp
Normal file
@@ -0,0 +1,161 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "abstractdialoggui_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*!
|
||||
\class QDesignerDialogGuiInterface
|
||||
\since 4.4
|
||||
\internal
|
||||
|
||||
\brief The QDesignerDialogGuiInterface allows integrations of \QD to replace the
|
||||
message boxes displayed by \QD by custom dialogs.
|
||||
|
||||
\inmodule QtDesigner
|
||||
|
||||
QDesignerDialogGuiInterface provides virtual functions that can be overwritten
|
||||
to display message boxes and file dialogs.
|
||||
\sa QMessageBox, QFileDialog
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum QDesignerDialogGuiInterface::Message
|
||||
|
||||
This enum specifies the context from within the message box is called.
|
||||
|
||||
\value FormLoadFailureMessage Loading of a form failed
|
||||
\value UiVersionMismatchMessage Attempt to load a file created with an old version of Designer
|
||||
\value ResourceLoadFailureMessage Resources specified in a file could not be found
|
||||
\value TopLevelSpacerMessage Spacer items detected on a container without layout
|
||||
\value PropertyEditorMessage Messages of the propert yeditor
|
||||
\value SignalSlotEditorMessage Messages of the signal / slot editor
|
||||
\value FormEditorMessage Messages of the form editor
|
||||
\value PreviewFailureMessage A preview could not be created
|
||||
\value PromotionErrorMessage Messages related to promotion of a widget
|
||||
\value ResourceEditorMessage Messages of the resource editor
|
||||
\value ScriptDialogMessage Messages of the script dialog
|
||||
\value SignalSlotDialogMessage Messages of the signal slot dialog
|
||||
\value OtherMessage Unspecified context
|
||||
*/
|
||||
|
||||
/*!
|
||||
Constructs a QDesignerDialogGuiInterface object.
|
||||
*/
|
||||
|
||||
QDesignerDialogGuiInterface::QDesignerDialogGuiInterface()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Destroys the QDesignerDialogGuiInterface object.
|
||||
*/
|
||||
QDesignerDialogGuiInterface::~QDesignerDialogGuiInterface()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn QMessageBox::StandardButton QDesignerDialogGuiInterface::message(QWidget *parent, Message context, QMessageBox::Icon icon, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton)
|
||||
|
||||
Opens a message box as child of \a parent within the context \a context, using \a icon, \a title, \a text, \a buttons and \a defaultButton
|
||||
and returns the button chosen by the user.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerDialogGuiInterface::getExistingDirectory(QWidget *parent, const QString &caption, const QString &dir, QFileDialog::Options options)
|
||||
|
||||
Opens a file dialog as child of \a parent using the parameters \a caption, \a dir and \a options that prompts the
|
||||
user for an existing directory. Returns a directory selected by the user.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerDialogGuiInterface::getOpenFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options)
|
||||
|
||||
Opens a file dialog as child of \a parent using the parameters \a caption, \a dir, \a filter, \a selectedFilter and \a options
|
||||
that prompts the user for an existing file. Returns a file selected by the user.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QStringList QDesignerDialogGuiInterface::getOpenFileNames(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options)
|
||||
|
||||
Opens a file dialog as child of \a parent using the parameters \a caption, \a dir, \a filter, \a selectedFilter and \a options
|
||||
that prompts the user for a set of existing files. Returns one or more existing files selected by the user.
|
||||
*/
|
||||
|
||||
/*!
|
||||
Opens a file dialog with image browsing capabilities as child of \a parent using the parameters \a caption, \a dir, \a filter, \a selectedFilter and \a options
|
||||
that prompts the user for an existing file. Returns a file selected by the user.
|
||||
|
||||
The default implementation simply calls getOpenFileName(). On platforms that do not support an image preview in the QFileDialog,
|
||||
the function can be reimplemented to provide an image browser.
|
||||
|
||||
\since 4.5
|
||||
*/
|
||||
|
||||
QString QDesignerDialogGuiInterface::getOpenImageFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options)
|
||||
{
|
||||
return getOpenFileName(parent, caption, dir, filter, selectedFilter, options);
|
||||
}
|
||||
|
||||
/*!
|
||||
Opens a file dialog with image browsing capabilities as child of \a parent using the parameters \a caption, \a dir, \a filter, \a selectedFilter and \a options
|
||||
that prompts the user for a set of existing files. Returns one or more existing files selected by the user.
|
||||
|
||||
The default implementation simply calls getOpenFileNames(). On platforms that do not support an image preview in the QFileDialog,
|
||||
the function can be reimplemented to provide an image browser.
|
||||
|
||||
\since 4.5
|
||||
*/
|
||||
|
||||
QStringList QDesignerDialogGuiInterface::getOpenImageFileNames(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options)
|
||||
{
|
||||
return getOpenImageFileNames(parent, caption, dir, filter, selectedFilter, options);
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerDialogGuiInterface::getSaveFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options)
|
||||
|
||||
Opens a file dialog as child of \a parent using the parameters \a caption, \a dir, \a filter, \a selectedFilter and \a options
|
||||
that prompts the user for a file. Returns a file selected by the user. The file does not have to exist.
|
||||
*/
|
||||
|
||||
QT_END_NAMESPACE
|
||||
107
third/designer/lib/sdk/abstractdialoggui_p.h
Normal file
@@ -0,0 +1,107 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of Qt Designer. This header
|
||||
// file may change from version to version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#ifndef ABSTRACTDIALOGGUI_H
|
||||
#define ABSTRACTDIALOGGUI_H
|
||||
|
||||
#include <QtDesigner/sdk_global.h>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QFileDialog>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QWidget;
|
||||
|
||||
class QDESIGNER_SDK_EXPORT QDesignerDialogGuiInterface
|
||||
{
|
||||
Q_DISABLE_COPY(QDesignerDialogGuiInterface)
|
||||
public:
|
||||
QDesignerDialogGuiInterface();
|
||||
virtual ~QDesignerDialogGuiInterface();
|
||||
|
||||
enum Message { FormLoadFailureMessage, UiVersionMismatchMessage, ResourceLoadFailureMessage,
|
||||
TopLevelSpacerMessage, PropertyEditorMessage, SignalSlotEditorMessage, FormEditorMessage,
|
||||
PreviewFailureMessage, PromotionErrorMessage, ResourceEditorMessage,
|
||||
ScriptDialogMessage, SignalSlotDialogMessage, OtherMessage, FileChangedMessage };
|
||||
|
||||
virtual QMessageBox::StandardButton
|
||||
message(QWidget *parent, Message context, QMessageBox::Icon icon,
|
||||
const QString &title, const QString &text, QMessageBox::StandardButtons buttons = QMessageBox::Ok,
|
||||
QMessageBox::StandardButton defaultButton = QMessageBox::NoButton) = 0;
|
||||
|
||||
virtual QMessageBox::StandardButton
|
||||
message(QWidget *parent, Message context, QMessageBox::Icon icon,
|
||||
const QString &title, const QString &text, const QString &informativeText,
|
||||
QMessageBox::StandardButtons buttons = QMessageBox::Ok,
|
||||
QMessageBox::StandardButton defaultButton = QMessageBox::NoButton) = 0;
|
||||
|
||||
virtual QMessageBox::StandardButton
|
||||
message(QWidget *parent, Message context, QMessageBox::Icon icon,
|
||||
const QString &title, const QString &text, const QString &informativeText, const QString &detailedText,
|
||||
QMessageBox::StandardButtons buttons = QMessageBox::Ok,
|
||||
QMessageBox::StandardButton defaultButton = QMessageBox::NoButton) = 0;
|
||||
|
||||
virtual QString getExistingDirectory(QWidget *parent = 0, const QString &caption = QString(), const QString &dir = QString(), QFileDialog::Options options = QFileDialog::ShowDirsOnly)= 0;
|
||||
virtual QString getOpenFileName(QWidget *parent = 0, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = 0, QFileDialog::Options options = 0)= 0;
|
||||
virtual QString getOpenImageFileName(QWidget *parent = 0, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = 0, QFileDialog::Options options = 0);
|
||||
virtual QStringList getOpenFileNames(QWidget *parent = 0, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = 0, QFileDialog::Options options = 0)= 0;
|
||||
virtual QStringList getOpenImageFileNames(QWidget *parent = 0, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = 0, QFileDialog::Options options = 0);
|
||||
virtual QString getSaveFileName(QWidget *parent = 0, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = 0, QFileDialog::Options options = 0)= 0;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // ABSTRACTDIALOGGUI_H
|
||||
75
third/designer/lib/sdk/abstractdnditem.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef ABSTRACTDNDITEM_H
|
||||
#define ABSTRACTDNDITEM_H
|
||||
|
||||
#include <QtDesigner/sdk_global.h>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class DomUI;
|
||||
class QWidget;
|
||||
class QPoint;
|
||||
|
||||
class QDESIGNER_SDK_EXPORT QDesignerDnDItemInterface
|
||||
{
|
||||
public:
|
||||
enum DropType { MoveDrop, CopyDrop };
|
||||
|
||||
QDesignerDnDItemInterface() {}
|
||||
virtual ~QDesignerDnDItemInterface() {}
|
||||
|
||||
virtual DomUI *domUi() const = 0;
|
||||
virtual QWidget *widget() const = 0;
|
||||
virtual QWidget *decoration() const = 0;
|
||||
virtual QPoint hotSpot() const = 0;
|
||||
virtual DropType type() const = 0;
|
||||
virtual QWidget *source() const = 0;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // ABSTRACTDNDITEM_H
|
||||
98
third/designer/lib/sdk/abstractdnditem.qdoc
Normal file
@@ -0,0 +1,98 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the documentation of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:FDL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in a
|
||||
** written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Free Documentation License
|
||||
** Alternatively, this file may be used under the terms of the GNU Free
|
||||
** Documentation License version 1.3 as published by the Free Software
|
||||
** Foundation and appearing in the file included in the packaging of this
|
||||
** file.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
/*!
|
||||
\class QDesignerDnDItemInterface
|
||||
\brief The QDesignerDnDItemInterface class provides an interface that is used to manage items
|
||||
during a drag and drop operation.
|
||||
\inmodule QtDesigner
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum QDesignerDnDItemInterface::DropType
|
||||
|
||||
This enum describes the result of a drag and drop operation.
|
||||
|
||||
\value MoveDrop The item was moved.
|
||||
\value CopyDrop The item was copied.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QDesignerDnDItemInterface::QDesignerDnDItemInterface()
|
||||
|
||||
Constructs a new interface to a drag and drop item.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QDesignerDnDItemInterface::~QDesignerDnDItemInterface()
|
||||
|
||||
Destroys the interface to the item.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn DomUI *QDesignerDnDItemInterface::domUi() const
|
||||
|
||||
Returns a user interface object for the item.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QWidget *QDesignerDnDItemInterface::widget() const
|
||||
|
||||
Returns the widget being copied or moved in the drag and drop operation.
|
||||
|
||||
\sa source()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QWidget *QDesignerDnDItemInterface::decoration() const
|
||||
|
||||
Returns the widget used to represent the item.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QPoint QDesignerDnDItemInterface::hotSpot() const
|
||||
|
||||
Returns the cursor's hotspot.
|
||||
|
||||
\sa QDrag::hotSpot()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn DropType QDesignerDnDItemInterface::type() const
|
||||
|
||||
Returns the type of drag and drop operation in progress.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QWidget *QDesignerDnDItemInterface::source() const
|
||||
|
||||
Returns the widget that is the source of the drag and drop operation; i.e. the original
|
||||
container of the widget being dragged.
|
||||
|
||||
\sa widget()
|
||||
*/
|
||||
630
third/designer/lib/sdk/abstractformeditor.cpp
Normal file
@@ -0,0 +1,630 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "abstractformeditor.h"
|
||||
#include "abstractdialoggui_p.h"
|
||||
#include "abstractintrospection_p.h"
|
||||
#include "abstractsettings_p.h"
|
||||
#include "abstractoptionspage_p.h"
|
||||
|
||||
#include <QtDesigner/QDesignerWidgetBoxInterface>
|
||||
#include <QtDesigner/QDesignerPropertyEditorInterface>
|
||||
#include <QtDesigner/QDesignerFormWindowManagerInterface>
|
||||
#include <QtDesigner/QExtensionManager>
|
||||
#include <QtDesigner/QDesignerMetaDataBaseInterface>
|
||||
#include <QtDesigner/QDesignerWidgetDataBaseInterface>
|
||||
#include <QtDesigner/QDesignerWidgetFactoryInterface>
|
||||
#include <QtDesigner/QDesignerObjectInspectorInterface>
|
||||
#include <QtDesigner/QDesignerBrushManagerInterface>
|
||||
#include <QtDesigner/QDesignerIntegrationInterface>
|
||||
#include <QtDesigner/QDesignerIconCacheInterface>
|
||||
#include <QtDesigner/QDesignerActionEditorInterface>
|
||||
#include <pluginmanager_p.h>
|
||||
#include <qtresourcemodel_p.h>
|
||||
#include <qtgradientmanager.h>
|
||||
#include <widgetfactory_p.h>
|
||||
#include <shared_settings_p.h>
|
||||
#include <formwindowbase_p.h>
|
||||
#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(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);
|
||||
}
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QDesignerFormEditorInterfacePrivate {
|
||||
public:
|
||||
QDesignerFormEditorInterfacePrivate();
|
||||
~QDesignerFormEditorInterfacePrivate();
|
||||
|
||||
|
||||
QPointer<QWidget> m_topLevel;
|
||||
QPointer<QDesignerWidgetBoxInterface> m_widgetBox;
|
||||
QPointer<QDesignerPropertyEditorInterface> m_propertyEditor;
|
||||
QPointer<QDesignerFormWindowManagerInterface> m_formWindowManager;
|
||||
QPointer<QExtensionManager> m_extensionManager;
|
||||
QPointer<QDesignerMetaDataBaseInterface> m_metaDataBase;
|
||||
QPointer<QDesignerWidgetDataBaseInterface> m_widgetDataBase;
|
||||
QPointer<QDesignerWidgetFactoryInterface> m_widgetFactory;
|
||||
QPointer<QDesignerObjectInspectorInterface> m_objectInspector;
|
||||
QPointer<QDesignerBrushManagerInterface> m_brushManager;
|
||||
QPointer<QDesignerIntegrationInterface> m_integration;
|
||||
QPointer<QDesignerIconCacheInterface> m_iconCache;
|
||||
QPointer<QDesignerActionEditorInterface> m_actionEditor;
|
||||
QDesignerSettingsInterface *m_settingsManager;
|
||||
QDesignerPluginManager *m_pluginManager;
|
||||
QDesignerPromotionInterface *m_promotion;
|
||||
QDesignerIntrospectionInterface *m_introspection;
|
||||
QDesignerDialogGuiInterface *m_dialogGui;
|
||||
QPointer<QtResourceModel> m_resourceModel;
|
||||
QPointer<QtGradientManager> m_gradientManager; // instantiated and deleted by designer_integration
|
||||
QList<QDesignerOptionsPageInterface*> m_optionsPages;
|
||||
};
|
||||
|
||||
QDesignerFormEditorInterfacePrivate::QDesignerFormEditorInterfacePrivate() :
|
||||
m_settingsManager(0),
|
||||
m_pluginManager(0),
|
||||
m_promotion(0),
|
||||
m_introspection(0),
|
||||
m_dialogGui(0),
|
||||
m_resourceModel(0),
|
||||
m_gradientManager(0)
|
||||
{
|
||||
}
|
||||
|
||||
QDesignerFormEditorInterfacePrivate::~QDesignerFormEditorInterfacePrivate()
|
||||
{
|
||||
delete m_settingsManager;
|
||||
delete m_formWindowManager;
|
||||
delete m_promotion;
|
||||
delete m_introspection;
|
||||
delete m_dialogGui;
|
||||
delete m_resourceModel;
|
||||
qDeleteAll(m_optionsPages);
|
||||
}
|
||||
|
||||
/*!
|
||||
\class QDesignerFormEditorInterface
|
||||
|
||||
\brief The QDesignerFormEditorInterface class allows you to access
|
||||
Qt Designer's various components.
|
||||
|
||||
\inmodule QtDesigner
|
||||
|
||||
\QD's current QDesignerFormEditorInterface object holds
|
||||
information about all \QD's components: The action editor, the
|
||||
object inspector, the property editor, the widget box, and the
|
||||
extension and form window managers. QDesignerFormEditorInterface
|
||||
contains a collection of functions that provides interfaces to all
|
||||
these components. They are typically used to query (and
|
||||
manipulate) the respective component. For example:
|
||||
|
||||
\snippet doc/src/snippets/code/tools_designer_src_lib_sdk_abstractformeditor.cpp 0
|
||||
|
||||
QDesignerFormEditorInterface is not intended to be instantiated
|
||||
directly. A pointer to \QD's current QDesignerFormEditorInterface
|
||||
object (\c formEditor in the example above) is provided by the
|
||||
QDesignerCustomWidgetInterface::initialize() function's
|
||||
parameter. When implementing a custom widget plugin, you must
|
||||
subclass the QDesignerCustomWidgetInterface to expose your plugin
|
||||
to \QD.
|
||||
|
||||
QDesignerFormEditorInterface also provides functions that can set
|
||||
the action editor, property editor, object inspector and widget
|
||||
box. These are only useful if you want to provide your own custom
|
||||
components.
|
||||
|
||||
If designer is embedded in another program, one could to provide its
|
||||
own settings manager. The manager is used by the components of \QD
|
||||
to store/retrieve persistent configuration settings. The default
|
||||
manager uses QSettings as the backend.
|
||||
|
||||
Finally, QDesignerFormEditorInterface provides the topLevel()
|
||||
function that returns \QD's top-level widget.
|
||||
|
||||
\sa QDesignerCustomWidgetInterface
|
||||
*/
|
||||
|
||||
/*!
|
||||
Constructs a QDesignerFormEditorInterface object with the given \a
|
||||
parent.
|
||||
*/
|
||||
|
||||
QDesignerFormEditorInterface::QDesignerFormEditorInterface(QObject *parent)
|
||||
: QObject(parent),
|
||||
d(new QDesignerFormEditorInterfacePrivate())
|
||||
{
|
||||
initResources();
|
||||
}
|
||||
|
||||
/*!
|
||||
Destroys the QDesignerFormEditorInterface object.
|
||||
*/
|
||||
QDesignerFormEditorInterface::~QDesignerFormEditorInterface()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns an interface to \QD's widget box.
|
||||
|
||||
\sa setWidgetBox()
|
||||
*/
|
||||
QDesignerWidgetBoxInterface *QDesignerFormEditorInterface::widgetBox() const
|
||||
{
|
||||
return d->m_widgetBox;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets \QD's widget box to be the specified \a widgetBox.
|
||||
|
||||
\sa widgetBox()
|
||||
*/
|
||||
void QDesignerFormEditorInterface::setWidgetBox(QDesignerWidgetBoxInterface *widgetBox)
|
||||
{
|
||||
d->m_widgetBox = widgetBox;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns an interface to \QD's property editor.
|
||||
|
||||
\sa setPropertyEditor()
|
||||
*/
|
||||
QDesignerPropertyEditorInterface *QDesignerFormEditorInterface::propertyEditor() const
|
||||
{
|
||||
return d->m_propertyEditor;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets \QD's property editor to be the specified \a propertyEditor.
|
||||
|
||||
\sa propertyEditor()
|
||||
*/
|
||||
void QDesignerFormEditorInterface::setPropertyEditor(QDesignerPropertyEditorInterface *propertyEditor)
|
||||
{
|
||||
d->m_propertyEditor = propertyEditor;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns an interface to \QD's action editor.
|
||||
|
||||
\sa setActionEditor()
|
||||
*/
|
||||
QDesignerActionEditorInterface *QDesignerFormEditorInterface::actionEditor() const
|
||||
{
|
||||
return d->m_actionEditor;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets \QD's action editor to be the specified \a actionEditor.
|
||||
|
||||
\sa actionEditor()
|
||||
*/
|
||||
void QDesignerFormEditorInterface::setActionEditor(QDesignerActionEditorInterface *actionEditor)
|
||||
{
|
||||
d->m_actionEditor = actionEditor;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns \QD's top-level widget.
|
||||
*/
|
||||
QWidget *QDesignerFormEditorInterface::topLevel() const
|
||||
{
|
||||
return d->m_topLevel;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
void QDesignerFormEditorInterface::setTopLevel(QWidget *topLevel)
|
||||
{
|
||||
d->m_topLevel = topLevel;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns an interface to \QD's form window manager.
|
||||
*/
|
||||
QDesignerFormWindowManagerInterface *QDesignerFormEditorInterface::formWindowManager() const
|
||||
{
|
||||
return d->m_formWindowManager;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
void QDesignerFormEditorInterface::setFormManager(QDesignerFormWindowManagerInterface *formWindowManager)
|
||||
{
|
||||
d->m_formWindowManager = formWindowManager;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns an interface to \QD's extension manager.
|
||||
*/
|
||||
QExtensionManager *QDesignerFormEditorInterface::extensionManager() const
|
||||
{
|
||||
return d->m_extensionManager;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
void QDesignerFormEditorInterface::setExtensionManager(QExtensionManager *extensionManager)
|
||||
{
|
||||
d->m_extensionManager = extensionManager;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
||||
Returns an interface to the meta database used by the form editor.
|
||||
*/
|
||||
QDesignerMetaDataBaseInterface *QDesignerFormEditorInterface::metaDataBase() const
|
||||
{
|
||||
return d->m_metaDataBase;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
void QDesignerFormEditorInterface::setMetaDataBase(QDesignerMetaDataBaseInterface *metaDataBase)
|
||||
{
|
||||
d->m_metaDataBase = metaDataBase;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
||||
Returns an interface to the widget database used by the form editor.
|
||||
*/
|
||||
QDesignerWidgetDataBaseInterface *QDesignerFormEditorInterface::widgetDataBase() const
|
||||
{
|
||||
return d->m_widgetDataBase;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
void QDesignerFormEditorInterface::setWidgetDataBase(QDesignerWidgetDataBaseInterface *widgetDataBase)
|
||||
{
|
||||
d->m_widgetDataBase = widgetDataBase;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
||||
Returns an interface to the designer promotion handler.
|
||||
*/
|
||||
|
||||
QDesignerPromotionInterface *QDesignerFormEditorInterface::promotion() const
|
||||
{
|
||||
return d->m_promotion;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
||||
Sets the designer promotion handler.
|
||||
*/
|
||||
|
||||
void QDesignerFormEditorInterface::setPromotion(QDesignerPromotionInterface *promotion)
|
||||
{
|
||||
if (d->m_promotion)
|
||||
delete d->m_promotion;
|
||||
d->m_promotion = promotion;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
||||
Returns an interface to the widget factory used by the form editor
|
||||
to create widgets for the form.
|
||||
*/
|
||||
QDesignerWidgetFactoryInterface *QDesignerFormEditorInterface::widgetFactory() const
|
||||
{
|
||||
return d->m_widgetFactory;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
void QDesignerFormEditorInterface::setWidgetFactory(QDesignerWidgetFactoryInterface *widgetFactory)
|
||||
{
|
||||
d->m_widgetFactory = widgetFactory;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns an interface to \QD's object inspector.
|
||||
*/
|
||||
QDesignerObjectInspectorInterface *QDesignerFormEditorInterface::objectInspector() const
|
||||
{
|
||||
return d->m_objectInspector;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets \QD's object inspector to be the specified \a
|
||||
objectInspector.
|
||||
|
||||
\sa objectInspector()
|
||||
*/
|
||||
void QDesignerFormEditorInterface::setObjectInspector(QDesignerObjectInspectorInterface *objectInspector)
|
||||
{
|
||||
d->m_objectInspector = objectInspector;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
||||
Returns an interface to the brush manager used by the palette editor.
|
||||
*/
|
||||
QDesignerBrushManagerInterface *QDesignerFormEditorInterface::brushManager() const
|
||||
{
|
||||
return d->m_brushManager;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
void QDesignerFormEditorInterface::setBrushManager(QDesignerBrushManagerInterface *brushManager)
|
||||
{
|
||||
d->m_brushManager = brushManager;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
||||
Returns an interface to the integration.
|
||||
*/
|
||||
QDesignerIntegrationInterface *QDesignerFormEditorInterface::integration() const
|
||||
{
|
||||
return d->m_integration;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
void QDesignerFormEditorInterface::setIntegration(QDesignerIntegrationInterface *integration)
|
||||
{
|
||||
d->m_integration = integration;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
||||
Returns an interface to the icon cache used by the form editor to
|
||||
manage icons.
|
||||
*/
|
||||
QDesignerIconCacheInterface *QDesignerFormEditorInterface::iconCache() const
|
||||
{
|
||||
return d->m_iconCache;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
void QDesignerFormEditorInterface::setIconCache(QDesignerIconCacheInterface *cache)
|
||||
{
|
||||
d->m_iconCache = cache;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
\since 4.5
|
||||
Returns the list of options pages that allow the user to configure \QD components.
|
||||
*/
|
||||
QList<QDesignerOptionsPageInterface*> QDesignerFormEditorInterface::optionsPages() const
|
||||
{
|
||||
return d->m_optionsPages;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
\since 4.5
|
||||
Sets the list of options pages that allow the user to configure \QD components.
|
||||
*/
|
||||
void QDesignerFormEditorInterface::setOptionsPages(const QList<QDesignerOptionsPageInterface*> &optionsPages)
|
||||
{
|
||||
d->m_optionsPages = optionsPages;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
||||
Returns the plugin manager used by the form editor.
|
||||
*/
|
||||
QDesignerPluginManager *QDesignerFormEditorInterface::pluginManager() const
|
||||
{
|
||||
return d->m_pluginManager;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
||||
Sets the plugin manager used by the form editor to the specified
|
||||
\a pluginManager.
|
||||
*/
|
||||
void QDesignerFormEditorInterface::setPluginManager(QDesignerPluginManager *pluginManager)
|
||||
{
|
||||
d->m_pluginManager = pluginManager;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
\since 4.4
|
||||
Returns the resource model used by the form editor.
|
||||
*/
|
||||
QtResourceModel *QDesignerFormEditorInterface::resourceModel() const
|
||||
{
|
||||
return d->m_resourceModel;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
||||
Sets the resource model used by the form editor to the specified
|
||||
\a resourceModel.
|
||||
*/
|
||||
void QDesignerFormEditorInterface::setResourceModel(QtResourceModel *resourceModel)
|
||||
{
|
||||
d->m_resourceModel = resourceModel;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
\since 4.4
|
||||
Returns the gradient manager used by the style sheet editor.
|
||||
*/
|
||||
QtGradientManager *QDesignerFormEditorInterface::gradientManager() const
|
||||
{
|
||||
return d->m_gradientManager;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
||||
Sets the gradient manager used by the style sheet editor to the specified
|
||||
\a gradientManager.
|
||||
*/
|
||||
void QDesignerFormEditorInterface::setGradientManager(QtGradientManager *gradientManager)
|
||||
{
|
||||
d->m_gradientManager = gradientManager;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
\since 4.5
|
||||
Returns the settings manager used by the components to store persistent settings.
|
||||
*/
|
||||
QDesignerSettingsInterface *QDesignerFormEditorInterface::settingsManager() const
|
||||
{
|
||||
return d->m_settingsManager;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
\since 4.5
|
||||
Sets the settings manager used to store/retrieve the persistent settings of the components.
|
||||
*/
|
||||
void QDesignerFormEditorInterface::setSettingsManager(QDesignerSettingsInterface *settingsManager)
|
||||
{
|
||||
if (d->m_settingsManager)
|
||||
delete d->m_settingsManager;
|
||||
d->m_settingsManager = settingsManager;
|
||||
|
||||
// This is a (hopefully) safe place to perform settings-dependent
|
||||
// initializations.
|
||||
const qdesigner_internal::QDesignerSharedSettings settings(this);
|
||||
qdesigner_internal::FormWindowBase::setDefaultDesignerGrid(settings.defaultGrid());
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
\since 4.4
|
||||
Returns the introspection used by the form editor.
|
||||
*/
|
||||
QDesignerIntrospectionInterface *QDesignerFormEditorInterface::introspection() const
|
||||
{
|
||||
return d->m_introspection;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
\since 4.4
|
||||
|
||||
Sets the introspection used by the form editor to the specified \a introspection.
|
||||
*/
|
||||
void QDesignerFormEditorInterface::setIntrospection(QDesignerIntrospectionInterface *introspection)
|
||||
{
|
||||
if (d->m_introspection)
|
||||
delete d->m_introspection;
|
||||
d->m_introspection = introspection;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
||||
Returns the path to the resources used by the form editor.
|
||||
*/
|
||||
QString QDesignerFormEditorInterface::resourceLocation() const
|
||||
{
|
||||
#ifdef Q_WS_MAC
|
||||
return QLatin1String(":/trolltech/formeditor/images/mac");
|
||||
#else
|
||||
return QLatin1String(":/trolltech/formeditor/images/win");
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
||||
Returns the dialog GUI used by the form editor.
|
||||
*/
|
||||
|
||||
QDesignerDialogGuiInterface *QDesignerFormEditorInterface::dialogGui() const
|
||||
{
|
||||
return d->m_dialogGui;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
||||
Sets the dialog GUI used by the form editor to the specified \a dialogGui.
|
||||
*/
|
||||
|
||||
void QDesignerFormEditorInterface::setDialogGui(QDesignerDialogGuiInterface *dialogGui)
|
||||
{
|
||||
delete d->m_dialogGui;
|
||||
d->m_dialogGui = dialogGui;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
159
third/designer/lib/sdk/abstractformeditor.h
Normal file
@@ -0,0 +1,159 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef ABSTRACTFORMEDITOR_H
|
||||
#define ABSTRACTFORMEDITOR_H
|
||||
|
||||
#include <QtDesigner/sdk_global.h>
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QPointer>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QDesignerWidgetBoxInterface;
|
||||
class QDesignerPropertyEditorInterface;
|
||||
class QDesignerFormWindowManagerInterface;
|
||||
class QDesignerWidgetDataBaseInterface;
|
||||
class QDesignerMetaDataBaseInterface;
|
||||
class QDesignerWidgetFactoryInterface;
|
||||
class QDesignerObjectInspectorInterface;
|
||||
class QDesignerPromotionInterface;
|
||||
class QDesignerBrushManagerInterface;
|
||||
class QDesignerIconCacheInterface;
|
||||
class QDesignerActionEditorInterface;
|
||||
class QDesignerIntegrationInterface;
|
||||
class QDesignerPluginManager;
|
||||
class QDesignerIntrospectionInterface;
|
||||
class QDesignerDialogGuiInterface;
|
||||
class QDesignerSettingsInterface;
|
||||
class QDesignerOptionsPageInterface;
|
||||
class QtResourceModel;
|
||||
class QtGradientManager;
|
||||
|
||||
class QWidget;
|
||||
|
||||
class QExtensionManager;
|
||||
|
||||
class QDesignerFormEditorInterfacePrivate;
|
||||
|
||||
class QDESIGNER_SDK_EXPORT QDesignerFormEditorInterface : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QDesignerFormEditorInterface(QObject *parent = 0);
|
||||
virtual ~QDesignerFormEditorInterface();
|
||||
|
||||
QExtensionManager *extensionManager() const;
|
||||
|
||||
QWidget *topLevel() const;
|
||||
QDesignerWidgetBoxInterface *widgetBox() const;
|
||||
QDesignerPropertyEditorInterface *propertyEditor() const;
|
||||
QDesignerObjectInspectorInterface *objectInspector() const;
|
||||
QDesignerFormWindowManagerInterface *formWindowManager() const;
|
||||
QDesignerWidgetDataBaseInterface *widgetDataBase() const;
|
||||
QDesignerMetaDataBaseInterface *metaDataBase() const;
|
||||
QDesignerPromotionInterface *promotion() const;
|
||||
QDesignerWidgetFactoryInterface *widgetFactory() const;
|
||||
QDesignerBrushManagerInterface *brushManager() const;
|
||||
QDesignerIconCacheInterface *iconCache() const;
|
||||
QDesignerActionEditorInterface *actionEditor() const;
|
||||
QDesignerIntegrationInterface *integration() const;
|
||||
QDesignerPluginManager *pluginManager() const;
|
||||
QDesignerIntrospectionInterface *introspection() const;
|
||||
QDesignerDialogGuiInterface *dialogGui() const;
|
||||
QDesignerSettingsInterface *settingsManager() const;
|
||||
QString resourceLocation() const;
|
||||
QtResourceModel *resourceModel() const;
|
||||
QtGradientManager *gradientManager() const;
|
||||
QList<QDesignerOptionsPageInterface*> optionsPages() const;
|
||||
|
||||
void setTopLevel(QWidget *topLevel);
|
||||
void setWidgetBox(QDesignerWidgetBoxInterface *widgetBox);
|
||||
void setPropertyEditor(QDesignerPropertyEditorInterface *propertyEditor);
|
||||
void setObjectInspector(QDesignerObjectInspectorInterface *objectInspector);
|
||||
void setPluginManager(QDesignerPluginManager *pluginManager);
|
||||
void setActionEditor(QDesignerActionEditorInterface *actionEditor);
|
||||
void setIntegration(QDesignerIntegrationInterface *integration);
|
||||
void setIntrospection(QDesignerIntrospectionInterface *introspection);
|
||||
void setDialogGui(QDesignerDialogGuiInterface *dialogGui);
|
||||
void setSettingsManager(QDesignerSettingsInterface *settingsManager);
|
||||
void setResourceModel(QtResourceModel *model);
|
||||
void setGradientManager(QtGradientManager *manager);
|
||||
void setOptionsPages(const QList<QDesignerOptionsPageInterface*> &optionsPages);
|
||||
|
||||
protected:
|
||||
void setFormManager(QDesignerFormWindowManagerInterface *formWindowManager);
|
||||
void setMetaDataBase(QDesignerMetaDataBaseInterface *metaDataBase);
|
||||
void setWidgetDataBase(QDesignerWidgetDataBaseInterface *widgetDataBase);
|
||||
void setPromotion(QDesignerPromotionInterface *promotion);
|
||||
void setWidgetFactory(QDesignerWidgetFactoryInterface *widgetFactory);
|
||||
void setExtensionManager(QExtensionManager *extensionManager);
|
||||
void setBrushManager(QDesignerBrushManagerInterface *brushManager);
|
||||
void setIconCache(QDesignerIconCacheInterface *cache);
|
||||
|
||||
private:
|
||||
QPointer<QWidget> m_pad1;
|
||||
QPointer<QDesignerWidgetBoxInterface> m_pad2;
|
||||
QPointer<QDesignerPropertyEditorInterface> m_pad3;
|
||||
QPointer<QDesignerFormWindowManagerInterface> m_pad4;
|
||||
QPointer<QExtensionManager> m_pad5;
|
||||
QPointer<QDesignerMetaDataBaseInterface> m_pad6;
|
||||
QPointer<QDesignerWidgetDataBaseInterface> m_pad7;
|
||||
QPointer<QDesignerWidgetFactoryInterface> m_pad8;
|
||||
QPointer<QDesignerObjectInspectorInterface> m_pad9;
|
||||
QPointer<QDesignerBrushManagerInterface> m_pad10;
|
||||
QPointer<QDesignerIconCacheInterface> m_pad11;
|
||||
QPointer<QDesignerActionEditorInterface> m_pad12;
|
||||
QDesignerFormEditorInterfacePrivate *d;
|
||||
|
||||
private:
|
||||
QDesignerFormEditorInterface(const QDesignerFormEditorInterface &other);
|
||||
void operator = (const QDesignerFormEditorInterface &other);
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // ABSTRACTFORMEDITOR_H
|
||||
86
third/designer/lib/sdk/abstractformeditorplugin.cpp
Normal file
@@ -0,0 +1,86 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtDesigner/abstractformeditorplugin.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*!
|
||||
\internal
|
||||
\class QDesignerFormEditorPluginInterface
|
||||
\brief The QDesignerFormEditorPluginInterface class provides an interface that is used to
|
||||
manage plugins for Qt Designer's form editor component.
|
||||
\inmodule QtDesigner
|
||||
|
||||
\sa QDesignerFormEditorInterface
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QDesignerFormEditorPluginInterface::~QDesignerFormEditorPluginInterface()
|
||||
|
||||
Destroys the plugin interface.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual bool QDesignerFormEditorPluginInterface::isInitialized() const = 0
|
||||
|
||||
Returns true if the plugin interface is initialized; otherwise returns false.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormEditorPluginInterface::initialize(QDesignerFormEditorInterface *core) = 0
|
||||
|
||||
Initializes the plugin interface for the specified \a core interface.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QAction *QDesignerFormEditorPluginInterface::action() const = 0
|
||||
|
||||
Returns the action associated with this interface.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QDesignerFormEditorInterface *QDesignerFormEditorPluginInterface::core() const = 0
|
||||
|
||||
Returns the core form editor interface associated with this component.
|
||||
*/
|
||||
|
||||
QT_END_NAMESPACE
|
||||
73
third/designer/lib/sdk/abstractformeditorplugin.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef ABSTRACTFORMEDITORPLUGIN_H
|
||||
#define ABSTRACTFORMEDITORPLUGIN_H
|
||||
|
||||
#include <QtDesigner/sdk_global.h>
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QDesignerFormEditorInterface;
|
||||
class QAction;
|
||||
|
||||
class QDESIGNER_SDK_EXPORT QDesignerFormEditorPluginInterface
|
||||
{
|
||||
public:
|
||||
virtual ~QDesignerFormEditorPluginInterface() {}
|
||||
|
||||
virtual bool isInitialized() const = 0;
|
||||
virtual void initialize(QDesignerFormEditorInterface *core) = 0;
|
||||
virtual QAction *action() const = 0;
|
||||
|
||||
virtual QDesignerFormEditorInterface *core() const = 0;
|
||||
};
|
||||
Q_DECLARE_INTERFACE(QDesignerFormEditorPluginInterface, "com.trolltech.Qt.Designer.QDesignerFormEditorPluginInterface")
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // ABSTRACTFORMEDITORPLUGIN_H
|
||||
814
third/designer/lib/sdk/abstractformwindow.cpp
Normal file
@@ -0,0 +1,814 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "abstractformwindow.h"
|
||||
|
||||
#include <widgetfactory_p.h>
|
||||
|
||||
#include <QtGui/QTabBar>
|
||||
#include <QtGui/QSizeGrip>
|
||||
#include <QtGui/QAbstractButton>
|
||||
#include <QtGui/QToolBox>
|
||||
#include <QtGui/QMenuBar>
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtGui/QDockWidget>
|
||||
#include <QtGui/QToolBar>
|
||||
|
||||
#include <QtCore/qdebug.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*!
|
||||
\class QDesignerFormWindowInterface
|
||||
|
||||
\brief The QDesignerFormWindowInterface class allows you to query
|
||||
and manipulate form windows appearing in Qt Designer's workspace.
|
||||
|
||||
\inmodule QtDesigner
|
||||
|
||||
QDesignerFormWindowInterface provides information about
|
||||
the associated form window as well as allowing its properties to be
|
||||
altered. The interface is not intended to be instantiated
|
||||
directly, but to provide access to \QD's current form windows
|
||||
controlled by \QD's \l {QDesignerFormWindowManagerInterface}{form
|
||||
window manager}.
|
||||
|
||||
If you are looking for the form window containing a specific
|
||||
widget, you can use the static
|
||||
QDesignerFormWindowInterface::findFormWindow() function:
|
||||
|
||||
\snippet doc/src/snippets/code/tools_designer_src_lib_sdk_abstractformwindow.cpp 0
|
||||
|
||||
But in addition, you can access any of the current form windows
|
||||
through \QD's form window manager: Use the
|
||||
QDesignerFormEditorInterface::formWindowManager() function to
|
||||
retrieve an interface to the manager. Once you have this
|
||||
interface, you have access to all of \QD's current form windows
|
||||
through the QDesignerFormWindowManagerInterface::formWindow()
|
||||
function. For example:
|
||||
|
||||
\snippet doc/src/snippets/code/tools_designer_src_lib_sdk_abstractformwindow.cpp 1
|
||||
|
||||
The pointer to \QD's current QDesignerFormEditorInterface object
|
||||
(\c formEditor in the example above) is provided by the
|
||||
QDesignerCustomWidgetInterface::initialize() function's
|
||||
parameter. When implementing a custom widget plugin, you must
|
||||
subclass the QDesignerCustomWidgetInterface class to expose your
|
||||
plugin to \QD.
|
||||
|
||||
Once you have the form window, you can query its properties. For
|
||||
example, a plain custom widget plugin is managed by \QD only at
|
||||
its top level, i.e. none of its child widgets can be resized in
|
||||
\QD's workspace. But QDesignerFormWindowInterface provides you
|
||||
with functions that enables you to control whether a widget should
|
||||
be managed by \QD, or not:
|
||||
|
||||
\snippet doc/src/snippets/code/tools_designer_src_lib_sdk_abstractformwindow.cpp 2
|
||||
|
||||
The complete list of functions concerning widget management is:
|
||||
isManaged(), manageWidget() and unmanageWidget(). There is also
|
||||
several associated signals: widgetManaged(), widgetRemoved(),
|
||||
aboutToUnmanageWidget() and widgetUnmanaged().
|
||||
|
||||
In addition to controlling the management of widgets, you can
|
||||
control the current selection in the form window using the
|
||||
selectWidget(), clearSelection() and emitSelectionChanged()
|
||||
functions, and the selectionChanged() signal.
|
||||
|
||||
You can also retrieve information about where the form is stored
|
||||
using absoluteDir(), its include files using includeHints(), and
|
||||
its layout and pixmap functions using layoutDefault(),
|
||||
layoutFunction() and pixmapFunction(). You can find out whether
|
||||
the form window has been modified (but not saved) or not, using
|
||||
the isDirty() function. You can retrieve its author(), its
|
||||
contents(), its fileName(), associated comment() and
|
||||
exportMacro(), its mainContainer(), its features(), its grid() and
|
||||
its resourceFiles().
|
||||
|
||||
The interface provides you with functions and slots allowing you
|
||||
to alter most of this information as well. The exception is the
|
||||
directory storing the form window. Finally, there is several
|
||||
signals associated with changes to the information mentioned above
|
||||
and to the form window in general.
|
||||
|
||||
\sa QDesignerFormWindowCursorInterface,
|
||||
QDesignerFormEditorInterface, QDesignerFormWindowManagerInterface
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum QDesignerFormWindowInterface::FeatureFlag
|
||||
|
||||
This enum describes the features that are available and can be
|
||||
controlled by the form window interface. These values are used
|
||||
when querying the form window to determine which features it
|
||||
supports:
|
||||
|
||||
\value EditFeature Form editing
|
||||
\value GridFeature Grid display and snap-to-grid facilities for editing
|
||||
\value TabOrderFeature Tab order management
|
||||
\value DefaultFeature Support for default features (form editing and grid)
|
||||
|
||||
\sa hasFeature(), features()
|
||||
*/
|
||||
|
||||
/*!
|
||||
Constructs a form window interface with the given \a parent and
|
||||
the specified window \a flags.
|
||||
*/
|
||||
QDesignerFormWindowInterface::QDesignerFormWindowInterface(QWidget *parent, Qt::WindowFlags flags)
|
||||
: QWidget(parent, flags)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Destroys the form window interface.
|
||||
*/
|
||||
QDesignerFormWindowInterface::~QDesignerFormWindowInterface()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns a pointer to \QD's current QDesignerFormEditorInterface
|
||||
object.
|
||||
*/
|
||||
QDesignerFormEditorInterface *QDesignerFormWindowInterface::core() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn QDesignerFormWindowInterface *QDesignerFormWindowInterface::findFormWindow(QWidget *widget)
|
||||
|
||||
Returns the form window interface for the given \a widget.
|
||||
*/
|
||||
|
||||
static inline bool stopFindAtTopLevel(const QObject *w, bool stopAtMenu)
|
||||
{
|
||||
// Do we need to go beyond top levels when looking for the form window?
|
||||
// 1) A dialog has a window attribute at the moment it is created
|
||||
// before it is properly embedded into a form window. The property
|
||||
// sheet queries the layout attributes precisely at this moment.
|
||||
// 2) In the case of floating docks and toolbars, we also need to go beyond the top level window.
|
||||
// 3) In the case of menu editing, we don't want to block events from the
|
||||
// Designer menu, so, we say stop.
|
||||
// Note that there must be no false positives for dialogs parented on
|
||||
// the form (for example, the "change object name" dialog), else, its
|
||||
// events will be blocked.
|
||||
|
||||
if (stopAtMenu && w->inherits("QDesignerMenu"))
|
||||
return true;
|
||||
return !qdesigner_internal::WidgetFactory::isFormEditorObject(w);
|
||||
}
|
||||
|
||||
QDesignerFormWindowInterface *QDesignerFormWindowInterface::findFormWindow(QWidget *w)
|
||||
{
|
||||
while (w != 0) {
|
||||
if (QDesignerFormWindowInterface *fw = qobject_cast<QDesignerFormWindowInterface*>(w)) {
|
||||
return fw;
|
||||
} else {
|
||||
if (w->isWindow() && stopFindAtTopLevel(w, true))
|
||||
break;
|
||||
}
|
||||
|
||||
w = w->parentWidget();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn QDesignerFormWindowInterface *QDesignerFormWindowInterface::findFormWindow(QObject *object)
|
||||
|
||||
Returns the form window interface for the given \a object.
|
||||
|
||||
\since 4.4
|
||||
*/
|
||||
|
||||
QDesignerFormWindowInterface *QDesignerFormWindowInterface::findFormWindow(QObject *object)
|
||||
{
|
||||
while (object != 0) {
|
||||
if (QDesignerFormWindowInterface *fw = qobject_cast<QDesignerFormWindowInterface*>(object)) {
|
||||
return fw;
|
||||
} else {
|
||||
QWidget *w = qobject_cast<QWidget *>(object);
|
||||
// QDesignerMenu is a window, so stopFindAtTopLevel(w) returns 0.
|
||||
// However, we want to find the form window for QActions of a menu.
|
||||
// If this check is inside stopFindAtTopLevel(w), it will break designer
|
||||
// menu editing (e.g. when clicking on items inside an opened menu)
|
||||
if (w && w->isWindow() && stopFindAtTopLevel(w, false))
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
object = object->parent();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn virtual QString QDesignerFormWindowInterface::fileName() const
|
||||
|
||||
Returns the file name of the UI file that describes the form
|
||||
currently being shown.
|
||||
|
||||
\sa setFileName()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QDir QDesignerFormWindowInterface::absoluteDir() const
|
||||
|
||||
Returns the absolute location of the directory containing the form
|
||||
shown in the form window.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QString QDesignerFormWindowInterface::contents() const
|
||||
|
||||
Returns details of the contents of the form currently being
|
||||
displayed in the window.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowInterface::setContents(QIODevice *device)
|
||||
|
||||
Sets the form's contents using data obtained from the given \a device.
|
||||
|
||||
Data can be read from QFile objects or any other subclass of QIODevice.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual Feature QDesignerFormWindowInterface::features() const
|
||||
|
||||
Returns a combination of the features provided by the form window
|
||||
associated with the interface. The value returned can be tested
|
||||
against the \l Feature enum values to determine which features are
|
||||
supported by the window.
|
||||
|
||||
\sa setFeatures(), hasFeature()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual bool QDesignerFormWindowInterface::hasFeature(Feature feature) const
|
||||
|
||||
Returns true if the form window offers the specified \a feature;
|
||||
otherwise returns false.
|
||||
|
||||
\sa features()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QString QDesignerFormWindowInterface::author() const
|
||||
|
||||
Returns details of the author or creator of the form currently
|
||||
being displayed in the window.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowInterface::setAuthor(const QString &author)
|
||||
|
||||
Sets the details for the author or creator of the form to the \a
|
||||
author specified.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QString QDesignerFormWindowInterface::comment() const
|
||||
|
||||
Returns comments about the form currently being displayed in the window.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowInterface::setComment(const QString &comment)
|
||||
|
||||
Sets the information about the form to the \a comment
|
||||
specified. This information should be a human-readable comment
|
||||
about the form.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowInterface::layoutDefault(int *margin, int *spacing)
|
||||
|
||||
Fills in the default margin and spacing for the form's default
|
||||
layout in the \a margin and \a spacing variables specified.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowInterface::setLayoutDefault(int margin, int spacing)
|
||||
|
||||
Sets the default \a margin and \a spacing for the form's layout.
|
||||
|
||||
\sa layoutDefault()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowInterface::layoutFunction(QString *margin, QString *spacing)
|
||||
|
||||
Fills in the current margin and spacing for the form's layout in
|
||||
the \a margin and \a spacing variables specified.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowInterface::setLayoutFunction(const QString &margin, const QString &spacing)
|
||||
|
||||
Sets the \a margin and \a spacing for the form's layout.
|
||||
|
||||
The default layout properties will be replaced by the
|
||||
corresponding layout functions when \c uic generates code for the
|
||||
form, that is, if the functions are specified. This is useful when
|
||||
different environments requires different layouts for the same
|
||||
form.
|
||||
|
||||
\sa layoutFunction()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QString QDesignerFormWindowInterface::pixmapFunction() const
|
||||
|
||||
Returns the name of the function used to load pixmaps into the
|
||||
form window.
|
||||
|
||||
\sa setPixmapFunction()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowInterface::setPixmapFunction(const QString &pixmapFunction)
|
||||
|
||||
Sets the function used to load pixmaps into the form window
|
||||
to the given \a pixmapFunction.
|
||||
|
||||
\sa pixmapFunction()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QString QDesignerFormWindowInterface::exportMacro() const
|
||||
|
||||
Returns the export macro associated with the form currently being
|
||||
displayed in the window. The export macro is used when the form
|
||||
is compiled to create a widget plugin.
|
||||
|
||||
\sa {Creating Custom Widgets for Qt Designer}
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowInterface::setExportMacro(const QString &exportMacro)
|
||||
|
||||
Sets the form window's export macro to \a exportMacro. The export
|
||||
macro is used when building a widget plugin to export the form's
|
||||
interface to other components.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QStringList QDesignerFormWindowInterface::includeHints() const
|
||||
|
||||
Returns a list of the header files that will be included in the
|
||||
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>.
|
||||
|
||||
\sa setIncludeHints()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowInterface::setIncludeHints(const QStringList &includeHints)
|
||||
|
||||
Sets the header files that will be included in the form window's
|
||||
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>.
|
||||
|
||||
\sa includeHints()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QDesignerFormWindowCursorInterface *QDesignerFormWindowInterface::cursor() const
|
||||
|
||||
Returns the cursor interface used by the form window.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual int QDesignerFormWindowInterface::toolCount() const
|
||||
|
||||
Returns the number of tools available.
|
||||
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual int QDesignerFormWindowInterface::currentTool() const
|
||||
|
||||
Returns the index of the current tool in use.
|
||||
|
||||
\sa setCurrentTool()
|
||||
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowInterface::setCurrentTool(int index)
|
||||
|
||||
Sets the current tool to be the one with the given \a index.
|
||||
|
||||
\sa currentTool()
|
||||
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QDesignerFormWindowToolInterface *QDesignerFormWindowInterface::tool(int index) const
|
||||
|
||||
Returns an interface to the tool with the given \a index.
|
||||
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowInterface::registerTool(QDesignerFormWindowToolInterface *tool)
|
||||
|
||||
Registers the given \a tool with the form window.
|
||||
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QPoint QDesignerFormWindowInterface::grid() const = 0
|
||||
|
||||
Returns the grid spacing used by the form window.
|
||||
|
||||
\sa setGrid()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QWidget *QDesignerFormWindowInterface::mainContainer() const
|
||||
|
||||
Returns the main container widget for the form window.
|
||||
|
||||
\sa setMainContainer()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowInterface::setMainContainer(QWidget *mainContainer)
|
||||
|
||||
Sets the main container widget on the form to the specified \a
|
||||
mainContainer.
|
||||
|
||||
\sa mainContainer(), mainContainerChanged()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual bool QDesignerFormWindowInterface::isManaged(QWidget *widget) const
|
||||
|
||||
Returns true if the specified \a widget is managed by the form
|
||||
window; otherwise returns false.
|
||||
|
||||
\sa manageWidget()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual bool QDesignerFormWindowInterface::isDirty() const
|
||||
|
||||
Returns true if the form window is "dirty" (modified but not
|
||||
saved); otherwise returns false.
|
||||
|
||||
\sa setDirty()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QUndoStack *QDesignerFormWindowInterface::commandHistory() const
|
||||
|
||||
Returns an object that can be used to obtain the commands used so
|
||||
far in the construction of the form.
|
||||
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowInterface::beginCommand(const QString &description)
|
||||
|
||||
Begins execution of a command with the given \a
|
||||
description. Commands are executed between beginCommand() and
|
||||
endCommand() function calls to ensure that they are recorded on
|
||||
the undo stack.
|
||||
|
||||
\sa endCommand()
|
||||
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowInterface::endCommand()
|
||||
|
||||
Ends execution of the current command.
|
||||
|
||||
\sa beginCommand()
|
||||
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowInterface::simplifySelection(QList<QWidget*> *widgets) const
|
||||
|
||||
Simplifies the selection of widgets specified by \a widgets.
|
||||
|
||||
\sa selectionChanged()
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowInterface::emitSelectionChanged()
|
||||
|
||||
Emits the selectionChanged() signal.
|
||||
|
||||
\sa selectWidget(), clearSelection()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QStringList QDesignerFormWindowInterface::resourceFiles() const
|
||||
|
||||
Returns a list of paths to resource files that are currently being
|
||||
used by the form window.
|
||||
|
||||
\sa addResourceFile(), removeResourceFile()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowInterface::addResourceFile(const QString &path)
|
||||
|
||||
Adds the resource file at the given \a path to those used by the form.
|
||||
|
||||
\sa resourceFiles(), resourceFilesChanged()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowInterface::removeResourceFile(const QString &path)
|
||||
|
||||
Removes the resource file at the specified \a path from the list
|
||||
of those used by the form.
|
||||
|
||||
\sa resourceFiles(), resourceFilesChanged()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowInterface::ensureUniqueObjectName(QObject *object)
|
||||
|
||||
Ensures that the specified \a object has a unique name amongst the
|
||||
other objects on the form.
|
||||
|
||||
\internal
|
||||
*/
|
||||
|
||||
// Slots
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowInterface::manageWidget(QWidget *widget)
|
||||
|
||||
Instructs the form window to manage the specified \a widget.
|
||||
|
||||
\sa isManaged(), unmanageWidget(), widgetManaged()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowInterface::unmanageWidget(QWidget *widget)
|
||||
|
||||
Instructs the form window not to manage the specified \a widget.
|
||||
|
||||
\sa aboutToUnmanageWidget(), widgetUnmanaged()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowInterface::setFeatures(Feature features)
|
||||
|
||||
Enables the specified \a features for the form window.
|
||||
|
||||
\sa features(), featureChanged()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowInterface::setDirty(bool dirty)
|
||||
|
||||
If \a dirty is true, the form window is marked as dirty, meaning
|
||||
that it is modified but not saved. If \a dirty is false, the form
|
||||
window is considered to be unmodified.
|
||||
|
||||
\sa isDirty()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowInterface::clearSelection(bool update)
|
||||
|
||||
Clears the current selection in the form window. If \a update is
|
||||
true, the emitSelectionChanged() function is called, emitting the
|
||||
selectionChanged() signal.
|
||||
|
||||
\sa selectWidget()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowInterface::selectWidget(QWidget *widget, bool select)
|
||||
|
||||
If \a select is true, the given \a widget is selected; otherwise
|
||||
the \a widget is deselected.
|
||||
|
||||
\sa clearSelection(), selectionChanged()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowInterface::setGrid(const QPoint &grid)
|
||||
|
||||
Sets the grid size for the form window to the point specified by
|
||||
\a grid. In this function, the coordinates in the QPoint are used
|
||||
to specify the dimensions of a rectangle in the grid.
|
||||
|
||||
\sa grid()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowInterface::setFileName(const QString &fileName)
|
||||
|
||||
Sets the file name for the form to the given \a fileName.
|
||||
|
||||
\sa fileName(), fileNameChanged()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowInterface::setContents(const QString &contents)
|
||||
|
||||
Sets the contents of the form using data read from the specified
|
||||
\a contents string.
|
||||
|
||||
\sa contents()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowInterface::editWidgets()
|
||||
|
||||
Switches the form window into editing mode.
|
||||
|
||||
\sa \l {Qt Designer's Form Editing Mode}
|
||||
|
||||
\internal
|
||||
*/
|
||||
|
||||
// Signals
|
||||
|
||||
/*!
|
||||
\fn void QDesignerFormWindowInterface::mainContainerChanged(QWidget *mainContainer)
|
||||
|
||||
This signal is emitted whenever the main container changes.
|
||||
The new container is specified by \a mainContainer.
|
||||
|
||||
\sa setMainContainer()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerFormWindowInterface::toolChanged(int toolIndex)
|
||||
|
||||
This signal is emitted whenever the current tool changes.
|
||||
The specified \a toolIndex is the index of the new tool in the list of
|
||||
tools in the widget box.
|
||||
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerFormWindowInterface::fileNameChanged(const QString &fileName)
|
||||
|
||||
This signal is emitted whenever the file name of the form changes.
|
||||
The new file name is specified by \a fileName.
|
||||
|
||||
\sa setFileName()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerFormWindowInterface::featureChanged(Feature feature)
|
||||
|
||||
This signal is emitted whenever a feature changes in the form.
|
||||
The new feature is specified by \a feature.
|
||||
|
||||
\sa setFeatures()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerFormWindowInterface::selectionChanged()
|
||||
|
||||
This signal is emitted whenever the selection in the form changes.
|
||||
|
||||
\sa selectWidget(), clearSelection()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerFormWindowInterface::geometryChanged()
|
||||
|
||||
This signal is emitted whenever the form's geometry changes.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerFormWindowInterface::resourceFilesChanged()
|
||||
|
||||
This signal is emitted whenever the list of resource files used by the
|
||||
form changes.
|
||||
|
||||
\sa resourceFiles()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerFormWindowInterface::widgetManaged(QWidget *widget)
|
||||
|
||||
This signal is emitted whenever a widget on the form becomes managed.
|
||||
The newly managed widget is specified by \a widget.
|
||||
|
||||
\sa manageWidget()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerFormWindowInterface::widgetUnmanaged(QWidget *widget)
|
||||
|
||||
This signal is emitted whenever a widget on the form becomes unmanaged.
|
||||
The newly released widget is specified by \a widget.
|
||||
|
||||
\sa unmanageWidget(), aboutToUnmanageWidget()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerFormWindowInterface::aboutToUnmanageWidget(QWidget *widget)
|
||||
|
||||
This signal is emitted whenever a widget on the form is about to
|
||||
become unmanaged. When this signal is emitted, the specified \a
|
||||
widget is still managed, and a widgetUnmanaged() signal will
|
||||
follow, indicating when it is no longer managed.
|
||||
|
||||
\sa unmanageWidget(), isManaged()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerFormWindowInterface::activated(QWidget *widget)
|
||||
|
||||
This signal is emitted whenever a widget is activated on the form.
|
||||
The activated widget is specified by \a widget.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerFormWindowInterface::changed()
|
||||
|
||||
This signal is emitted whenever a form is changed.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerFormWindowInterface::widgetRemoved(QWidget *widget)
|
||||
|
||||
This signal is emitted whenever a widget is removed from the form.
|
||||
The widget that was removed is specified by \a widget.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerFormWindowInterface::objectRemoved(QObject *object)
|
||||
|
||||
This signal is emitted whenever an object (such as
|
||||
an action or a QButtonGroup) is removed from the form.
|
||||
The object that was removed is specified by \a object.
|
||||
|
||||
\since 4.5
|
||||
*/
|
||||
|
||||
QT_END_NAMESPACE
|
||||
183
third/designer/lib/sdk/abstractformwindow.h
Normal file
@@ -0,0 +1,183 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef ABSTRACTFORMWINDOW_H
|
||||
#define ABSTRACTFORMWINDOW_H
|
||||
|
||||
#include <QtDesigner/sdk_global.h>
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QDesignerFormEditorInterface;
|
||||
class QDesignerFormWindowCursorInterface;
|
||||
class QDesignerFormWindowToolInterface;
|
||||
class DomUI;
|
||||
class QUndoStack;
|
||||
class QDir;
|
||||
|
||||
class QDESIGNER_SDK_EXPORT QDesignerFormWindowInterface: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum FeatureFlag
|
||||
{
|
||||
EditFeature = 0x01,
|
||||
GridFeature = 0x02,
|
||||
TabOrderFeature = 0x04,
|
||||
DefaultFeature = EditFeature | GridFeature
|
||||
};
|
||||
Q_DECLARE_FLAGS(Feature, FeatureFlag)
|
||||
|
||||
public:
|
||||
QDesignerFormWindowInterface(QWidget *parent = 0, Qt::WindowFlags flags = 0);
|
||||
virtual ~QDesignerFormWindowInterface();
|
||||
|
||||
virtual QString fileName() const = 0;
|
||||
virtual QDir absoluteDir() const = 0;
|
||||
|
||||
virtual QString contents() const = 0;
|
||||
virtual void setContents(QIODevice *dev) = 0;
|
||||
|
||||
virtual Feature features() const = 0;
|
||||
virtual bool hasFeature(Feature f) const = 0;
|
||||
|
||||
virtual QString author() const = 0;
|
||||
virtual void setAuthor(const QString &author) = 0;
|
||||
|
||||
virtual QString comment() const = 0;
|
||||
virtual void setComment(const QString &comment) = 0;
|
||||
|
||||
virtual void layoutDefault(int *margin, int *spacing) = 0;
|
||||
virtual void setLayoutDefault(int margin, int spacing) = 0;
|
||||
|
||||
virtual void layoutFunction(QString *margin, QString *spacing) = 0;
|
||||
virtual void setLayoutFunction(const QString &margin, const QString &spacing) = 0;
|
||||
|
||||
virtual QString pixmapFunction() const = 0;
|
||||
virtual void setPixmapFunction(const QString &pixmapFunction) = 0;
|
||||
|
||||
virtual QString exportMacro() const = 0;
|
||||
virtual void setExportMacro(const QString &exportMacro) = 0;
|
||||
|
||||
virtual QStringList includeHints() const = 0;
|
||||
virtual void setIncludeHints(const QStringList &includeHints) = 0;
|
||||
|
||||
virtual QDesignerFormEditorInterface *core() const;
|
||||
virtual QDesignerFormWindowCursorInterface *cursor() const = 0;
|
||||
|
||||
virtual int toolCount() const = 0;
|
||||
|
||||
virtual int currentTool() const = 0;
|
||||
virtual void setCurrentTool(int index) = 0;
|
||||
|
||||
virtual QDesignerFormWindowToolInterface *tool(int index) const = 0;
|
||||
virtual void registerTool(QDesignerFormWindowToolInterface *tool) = 0;
|
||||
|
||||
virtual QPoint grid() const = 0;
|
||||
|
||||
virtual QWidget *mainContainer() const = 0;
|
||||
virtual void setMainContainer(QWidget *mainContainer) = 0;
|
||||
|
||||
virtual bool isManaged(QWidget *widget) const = 0;
|
||||
|
||||
virtual bool isDirty() const = 0;
|
||||
|
||||
static QDesignerFormWindowInterface *findFormWindow(QWidget *w);
|
||||
static QDesignerFormWindowInterface *findFormWindow(QObject *obj);
|
||||
|
||||
virtual QUndoStack *commandHistory() const = 0;
|
||||
virtual void beginCommand(const QString &description) = 0;
|
||||
virtual void endCommand() = 0;
|
||||
|
||||
virtual void simplifySelection(QList<QWidget*> *widgets) const = 0;
|
||||
|
||||
// notifications
|
||||
virtual void emitSelectionChanged() = 0;
|
||||
|
||||
virtual QStringList resourceFiles() const = 0;
|
||||
virtual void addResourceFile(const QString &path) = 0;
|
||||
virtual void removeResourceFile(const QString &path) = 0;
|
||||
|
||||
virtual void ensureUniqueObjectName(QObject *object) = 0;
|
||||
|
||||
public Q_SLOTS:
|
||||
virtual void manageWidget(QWidget *widget) = 0;
|
||||
virtual void unmanageWidget(QWidget *widget) = 0;
|
||||
|
||||
virtual void setFeatures(Feature f) = 0;
|
||||
virtual void setDirty(bool dirty) = 0;
|
||||
virtual void clearSelection(bool changePropertyDisplay = true) = 0;
|
||||
virtual void selectWidget(QWidget *w, bool select = true) = 0;
|
||||
virtual void setGrid(const QPoint &grid) = 0;
|
||||
virtual void setFileName(const QString &fileName) = 0;
|
||||
virtual void setContents(const QString &contents) = 0;
|
||||
|
||||
virtual void editWidgets() = 0;
|
||||
|
||||
Q_SIGNALS:
|
||||
void mainContainerChanged(QWidget *mainContainer);
|
||||
void toolChanged(int toolIndex);
|
||||
void fileNameChanged(const QString &fileName);
|
||||
void featureChanged(Feature f);
|
||||
void selectionChanged();
|
||||
void geometryChanged();
|
||||
|
||||
void resourceFilesChanged();
|
||||
|
||||
void widgetManaged(QWidget *widget);
|
||||
void widgetUnmanaged(QWidget *widget);
|
||||
void aboutToUnmanageWidget(QWidget *widget);
|
||||
void activated(QWidget *widget);
|
||||
|
||||
void changed();
|
||||
void widgetRemoved(QWidget *w);
|
||||
void objectRemoved(QObject *o);
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // ABSTRACTFORMWINDOW_H
|
||||
252
third/designer/lib/sdk/abstractformwindowcursor.cpp
Normal file
@@ -0,0 +1,252 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "abstractformwindowcursor.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*!
|
||||
\class QDesignerFormWindowCursorInterface
|
||||
|
||||
\brief The QDesignerFormWindowCursorInterface class allows you to
|
||||
query and modify a form window's widget selection, and in addition
|
||||
modify the properties of all the form's widgets.
|
||||
|
||||
\inmodule QtDesigner
|
||||
|
||||
QDesignerFormWindowCursorInterface is a convenience class that
|
||||
provides an interface to the associated form window's text cursor;
|
||||
it provides a collection of functions that enables you to query a
|
||||
given form window's selection and change the selection's focus
|
||||
according to defined modes (MoveMode) and movements
|
||||
(MoveOperation). You can also use the interface to query the
|
||||
form's widgets and change their properties.
|
||||
|
||||
The interface is not intended to be instantiated directly, but to
|
||||
provide access to the selections and widgets of \QD's current form
|
||||
windows. QDesignerFormWindowInterface always provides an
|
||||
associated cursor interface. The form window for a given widget
|
||||
can be retrieved using the static
|
||||
QDesignerFormWindowInterface::findFormWindow() functions. For
|
||||
example:
|
||||
|
||||
\snippet doc/src/snippets/code/tools_designer_src_lib_sdk_abstractformwindowcursor.cpp 0
|
||||
|
||||
You can retrieve any of \QD's current form windows through
|
||||
\QD's \l {QDesignerFormWindowManagerInterface}{form window
|
||||
manager}.
|
||||
|
||||
Once you have a form window's cursor interface, you can check if
|
||||
the form window has a selection at all using the hasSelection()
|
||||
function. You can query the form window for its total
|
||||
widgetCount() and selectedWidgetCount(). You can retrieve the
|
||||
currently selected widget (or widgets) using the current() or
|
||||
selectedWidget() functions.
|
||||
|
||||
You can retrieve any of the form window's widgets using the
|
||||
widget() function, and check if a widget is selected using the
|
||||
isWidgetSelected() function. You can use the setProperty()
|
||||
function to set the selected widget's properties, and the
|
||||
setWidgetProperty() or resetWidgetProperty() functions to modify
|
||||
the properties of any given widget.
|
||||
|
||||
Finally, you can change the selection by changing the text
|
||||
cursor's position() using the setPosition() and movePosition()
|
||||
functions.
|
||||
|
||||
\sa QDesignerFormWindowInterface, QDesignerFormWindowManagerInterface
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum QDesignerFormWindowCursorInterface::MoveOperation
|
||||
|
||||
This enum describes the types of text cursor operation that can occur in a form window.
|
||||
|
||||
\value NoMove The cursor does not move.
|
||||
\value Start Moves the cursor to the start of the focus chain.
|
||||
\value End Moves the cursor to the end of the focus chain.
|
||||
\value Next Moves the cursor to the next widget in the focus chain.
|
||||
\value Prev Moves the cursor to the previous widget in the focus chain.
|
||||
\value Left The cursor moves to the left.
|
||||
\value Right The cursor moves to the right.
|
||||
\value Up The cursor moves upwards.
|
||||
\value Down The cursor moves downwards.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum QDesignerFormWindowCursorInterface::MoveMode
|
||||
|
||||
This enum describes the different modes that are used when the text cursor moves.
|
||||
|
||||
\value MoveAnchor The anchor moves with the cursor to its new location.
|
||||
\value KeepAnchor The anchor remains at the cursor's old location.
|
||||
*/
|
||||
|
||||
/*!
|
||||
Returns true if the specified \a widget is selected; otherwise
|
||||
returns false.
|
||||
*/
|
||||
bool QDesignerFormWindowCursorInterface::isWidgetSelected(QWidget *widget) const
|
||||
{
|
||||
for (int index=0; index<selectedWidgetCount(); ++index) {
|
||||
if (selectedWidget(index) == widget)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn virtual QDesignerFormWindowCursorInterface::~QDesignerFormWindowCursorInterface()
|
||||
|
||||
Destroys the cursor interface.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QDesignerFormWindowInterface *QDesignerFormWindowCursorInterface::formWindow() const
|
||||
|
||||
Returns the form window interface associated with this cursor interface.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual bool QDesignerFormWindowCursorInterface::movePosition(MoveOperation operation, MoveMode mode)
|
||||
|
||||
Performs the given \a operation on the cursor using the specified
|
||||
\a mode, and returns true if it completed successfully; otherwise
|
||||
returns false.
|
||||
|
||||
\sa position(), setPosition()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual int QDesignerFormWindowCursorInterface::position() const
|
||||
|
||||
Returns the cursor position.
|
||||
|
||||
\sa setPosition(), movePosition()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowCursorInterface::setPosition(int position, MoveMode mode = MoveAnchor)
|
||||
|
||||
Sets the position of the cursor to the given \a position using the
|
||||
\a mode to specify how it is moved there.
|
||||
|
||||
\sa position(), movePosition()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QWidget *QDesignerFormWindowCursorInterface::current() const
|
||||
|
||||
Returns the currently selected widget in the form window.
|
||||
|
||||
\sa selectedWidget()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual int QDesignerFormWindowCursorInterface::widgetCount() const
|
||||
|
||||
Returns the number of widgets in the form window.
|
||||
|
||||
\sa selectedWidgetCount()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QWidget *QDesignerFormWindowCursorInterface::widget(int index) const
|
||||
|
||||
Returns the widget with the given \a index in the list of widgets
|
||||
in the form window.
|
||||
|
||||
\sa selectedWidget()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual bool QDesignerFormWindowCursorInterface::hasSelection() const
|
||||
|
||||
Returns true if the form window contains a selection; otherwise
|
||||
returns false.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual int QDesignerFormWindowCursorInterface::selectedWidgetCount() const
|
||||
|
||||
Returns the number of selected widgets in the form window.
|
||||
|
||||
\sa widgetCount()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QWidget *QDesignerFormWindowCursorInterface::selectedWidget(int index) const
|
||||
|
||||
Returns the widget with the given \a index in the list of selected
|
||||
widgets.
|
||||
|
||||
\sa current(), widget()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowCursorInterface::setProperty(const QString &name, const QVariant &value)
|
||||
|
||||
Sets the property with the given \a name for the currently
|
||||
selected widget to the specified \a value.
|
||||
|
||||
\sa setWidgetProperty(), resetWidgetProperty()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowCursorInterface::setWidgetProperty(QWidget *widget, const QString &name, const QVariant &value)
|
||||
|
||||
Sets the property with the given \a name for the given \a widget
|
||||
to the specified \a value.
|
||||
|
||||
\sa resetWidgetProperty(), setProperty()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowCursorInterface::resetWidgetProperty(QWidget *widget, const QString &name)
|
||||
|
||||
Resets the property with the given \a name for the specified \a
|
||||
widget to its default value.
|
||||
|
||||
\sa setProperty(), setWidgetProperty()
|
||||
*/
|
||||
|
||||
QT_END_NAMESPACE
|
||||
109
third/designer/lib/sdk/abstractformwindowcursor.h
Normal file
@@ -0,0 +1,109 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef ABSTRACTFORMWINDOWCURSOR_H
|
||||
#define ABSTRACTFORMWINDOWCURSOR_H
|
||||
|
||||
#include <QtDesigner/sdk_global.h>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QDesignerFormWindowInterface;
|
||||
class QWidget;
|
||||
class QVariant;
|
||||
class QString;
|
||||
|
||||
class QDESIGNER_SDK_EXPORT QDesignerFormWindowCursorInterface
|
||||
{
|
||||
public:
|
||||
enum MoveOperation
|
||||
{
|
||||
NoMove,
|
||||
|
||||
Start,
|
||||
End,
|
||||
Next,
|
||||
Prev,
|
||||
Left,
|
||||
Right,
|
||||
Up,
|
||||
Down
|
||||
};
|
||||
|
||||
enum MoveMode
|
||||
{
|
||||
MoveAnchor,
|
||||
KeepAnchor
|
||||
};
|
||||
|
||||
public:
|
||||
virtual ~QDesignerFormWindowCursorInterface() {}
|
||||
|
||||
virtual QDesignerFormWindowInterface *formWindow() const = 0;
|
||||
|
||||
virtual bool movePosition(MoveOperation op, MoveMode mode = MoveAnchor) = 0;
|
||||
|
||||
virtual int position() const = 0;
|
||||
virtual void setPosition(int pos, MoveMode mode = MoveAnchor) = 0;
|
||||
|
||||
virtual QWidget *current() const = 0;
|
||||
|
||||
virtual int widgetCount() const = 0;
|
||||
virtual QWidget *widget(int index) const = 0;
|
||||
|
||||
virtual bool hasSelection() const = 0;
|
||||
virtual int selectedWidgetCount() const = 0;
|
||||
virtual QWidget *selectedWidget(int index) const = 0;
|
||||
|
||||
virtual void setProperty(const QString &name, const QVariant &value) = 0;
|
||||
virtual void setWidgetProperty(QWidget *widget, const QString &name, const QVariant &value) = 0;
|
||||
virtual void resetWidgetProperty(QWidget *widget, const QString &name) = 0;
|
||||
|
||||
bool isWidgetSelected(QWidget *widget) const;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // ABSTRACTFORMWINDOWCURSOR_H
|
||||
502
third/designer/lib/sdk/abstractformwindowmanager.cpp
Normal file
@@ -0,0 +1,502 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "abstractformwindowmanager.h"
|
||||
|
||||
#include <QtCore/QMap>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*!
|
||||
\class QDesignerFormWindowManagerInterface
|
||||
|
||||
\brief The QDesignerFormWindowManagerInterface class allows you to
|
||||
manipulate the collection of form windows in Qt Designer, and
|
||||
control Qt Designer's form editing actions.
|
||||
|
||||
\inmodule QtDesigner
|
||||
|
||||
QDesignerFormWindowManagerInterface is not intended to be
|
||||
instantiated directly. \QD uses the form window manager to
|
||||
control the various form windows in its workspace. You can
|
||||
retrieve an interface to \QD's form window manager using
|
||||
the QDesignerFormEditorInterface::formWindowManager()
|
||||
function. For example:
|
||||
|
||||
\snippet doc/src/snippets/code/tools_designer_src_lib_sdk_abstractformwindowmanager.cpp 0
|
||||
|
||||
When implementing a custom widget plugin, a pointer to \QD's
|
||||
current QDesignerFormEditorInterface object (\c formEditor in the
|
||||
example above) is provided by the
|
||||
QDesignerCustomWidgetInterface::initialize() function's parameter.
|
||||
You must subclass the QDesignerCustomWidgetInterface to expose
|
||||
your plugin to Qt Designer.
|
||||
|
||||
The form window manager interface provides the createFormWindow()
|
||||
function that enables you to create a new form window which you
|
||||
can add to the collection of form windows that the manager
|
||||
maintains, using the addFormWindow() slot. It also provides the
|
||||
formWindowCount() function returning the number of form windows
|
||||
currently under the manager's control, the formWindow() function
|
||||
returning the form window associated with a given index, and the
|
||||
activeFormWindow() function returning the currently selected form
|
||||
window. The removeFormWindow() slot allows you to reduce the
|
||||
number of form windows the manager must maintain, and the
|
||||
setActiveFormWindow() slot allows you to change the form window
|
||||
focus in \QD's workspace.
|
||||
|
||||
In addition, QDesignerFormWindowManagerInterface contains a
|
||||
collection of functions that enables you to intervene and control
|
||||
\QD's form editing actions. All these functions return the
|
||||
original action, making it possible to propagate the function
|
||||
further after intervention.
|
||||
|
||||
Finally, the interface provides three signals which are emitted
|
||||
when a form window is added, when the currently selected form
|
||||
window changes, or when a form window is removed, respectively. All
|
||||
the signals carry the form window in question as their parameter.
|
||||
|
||||
\sa QDesignerFormEditorInterface, QDesignerFormWindowInterface
|
||||
*/
|
||||
|
||||
// ------------- QDesignerFormWindowManagerInterfacePrivate
|
||||
|
||||
struct QDesignerFormWindowManagerInterfacePrivate {
|
||||
QDesignerFormWindowManagerInterfacePrivate();
|
||||
QAction *m_simplifyLayoutAction;
|
||||
QAction *m_formLayoutAction;
|
||||
};
|
||||
|
||||
QDesignerFormWindowManagerInterfacePrivate::QDesignerFormWindowManagerInterfacePrivate() :
|
||||
m_simplifyLayoutAction(0),
|
||||
m_formLayoutAction(0)
|
||||
{
|
||||
}
|
||||
|
||||
typedef QMap<const QDesignerFormWindowManagerInterface *, QDesignerFormWindowManagerInterfacePrivate *> FormWindowManagerPrivateMap;
|
||||
|
||||
Q_GLOBAL_STATIC(FormWindowManagerPrivateMap, g_FormWindowManagerPrivateMap)
|
||||
|
||||
/*!
|
||||
Constructs an interface with the given \a parent for the form window
|
||||
manager.
|
||||
*/
|
||||
QDesignerFormWindowManagerInterface::QDesignerFormWindowManagerInterface(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
g_FormWindowManagerPrivateMap()->insert(this, new QDesignerFormWindowManagerInterfacePrivate);
|
||||
}
|
||||
|
||||
/*!
|
||||
Destroys the interface for the form window manager.
|
||||
*/
|
||||
QDesignerFormWindowManagerInterface::~QDesignerFormWindowManagerInterface()
|
||||
{
|
||||
FormWindowManagerPrivateMap *fwmpm = g_FormWindowManagerPrivateMap();
|
||||
const FormWindowManagerPrivateMap::iterator it = fwmpm->find(this);
|
||||
Q_ASSERT(it != fwmpm->end());
|
||||
delete it.value();
|
||||
fwmpm->erase(it);
|
||||
}
|
||||
|
||||
/*!
|
||||
Allows you to intervene and control \QD's "cut" action. The function
|
||||
returns the original action.
|
||||
|
||||
\sa QAction
|
||||
*/
|
||||
QAction *QDesignerFormWindowManagerInterface::actionCut() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
Allows you to intervene and control \QD's "copy" action. The
|
||||
function returns the original action.
|
||||
|
||||
\sa QAction
|
||||
*/
|
||||
QAction *QDesignerFormWindowManagerInterface::actionCopy() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
Allows you to intervene and control \QD's "paste" action. The
|
||||
function returns the original action.
|
||||
|
||||
\sa QAction
|
||||
*/
|
||||
QAction *QDesignerFormWindowManagerInterface::actionPaste() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
Allows you to intervene and control \QD's "delete" action. The function
|
||||
returns the original action.
|
||||
|
||||
\sa QAction
|
||||
*/
|
||||
QAction *QDesignerFormWindowManagerInterface::actionDelete() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
Allows you to intervene and control \QD's "select all" action. The
|
||||
function returns the original action.
|
||||
|
||||
\sa QAction
|
||||
*/
|
||||
QAction *QDesignerFormWindowManagerInterface::actionSelectAll() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
Allows you to intervene and control the action of lowering a form
|
||||
window in \QD's workspace. The function returns the original
|
||||
action.
|
||||
|
||||
\sa QAction
|
||||
*/
|
||||
QAction *QDesignerFormWindowManagerInterface::actionLower() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
Allows you to intervene and control the action of raising of a
|
||||
form window in \QD's workspace. The function returns the original
|
||||
action.
|
||||
|
||||
\sa QAction
|
||||
*/
|
||||
QAction *QDesignerFormWindowManagerInterface::actionRaise() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
Allows you to intervene and control a request for horizontal
|
||||
layout for a form window in \QD's workspace. The function returns
|
||||
the original action.
|
||||
|
||||
\sa QAction
|
||||
*/
|
||||
QAction *QDesignerFormWindowManagerInterface::actionHorizontalLayout() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
Allows you to intervene and control a request for vertical layout
|
||||
for a form window in \QD's workspace. The function returns the
|
||||
original action.
|
||||
|
||||
\sa QAction
|
||||
*/
|
||||
QAction *QDesignerFormWindowManagerInterface::actionVerticalLayout() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
Allows you to intervene and control \QD's "split horizontal"
|
||||
action. The function returns the original action.
|
||||
|
||||
\sa QAction
|
||||
*/
|
||||
QAction *QDesignerFormWindowManagerInterface::actionSplitHorizontal() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
Allows you to intervene and control \QD's "split vertical"
|
||||
action. The function returns the original action.
|
||||
|
||||
\sa QAction
|
||||
*/
|
||||
QAction *QDesignerFormWindowManagerInterface::actionSplitVertical() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
Allows you to intervene and control a request for grid layout for
|
||||
a form window in \QD's workspace. The function returns the
|
||||
original action.
|
||||
|
||||
\sa QAction
|
||||
*/
|
||||
QAction *QDesignerFormWindowManagerInterface::actionGridLayout() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
Allows you to intervene and control \QD's "form layout" action. The
|
||||
function returns the original action.
|
||||
|
||||
FormWindowManagerPrivateMap *fwmpm = g_FormWindowManagerPrivateMap(); \sa QAction
|
||||
\since 4.4
|
||||
*/
|
||||
|
||||
QAction *QDesignerFormWindowManagerInterface::actionFormLayout() const
|
||||
{
|
||||
const QDesignerFormWindowManagerInterfacePrivate *d = g_FormWindowManagerPrivateMap()->value(this);
|
||||
Q_ASSERT(d);
|
||||
return d->m_formLayoutAction;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the "form layout" action to \a action.
|
||||
|
||||
\internal
|
||||
\since 4.4
|
||||
*/
|
||||
|
||||
void QDesignerFormWindowManagerInterface::setActionFormLayout(QAction *action)
|
||||
{
|
||||
QDesignerFormWindowManagerInterfacePrivate *d = g_FormWindowManagerPrivateMap()->value(this);
|
||||
Q_ASSERT(d);
|
||||
d->m_formLayoutAction = action;
|
||||
}
|
||||
|
||||
/*!
|
||||
Allows you to intervene and control \QD's "break layout" action. The
|
||||
function returns the original action.
|
||||
|
||||
\sa QAction
|
||||
*/
|
||||
QAction *QDesignerFormWindowManagerInterface::actionBreakLayout() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
Allows you to intervene and control \QD's "adjust size" action. The
|
||||
function returns the original action.
|
||||
|
||||
\sa QAction
|
||||
*/
|
||||
QAction *QDesignerFormWindowManagerInterface::actionAdjustSize() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
Allows you to intervene and control \QD's "simplify layout" action. The
|
||||
function returns the original action.
|
||||
|
||||
\sa QAction
|
||||
\since 4.4
|
||||
*/
|
||||
|
||||
QAction *QDesignerFormWindowManagerInterface::actionSimplifyLayout() const
|
||||
{
|
||||
const QDesignerFormWindowManagerInterfacePrivate *d = g_FormWindowManagerPrivateMap()->value(this);
|
||||
Q_ASSERT(d);
|
||||
return d->m_simplifyLayoutAction;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the "simplify layout" action to \a action.
|
||||
|
||||
\internal
|
||||
\since 4.4
|
||||
*/
|
||||
|
||||
void QDesignerFormWindowManagerInterface::setActionSimplifyLayout(QAction *action)
|
||||
{
|
||||
QDesignerFormWindowManagerInterfacePrivate *d = g_FormWindowManagerPrivateMap()->value(this);
|
||||
Q_ASSERT(d);
|
||||
d->m_simplifyLayoutAction = action;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the currently active form window in \QD's workspace.
|
||||
|
||||
\sa setActiveFormWindow(), removeFormWindow()
|
||||
*/
|
||||
QDesignerFormWindowInterface *QDesignerFormWindowManagerInterface::activeFormWindow() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns a pointer to \QD's current QDesignerFormEditorInterface
|
||||
object.
|
||||
*/
|
||||
QDesignerFormEditorInterface *QDesignerFormWindowManagerInterface::core() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
Adds the given \a formWindow to the collection of windows that
|
||||
\QD's form window manager maintains.
|
||||
|
||||
\sa formWindowAdded()
|
||||
*/
|
||||
void QDesignerFormWindowManagerInterface::addFormWindow(QDesignerFormWindowInterface *formWindow)
|
||||
{
|
||||
Q_UNUSED(formWindow);
|
||||
}
|
||||
|
||||
/*!
|
||||
Removes the given \a formWindow from the collection of windows that
|
||||
\QD's form window manager maintains.
|
||||
|
||||
\sa formWindow(), formWindowRemoved()
|
||||
*/
|
||||
void QDesignerFormWindowManagerInterface::removeFormWindow(QDesignerFormWindowInterface *formWindow)
|
||||
{
|
||||
Q_UNUSED(formWindow);
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the given \a formWindow to be the currently active form window in
|
||||
\QD's workspace.
|
||||
|
||||
\sa activeFormWindow(), activeFormWindowChanged()
|
||||
*/
|
||||
void QDesignerFormWindowManagerInterface::setActiveFormWindow(QDesignerFormWindowInterface *formWindow)
|
||||
{
|
||||
Q_UNUSED(formWindow);
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the number of form windows maintained by \QD's form window
|
||||
manager.
|
||||
*/
|
||||
int QDesignerFormWindowManagerInterface::formWindowCount() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the form window at the given \a index.
|
||||
|
||||
\sa setActiveFormWindow(), removeFormWindow()
|
||||
*/
|
||||
QDesignerFormWindowInterface *QDesignerFormWindowManagerInterface::formWindow(int index) const
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn QDesignerFormWindowInterface *QDesignerFormWindowManagerInterface::createFormWindow(QWidget *parent, Qt::WindowFlags flags)
|
||||
|
||||
Creates a form window with the given \a parent and the given window
|
||||
\a flags.
|
||||
|
||||
\sa addFormWindow()
|
||||
*/
|
||||
QDesignerFormWindowInterface *QDesignerFormWindowManagerInterface::createFormWindow(QWidget *parentWidget, Qt::WindowFlags flags)
|
||||
{
|
||||
Q_UNUSED(parentWidget);
|
||||
Q_UNUSED(flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
Allows you to intervene and control \QD's "undo" action. The
|
||||
function returns the original action.
|
||||
|
||||
\sa QAction
|
||||
*/
|
||||
QAction *QDesignerFormWindowManagerInterface::actionUndo() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
Allows you to intervene and control \QD's "redo" action. The
|
||||
function returns the original action.
|
||||
|
||||
\sa QAction
|
||||
*/
|
||||
QAction *QDesignerFormWindowManagerInterface::actionRedo() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn void QDesignerFormWindowManagerInterface::formWindowAdded(QDesignerFormWindowInterface *formWindow)
|
||||
|
||||
This signal is emitted when a new form window is added to the
|
||||
collection of windows that \QD's form window manager maintains. A
|
||||
pointer to the new \a formWindow is passed as an argument.
|
||||
|
||||
\sa addFormWindow(), setActiveFormWindow()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerFormWindowManagerInterface::formWindowRemoved(QDesignerFormWindowInterface *formWindow)
|
||||
|
||||
This signal is emitted when a form window is removed from the
|
||||
collection of windows that \QD's form window manager maintains. A
|
||||
pointer to the removed \a formWindow is passed as an argument.
|
||||
|
||||
\sa removeFormWindow()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerFormWindowManagerInterface::activeFormWindowChanged(QDesignerFormWindowInterface *formWindow)
|
||||
|
||||
This signal is emitted when the contents of the currently active
|
||||
form window in \QD's workspace changed. A pointer to the currently
|
||||
active \a formWindow is passed as an argument.
|
||||
|
||||
\sa activeFormWindow()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerFormWindowManagerInterface::dragItems(const QList<QDesignerDnDItemInterface*> &item_list)
|
||||
|
||||
\internal
|
||||
*/
|
||||
|
||||
QT_END_NAMESPACE
|
||||
122
third/designer/lib/sdk/abstractformwindowmanager.h
Normal file
@@ -0,0 +1,122 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef ABSTRACTFORMWINDOWMANAGER_H
|
||||
#define ABSTRACTFORMWINDOWMANAGER_H
|
||||
|
||||
#include <QtDesigner/sdk_global.h>
|
||||
#include <QtDesigner/abstractformwindow.h>
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QAction;
|
||||
class QActionGroup;
|
||||
class QDesignerFormEditorInterface;
|
||||
class DomUI;
|
||||
class QWidget;
|
||||
class QDesignerDnDItemInterface;
|
||||
|
||||
class QDESIGNER_SDK_EXPORT QDesignerFormWindowManagerInterface: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QDesignerFormWindowManagerInterface(QObject *parent = 0);
|
||||
virtual ~QDesignerFormWindowManagerInterface();
|
||||
|
||||
virtual QAction *actionCut() const;
|
||||
virtual QAction *actionCopy() const;
|
||||
virtual QAction *actionPaste() const;
|
||||
virtual QAction *actionDelete() const;
|
||||
virtual QAction *actionSelectAll() const;
|
||||
virtual QAction *actionLower() const;
|
||||
virtual QAction *actionRaise() const;
|
||||
virtual QAction *actionUndo() const;
|
||||
virtual QAction *actionRedo() const;
|
||||
|
||||
virtual QAction *actionHorizontalLayout() const;
|
||||
virtual QAction *actionVerticalLayout() const;
|
||||
virtual QAction *actionSplitHorizontal() const;
|
||||
virtual QAction *actionSplitVertical() const;
|
||||
virtual QAction *actionGridLayout() const;
|
||||
QAction *actionFormLayout() const;
|
||||
virtual QAction *actionBreakLayout() const;
|
||||
virtual QAction *actionAdjustSize() const;
|
||||
QAction *actionSimplifyLayout() const;
|
||||
|
||||
virtual QDesignerFormWindowInterface *activeFormWindow() const;
|
||||
|
||||
virtual int formWindowCount() const;
|
||||
virtual QDesignerFormWindowInterface *formWindow(int index) const;
|
||||
|
||||
virtual QDesignerFormWindowInterface *createFormWindow(QWidget *parentWidget = 0, Qt::WindowFlags flags = 0);
|
||||
|
||||
virtual QDesignerFormEditorInterface *core() const;
|
||||
|
||||
virtual void dragItems(const QList<QDesignerDnDItemInterface*> &item_list) = 0;
|
||||
|
||||
Q_SIGNALS:
|
||||
void formWindowAdded(QDesignerFormWindowInterface *formWindow);
|
||||
void formWindowRemoved(QDesignerFormWindowInterface *formWindow);
|
||||
void activeFormWindowChanged(QDesignerFormWindowInterface *formWindow);
|
||||
|
||||
public Q_SLOTS:
|
||||
virtual void addFormWindow(QDesignerFormWindowInterface *formWindow);
|
||||
virtual void removeFormWindow(QDesignerFormWindowInterface *formWindow);
|
||||
virtual void setActiveFormWindow(QDesignerFormWindowInterface *formWindow);
|
||||
|
||||
protected:
|
||||
void setActionFormLayout(QAction *action);
|
||||
void setActionSimplifyLayout(QAction *action);
|
||||
|
||||
private:
|
||||
QDesignerFormWindowManagerInterface(const QDesignerFormWindowManagerInterface &other);
|
||||
QDesignerFormWindowManagerInterface &operator = (const QDesignerFormWindowManagerInterface &other);
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // ABSTRACTFORMWINDOWMANAGER_H
|
||||
106
third/designer/lib/sdk/abstractformwindowtool.cpp
Normal file
@@ -0,0 +1,106 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "abstractformwindowtool.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*!
|
||||
\class QDesignerFormWindowToolInterface
|
||||
|
||||
\brief The QDesignerFormWindowToolInterface class provides an
|
||||
interface that enables tools to be used on items in a form window.
|
||||
|
||||
\inmodule QtDesigner
|
||||
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
*/
|
||||
QDesignerFormWindowToolInterface::QDesignerFormWindowToolInterface(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
*/
|
||||
QDesignerFormWindowToolInterface::~QDesignerFormWindowToolInterface()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn virtual QDesignerFormEditorInterface *QDesignerFormWindowToolInterface::core() const = 0
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QDesignerFormWindowInterface *QDesignerFormWindowToolInterface::formWindow() const = 0
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QWidget *QDesignerFormWindowToolInterface::editor() const = 0
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QAction *QDesignerFormWindowToolInterface::action() const = 0
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowToolInterface::activated() = 0
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowToolInterface::deactivated() = 0
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowToolInterface::saveToDom(DomUI*, QWidget*) {
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerFormWindowToolInterface::loadFromDom(DomUI*, QWidget*) {
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual bool QDesignerFormWindowToolInterface::handleEvent(QWidget *widget, QWidget *managedWidget, QEvent *event) = 0
|
||||
*/
|
||||
|
||||
QT_END_NAMESPACE
|
||||
85
third/designer/lib/sdk/abstractformwindowtool.h
Normal file
@@ -0,0 +1,85 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef ABSTRACTFORMWINDOWTOOL_H
|
||||
#define ABSTRACTFORMWINDOWTOOL_H
|
||||
|
||||
#include <QtDesigner/sdk_global.h>
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QDesignerFormEditorInterface;
|
||||
class QDesignerFormWindowInterface;
|
||||
class QWidget;
|
||||
class QAction;
|
||||
class DomUI;
|
||||
|
||||
class QDESIGNER_SDK_EXPORT QDesignerFormWindowToolInterface: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QDesignerFormWindowToolInterface(QObject *parent = 0);
|
||||
virtual ~QDesignerFormWindowToolInterface();
|
||||
|
||||
virtual QDesignerFormEditorInterface *core() const = 0;
|
||||
virtual QDesignerFormWindowInterface *formWindow() const = 0;
|
||||
virtual QWidget *editor() const = 0;
|
||||
|
||||
virtual QAction *action() const = 0;
|
||||
|
||||
virtual void activated() = 0;
|
||||
virtual void deactivated() = 0;
|
||||
|
||||
virtual void saveToDom(DomUI*, QWidget*) {}
|
||||
virtual void loadFromDom(DomUI*, QWidget*) {}
|
||||
|
||||
virtual bool handleEvent(QWidget *widget, QWidget *managedWidget, QEvent *event) = 0;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // ABSTRACTFORMWINDOWTOOL_H
|
||||
83
third/designer/lib/sdk/abstracticoncache.h
Normal file
@@ -0,0 +1,83 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef ABSTRACTICONCACHE_H
|
||||
#define ABSTRACTICONCACHE_H
|
||||
|
||||
#include <QtDesigner/sdk_global.h>
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QIcon;
|
||||
class QPixmap;
|
||||
class QString;
|
||||
|
||||
class QDESIGNER_SDK_EXPORT QDesignerIconCacheInterface : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QDesignerIconCacheInterface(QObject *parent_)
|
||||
: QObject(parent_) {}
|
||||
|
||||
virtual QIcon nameToIcon(const QString &filePath, const QString &qrcPath = QString()) = 0;
|
||||
virtual QPixmap nameToPixmap(const QString &filePath, const QString &qrcPath = QString()) = 0;
|
||||
|
||||
virtual QString iconToFilePath(const QIcon &pm) const = 0;
|
||||
virtual QString iconToQrcPath(const QIcon &pm) const = 0;
|
||||
|
||||
virtual QString pixmapToFilePath(const QPixmap &pm) const = 0;
|
||||
virtual QString pixmapToQrcPath(const QPixmap &pm) const = 0;
|
||||
|
||||
virtual QList<QPixmap> pixmapList() const = 0;
|
||||
virtual QList<QIcon> iconList() const = 0;
|
||||
|
||||
virtual QString resolveQrcPath(const QString &filePath, const QString &qrcPath, const QString &workingDirectory = QString()) const = 0;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // ABSTRACTICONCACHE_H
|
||||
116
third/designer/lib/sdk/abstracticoncache.qdoc
Normal file
@@ -0,0 +1,116 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the documentation of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:FDL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in a
|
||||
** written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Free Documentation License
|
||||
** Alternatively, this file may be used under the terms of the GNU Free
|
||||
** Documentation License version 1.3 as published by the Free Software
|
||||
** Foundation and appearing in the file included in the packaging of this
|
||||
** file.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
/*!
|
||||
\class QDesignerIconCacheInterface
|
||||
\brief The QDesignerIconCacheInterface class provides an interface to \QD's icon cache.
|
||||
\inmodule QtDesigner
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QDesignerIconCacheInterface::QDesignerIconCacheInterface(QObject *parent)
|
||||
|
||||
Constructs a new interface with the given \a parent.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QIcon QDesignerIconCacheInterface::nameToIcon(const QString &filePath, const QString &qrcPath)
|
||||
|
||||
Returns the icon associated with the name specified by \a filePath in the resource
|
||||
file specified by \a qrcPath.
|
||||
|
||||
If \a qrcPath refers to a valid resource file, the name used for the file path is a path
|
||||
within those resources; otherwise the file path refers to a local file.
|
||||
|
||||
\sa {The Qt Resource System}, nameToPixmap()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QPixmap QDesignerIconCacheInterface::nameToPixmap(const QString &filePath, const QString &qrcPath)
|
||||
|
||||
Returns the pixmap associated with the name specified by \a filePath in the resource
|
||||
file specified by \a qrcPath.
|
||||
|
||||
If \a qrcPath refers to a valid resource file, the name used for the file path is a path
|
||||
within those resources; otherwise the file path refers to a local file.
|
||||
|
||||
\sa {The Qt Resource System}, nameToIcon()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerIconCacheInterface::iconToFilePath(const QIcon &icon) const
|
||||
|
||||
Returns the file path associated with the given \a icon. The file path is a path within
|
||||
an application resources.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerIconCacheInterface::iconToQrcPath(const QIcon &icon) const
|
||||
|
||||
Returns the path to the resource file that refers to the specified \a icon. The resource
|
||||
path refers to a local file.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerIconCacheInterface::pixmapToFilePath(const QPixmap &pixmap) const
|
||||
|
||||
Returns the file path associated with the given \a pixmap. The file path is a path within
|
||||
an application resources.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerIconCacheInterface::pixmapToQrcPath(const QPixmap &pixmap) const
|
||||
|
||||
Returns the path to the resource file that refers to the specified \a pixmap. The resource
|
||||
path refers to a local file.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QList<QPixmap> QDesignerIconCacheInterface::pixmapList() const
|
||||
|
||||
Returns a list of pixmaps for the icons provided by the icon cache.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QList<QIcon> QDesignerIconCacheInterface::iconList() const
|
||||
|
||||
Returns a list of icons provided by the icon cache.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerIconCacheInterface::resolveQrcPath(const QString &filePath, const QString &qrcPath, const QString &workingDirectory) const
|
||||
|
||||
Returns a path to a resource specified by the \a filePath within
|
||||
the resource file located at \a qrcPath. If \a workingDirectory is
|
||||
a valid path to a directory, the path returned will be relative to
|
||||
that directory; otherwise an absolute path is returned.
|
||||
|
||||
\omit
|
||||
### Needs checking
|
||||
\endomit
|
||||
*/
|
||||
54
third/designer/lib/sdk/abstractintegration.cpp
Normal file
@@ -0,0 +1,54 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "abstractintegration.h"
|
||||
#include "abstractformeditor.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QDesignerIntegrationInterface::QDesignerIntegrationInterface(QDesignerFormEditorInterface *core, QObject *parent)
|
||||
: QObject(parent),
|
||||
m_core(core)
|
||||
{
|
||||
core->setIntegration(this);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
76
third/designer/lib/sdk/abstractintegration.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef ABSTRACTINTEGRATION_H
|
||||
#define ABSTRACTINTEGRATION_H
|
||||
|
||||
#include <QtDesigner/sdk_global.h>
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QDesignerFormEditorInterface;
|
||||
|
||||
class QDESIGNER_SDK_EXPORT QDesignerIntegrationInterface: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QDesignerIntegrationInterface(QDesignerFormEditorInterface *core, QObject *parent = 0);
|
||||
|
||||
inline QDesignerFormEditorInterface *core() const;
|
||||
|
||||
virtual QWidget *containerWindow(QWidget *widget) const = 0;
|
||||
|
||||
private:
|
||||
QDesignerFormEditorInterface *m_core;
|
||||
};
|
||||
|
||||
inline QDesignerFormEditorInterface *QDesignerIntegrationInterface::core() const
|
||||
{ return m_core; }
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // ABSTRACTINTEGRATION_H
|
||||
548
third/designer/lib/sdk/abstractintrospection.cpp
Normal file
@@ -0,0 +1,548 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "abstractintrospection_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*!
|
||||
\class QDesignerMetaEnumInterface
|
||||
\internal
|
||||
\since 4.4
|
||||
|
||||
\brief QDesignerMetaEnumInterface is part of \QD's introspection interface and represents an enumeration.
|
||||
|
||||
\inmodule QtDesigner
|
||||
|
||||
The QDesignerMetaEnumInterface class provides meta-data about an enumerator.
|
||||
|
||||
\sa QDesignerMetaObjectInterface
|
||||
*/
|
||||
|
||||
/*!
|
||||
Constructs a QDesignerMetaEnumInterface object.
|
||||
*/
|
||||
|
||||
QDesignerMetaEnumInterface::QDesignerMetaEnumInterface()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Destroys the QDesignerMetaEnumInterface object.
|
||||
*/
|
||||
QDesignerMetaEnumInterface::~QDesignerMetaEnumInterface()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn bool QDesignerMetaEnumInterface::isFlag() const
|
||||
|
||||
Returns true if this enumerator is used as a flag.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerMetaEnumInterface::key(int index) const
|
||||
|
||||
Returns the key with the given \a index.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int QDesignerMetaEnumInterface::keyCount() const
|
||||
|
||||
Returns the number of keys.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int QDesignerMetaEnumInterface::keyToValue(const QString &key) const
|
||||
|
||||
Returns the integer value of the given enumeration \a key, or -1 if \a key is not defined.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int QDesignerMetaEnumInterface::keysToValue(const QString &keys) const
|
||||
|
||||
Returns the value derived from combining together the values of the \a keys using the OR operator, or -1 if keys is not defined. Note that the strings in \a keys must be '|'-separated.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerMetaEnumInterface::name() const
|
||||
|
||||
Returns the name of the enumerator (without the scope).
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerMetaEnumInterface::scope() const
|
||||
|
||||
Returns the scope this enumerator was declared in.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerMetaEnumInterface::separator() const
|
||||
|
||||
Returns the separator to be used when building enumeration names.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int QDesignerMetaEnumInterface::value(int index) const
|
||||
|
||||
Returns the value with the given \a index; or returns -1 if there is no such value.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerMetaEnumInterface::valueToKey(int value) const
|
||||
|
||||
Returns the string that is used as the name of the given enumeration \a value, or QString::null if value is not defined.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerMetaEnumInterface::valueToKeys(int value) const
|
||||
|
||||
Returns a byte array of '|'-separated keys that represents the given \a value.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\class QDesignerMetaPropertyInterface
|
||||
\internal
|
||||
\since 4.4
|
||||
|
||||
\brief QDesignerMetaPropertyInterface is part of \QD's introspection interface and represents a property.
|
||||
|
||||
\inmodule QtDesigner
|
||||
|
||||
The QDesignerMetaPropertyInterface class provides meta-data about a property.
|
||||
|
||||
\sa QDesignerMetaObjectInterface
|
||||
*/
|
||||
|
||||
/*!
|
||||
Constructs a QDesignerMetaPropertyInterface object.
|
||||
*/
|
||||
|
||||
QDesignerMetaPropertyInterface::QDesignerMetaPropertyInterface()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Destroys the QDesignerMetaPropertyInterface object.
|
||||
*/
|
||||
|
||||
QDesignerMetaPropertyInterface::~QDesignerMetaPropertyInterface()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\enum QDesignerMetaPropertyInterface::Kind
|
||||
|
||||
This enum indicates whether the property is of a special type.
|
||||
|
||||
\value EnumKind The property is of an enumeration type
|
||||
\value FlagKind The property is of an flag type
|
||||
\value OtherKind The property is of another type
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum QDesignerMetaPropertyInterface::AccessFlag
|
||||
|
||||
These flags specify the access the property provides.
|
||||
|
||||
\value ReadAccess Property can be read
|
||||
\value WriteAccess Property can be written
|
||||
\value ResetAccess Property can be reset to a default value
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum QDesignerMetaPropertyInterface::Attribute
|
||||
|
||||
Various attributes of the property.
|
||||
|
||||
\value DesignableAttribute Property is designable (visible in \QD)
|
||||
\value ScriptableAttribute Property is scriptable
|
||||
\value StoredAttribute Property is stored, that is, not calculated
|
||||
\value UserAttribute Property is the property that the user can edit for the QObject
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn const QDesignerMetaEnumInterface *QDesignerMetaPropertyInterface::enumerator() const
|
||||
|
||||
Returns the enumerator if this property's type is an enumerator type;
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn Kind QDesignerMetaPropertyInterface::kind() const
|
||||
|
||||
Returns the type of the property.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn AccessFlags QDesignerMetaPropertyInterface::accessFlags() const
|
||||
|
||||
Returns a combination of access flags.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn Attributes QDesignerMetaPropertyInterface::attributes(const QObject *object) const
|
||||
|
||||
Returns the attributes of the property for the gives \a object.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QVariant::Type QDesignerMetaPropertyInterface::type() const
|
||||
|
||||
Returns the type of the property.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerMetaPropertyInterface::name() const
|
||||
|
||||
Returns the name of the property.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerMetaPropertyInterface::typeName() const
|
||||
|
||||
Returns the name of this property's type.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn int QDesignerMetaPropertyInterface::userType() const
|
||||
|
||||
Returns this property's user type.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool QDesignerMetaPropertyInterface::hasSetter() const
|
||||
|
||||
Returns whether getter and setter methods exist for this property.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QVariant QDesignerMetaPropertyInterface::read(const QObject *object) const
|
||||
|
||||
Reads the property's value from the given \a object. Returns the value if it was able to read it; otherwise returns an invalid variant.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool QDesignerMetaPropertyInterface::reset(QObject *object) const
|
||||
|
||||
Resets the property for the given \a object with a reset method. Returns true if the reset worked; otherwise returns false.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool QDesignerMetaPropertyInterface::write(QObject *object, const QVariant &value) const
|
||||
|
||||
Writes \a value as the property's value to the given \a object. Returns true if the write succeeded; otherwise returns false.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\class QDesignerMetaMethodInterface
|
||||
\internal
|
||||
\since 4.4
|
||||
|
||||
\brief QDesignerMetaMethodInterface is part of \QD's introspection interface and represents a member function.
|
||||
|
||||
\inmodule QtDesigner
|
||||
|
||||
The QDesignerMetaMethodInterface class provides meta-data about a member function.
|
||||
|
||||
\sa QDesignerMetaObjectInterface
|
||||
*/
|
||||
|
||||
/*!
|
||||
Constructs a QDesignerMetaMethodInterface object.
|
||||
*/
|
||||
|
||||
QDesignerMetaMethodInterface::QDesignerMetaMethodInterface()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Destroys the QDesignerMetaMethodInterface object.
|
||||
*/
|
||||
|
||||
QDesignerMetaMethodInterface::~QDesignerMetaMethodInterface()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\enum QDesignerMetaMethodInterface::MethodType
|
||||
|
||||
This enum specifies the type of the method
|
||||
|
||||
\value Method The function is a plain member function.
|
||||
\value Signal The function is a signal.
|
||||
\value Slot The function is a slot.
|
||||
\value Constructor The function is a constructor.
|
||||
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum QDesignerMetaMethodInterface::Access
|
||||
|
||||
This enum represents the access specification of the method
|
||||
|
||||
\value Private A private member function
|
||||
\value Protected A protected member function
|
||||
\value Public A public member function
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QDesignerMetaMethodInterface::Access QDesignerMetaMethodInterface::access() const
|
||||
|
||||
Returns the access specification of this method.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn QDesignerMetaMethodInterface::MethodType QDesignerMetaMethodInterface::methodType() const
|
||||
|
||||
Returns the type of this method.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QStringList QDesignerMetaMethodInterface::parameterNames() const
|
||||
|
||||
Returns a list of parameter names.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QStringList QDesignerMetaMethodInterface::parameterTypes() const
|
||||
|
||||
Returns a list of parameter types.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerMetaMethodInterface::signature() const
|
||||
|
||||
Returns the signature of this method.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerMetaMethodInterface::normalizedSignature() const
|
||||
|
||||
Returns the normalized signature of this method (suitable as signal/slot specification).
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerMetaMethodInterface::tag() const
|
||||
|
||||
Returns the tag associated with this method.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerMetaMethodInterface::typeName() const
|
||||
|
||||
Returns the return type of this method, or an empty string if the return type is void.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\class QDesignerMetaObjectInterface
|
||||
\internal
|
||||
\since 4.4
|
||||
|
||||
\brief QDesignerMetaObjectInterface is part of \QD's introspection interface and provides meta-information about Qt objects
|
||||
|
||||
\inmodule QtDesigner
|
||||
|
||||
The QDesignerMetaObjectInterface class provides meta-data about Qt objects. For a given object, it can be obtained
|
||||
by querying QDesignerIntrospectionInterface.
|
||||
|
||||
\sa QDesignerIntrospectionInterface
|
||||
*/
|
||||
|
||||
/*!
|
||||
Constructs a QDesignerMetaObjectInterface object.
|
||||
*/
|
||||
|
||||
QDesignerMetaObjectInterface::QDesignerMetaObjectInterface()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Destroys the QDesignerMetaObjectInterface object.
|
||||
*/
|
||||
|
||||
QDesignerMetaObjectInterface::~QDesignerMetaObjectInterface()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerMetaObjectInterface::className() const
|
||||
|
||||
Returns the class name.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn const QDesignerMetaEnumInterface *QDesignerMetaObjectInterface::enumerator(int index) const
|
||||
|
||||
Returns the meta-data for the enumerator with the given \a index.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int QDesignerMetaObjectInterface::enumeratorCount() const
|
||||
|
||||
Returns the number of enumerators in this class.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int QDesignerMetaObjectInterface::enumeratorOffset() const
|
||||
|
||||
Returns the enumerator offset for this class; i.e. the index position of this class's first enumerator.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int QDesignerMetaObjectInterface::indexOfEnumerator(const QString &name) const
|
||||
|
||||
Finds enumerator \a name and returns its index; otherwise returns -1.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int QDesignerMetaObjectInterface::indexOfMethod(const QString &method) const
|
||||
|
||||
Finds \a method and returns its index; otherwise returns -1.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int QDesignerMetaObjectInterface::indexOfProperty(const QString &name) const
|
||||
|
||||
Finds property \a name and returns its index; otherwise returns -1.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int QDesignerMetaObjectInterface::indexOfSignal(const QString &signal) const
|
||||
|
||||
Finds \a signal and returns its index; otherwise returns -1.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int QDesignerMetaObjectInterface::indexOfSlot(const QString &slot) const
|
||||
|
||||
Finds \a slot and returns its index; otherwise returns -1.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn const QDesignerMetaMethodInterface *QDesignerMetaObjectInterface::method(int index) const
|
||||
|
||||
Returns the meta-data for the method with the given \a index.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int QDesignerMetaObjectInterface::methodCount() const
|
||||
|
||||
Returns the number of methods in this class. These include ordinary methods, signals, and slots.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int QDesignerMetaObjectInterface::methodOffset() const
|
||||
|
||||
Returns the method offset for this class; i.e. the index position of this class's first member function.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn const QDesignerMetaPropertyInterface *QDesignerMetaObjectInterface::property(int index) const
|
||||
|
||||
Returns the meta-data for the property with the given \a index.
|
||||
*/
|
||||
/*!
|
||||
\fn int QDesignerMetaObjectInterface::propertyCount() const
|
||||
|
||||
Returns the number of properties in this class.
|
||||
*/
|
||||
/*!
|
||||
\fn int QDesignerMetaObjectInterface::propertyOffset() const
|
||||
|
||||
Returns the property offset for this class; i.e. the index position of this class's first property.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn const QDesignerMetaObjectInterface *QDesignerMetaObjectInterface::superClass() const
|
||||
|
||||
Returns the meta-object of the superclass, or 0 if there is no such object.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn const QDesignerMetaPropertyInterface *QDesignerMetaObjectInterface::userProperty() const
|
||||
|
||||
Returns the property that has the USER flag set to true.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\class QDesignerIntrospectionInterface
|
||||
\internal
|
||||
\since 4.4
|
||||
|
||||
\brief QDesignerIntrospectionInterface provides access to a QDesignerMetaObjectInterface for a given Qt object.
|
||||
|
||||
\inmodule QtDesigner
|
||||
|
||||
QDesignerIntrospectionInterface is the main class of \QD's introspection interface. These
|
||||
interfaces provide a layer of abstraction around QMetaObject and related classes to allow for the integration
|
||||
of other programming languages.
|
||||
|
||||
An instance of QDesignerIntrospectionInterface can be obtained from the core.
|
||||
|
||||
\sa QDesignerMetaObjectInterface
|
||||
*/
|
||||
|
||||
/*!
|
||||
Constructs a QDesignerIntrospectionInterface object.
|
||||
*/
|
||||
|
||||
QDesignerIntrospectionInterface::QDesignerIntrospectionInterface()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Destroys the QDesignerIntrospectionInterface object.
|
||||
*/
|
||||
|
||||
QDesignerIntrospectionInterface::~QDesignerIntrospectionInterface()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn const QDesignerMetaObjectInterface* QDesignerIntrospectionInterface::metaObject(const QObject *object) const
|
||||
|
||||
Returns the meta object of this \a object.
|
||||
*/
|
||||
|
||||
QT_END_NAMESPACE
|
||||
174
third/designer/lib/sdk/abstractintrospection_p.h
Normal file
@@ -0,0 +1,174 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of Qt Designer. This header
|
||||
// file may change from version to version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#ifndef ABSTRACTMETAOBJECT_H
|
||||
#define ABSTRACTMETAOBJECT_H
|
||||
|
||||
#include <QtDesigner/sdk_global.h>
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtCore/QFlags>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QDESIGNER_SDK_EXPORT QDesignerMetaEnumInterface
|
||||
{
|
||||
public:
|
||||
QDesignerMetaEnumInterface();
|
||||
virtual ~QDesignerMetaEnumInterface();
|
||||
virtual bool isFlag() const = 0;
|
||||
virtual QString key(int index) const = 0;
|
||||
virtual int keyCount() const = 0;
|
||||
virtual int keyToValue(const QString &key) const = 0;
|
||||
virtual int keysToValue(const QString &keys) const = 0;
|
||||
virtual QString name() const = 0;
|
||||
virtual QString scope() const = 0;
|
||||
virtual QString separator() const = 0;
|
||||
virtual int value(int index) const = 0;
|
||||
virtual QString valueToKey(int value) const = 0;
|
||||
virtual QString valueToKeys(int value) const = 0;
|
||||
};
|
||||
|
||||
class QDESIGNER_SDK_EXPORT QDesignerMetaPropertyInterface
|
||||
{
|
||||
public:
|
||||
enum Kind { EnumKind, FlagKind, OtherKind };
|
||||
enum AccessFlag { ReadAccess = 0x0001, WriteAccess = 0x0002, ResetAccess = 0x0004 };
|
||||
enum Attribute { DesignableAttribute = 0x0001, ScriptableAttribute = 0x0002, StoredAttribute = 0x0004, UserAttribute = 0x0008};
|
||||
Q_DECLARE_FLAGS(Attributes, Attribute)
|
||||
Q_DECLARE_FLAGS(AccessFlags, AccessFlag)
|
||||
|
||||
QDesignerMetaPropertyInterface();
|
||||
virtual ~QDesignerMetaPropertyInterface();
|
||||
|
||||
virtual const QDesignerMetaEnumInterface *enumerator() const = 0;
|
||||
|
||||
virtual Kind kind() const = 0;
|
||||
virtual AccessFlags accessFlags() const = 0;
|
||||
virtual Attributes attributes(const QObject *object = 0) const = 0;
|
||||
|
||||
virtual QVariant::Type type() const = 0;
|
||||
virtual QString name() const = 0;
|
||||
virtual QString typeName() const = 0;
|
||||
virtual int userType() const = 0;
|
||||
virtual bool hasSetter() const = 0;
|
||||
|
||||
virtual QVariant read(const QObject *object) const = 0;
|
||||
virtual bool reset(QObject *object) const = 0;
|
||||
virtual bool write(QObject *object, const QVariant &value) const = 0;
|
||||
};
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(QDesignerMetaPropertyInterface::AccessFlags)
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(QDesignerMetaPropertyInterface::Attributes)
|
||||
|
||||
class QDESIGNER_SDK_EXPORT QDesignerMetaMethodInterface
|
||||
{
|
||||
public:
|
||||
QDesignerMetaMethodInterface();
|
||||
virtual ~QDesignerMetaMethodInterface();
|
||||
|
||||
enum MethodType { Method, Signal, Slot, Constructor };
|
||||
enum Access { Private, Protected, Public };
|
||||
|
||||
virtual Access access() const = 0;
|
||||
virtual MethodType methodType() const = 0;
|
||||
virtual QStringList parameterNames() const = 0;
|
||||
virtual QStringList parameterTypes() const = 0;
|
||||
virtual QString signature() const = 0;
|
||||
virtual QString normalizedSignature() const = 0;
|
||||
virtual QString tag() const = 0;
|
||||
virtual QString typeName() const = 0;
|
||||
};
|
||||
|
||||
class QDESIGNER_SDK_EXPORT QDesignerMetaObjectInterface {
|
||||
public:
|
||||
QDesignerMetaObjectInterface();
|
||||
virtual ~QDesignerMetaObjectInterface();
|
||||
|
||||
virtual QString className() const = 0;
|
||||
virtual const QDesignerMetaEnumInterface *enumerator(int index) const = 0;
|
||||
virtual int enumeratorCount() const = 0;
|
||||
virtual int enumeratorOffset() const = 0;
|
||||
|
||||
virtual int indexOfEnumerator(const QString &name) const = 0;
|
||||
virtual int indexOfMethod(const QString &method) const = 0;
|
||||
virtual int indexOfProperty(const QString &name) const = 0;
|
||||
virtual int indexOfSignal(const QString &signal) const = 0;
|
||||
virtual int indexOfSlot(const QString &slot) const = 0;
|
||||
|
||||
virtual const QDesignerMetaMethodInterface *method(int index) const = 0;
|
||||
virtual int methodCount() const = 0;
|
||||
virtual int methodOffset() const = 0;
|
||||
|
||||
virtual const QDesignerMetaPropertyInterface *property(int index) const = 0;
|
||||
virtual int propertyCount() const = 0;
|
||||
virtual int propertyOffset() const = 0;
|
||||
|
||||
virtual const QDesignerMetaObjectInterface *superClass() const = 0;
|
||||
virtual const QDesignerMetaPropertyInterface *userProperty() const = 0;
|
||||
};
|
||||
|
||||
// To be obtained from core
|
||||
class QDESIGNER_SDK_EXPORT QDesignerIntrospectionInterface {
|
||||
public:
|
||||
QDesignerIntrospectionInterface();
|
||||
virtual ~QDesignerIntrospectionInterface();
|
||||
|
||||
virtual const QDesignerMetaObjectInterface* metaObject(const QObject *object) const = 0;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // ABSTRACTMETAOBJECT_H
|
||||
100
third/designer/lib/sdk/abstractlanguage.h
Normal file
@@ -0,0 +1,100 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of Qt Designer. This header
|
||||
// file may change from version to version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#ifndef QDESIGNER_ABTRACT_LANGUAGE_H
|
||||
#define QDESIGNER_ABTRACT_LANGUAGE_H
|
||||
|
||||
#include <QtDesigner/extension.h>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QDialog;
|
||||
class QWidget;
|
||||
class QDesignerFormWindowInterface;
|
||||
class QDesignerFormEditorInterface;
|
||||
class QDesignerResourceBrowserInterface;
|
||||
|
||||
class QDesignerLanguageExtension
|
||||
{
|
||||
public:
|
||||
virtual ~QDesignerLanguageExtension() {}
|
||||
|
||||
virtual QDialog *createFormWindowSettingsDialog(QDesignerFormWindowInterface *formWindow, QWidget *parentWidget) = 0;
|
||||
virtual QDesignerResourceBrowserInterface *createResourceBrowser(QWidget *parentWidget) = 0;
|
||||
|
||||
virtual QDialog *createPromotionDialog(QDesignerFormEditorInterface *formEditor, QWidget *parentWidget = 0) = 0;
|
||||
|
||||
virtual QDialog *createPromotionDialog(QDesignerFormEditorInterface *formEditor,
|
||||
const QString &promotableWidgetClassName,
|
||||
QString *promoteToClassName,
|
||||
QWidget *parentWidget = 0) = 0;
|
||||
|
||||
virtual bool isLanguageResource(const QString &path) const = 0;
|
||||
|
||||
virtual QString classNameOf(QObject *object) const = 0;
|
||||
|
||||
virtual bool signalMatchesSlot(const QString &signal, const QString &slot) const = 0;
|
||||
|
||||
virtual QString widgetBoxContents() const = 0;
|
||||
|
||||
virtual QString uiExtension() const = 0;
|
||||
};
|
||||
|
||||
Q_DECLARE_EXTENSION_INTERFACE(QDesignerLanguageExtension, "com.trolltech.Qt.Designer.Language.3")
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // QDESIGNER_ABTRACT_LANGUAGE_H
|
||||
170
third/designer/lib/sdk/abstractmetadatabase.cpp
Normal file
@@ -0,0 +1,170 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
// sdk
|
||||
#include "abstractmetadatabase.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*!
|
||||
\class QDesignerMetaDataBaseInterface
|
||||
\brief The QDesignerMetaDataBaseInterface class provides an interface to Qt Designer's
|
||||
object meta database.
|
||||
\inmodule QtDesigner
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
Constructs an interface to the meta database with the given \a parent.
|
||||
*/
|
||||
QDesignerMetaDataBaseInterface::QDesignerMetaDataBaseInterface(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Destroys the interface to the meta database.
|
||||
*/
|
||||
QDesignerMetaDataBaseInterface::~QDesignerMetaDataBaseInterface()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn QDesignerMetaDataBaseItemInterface *QDesignerMetaDataBaseInterface::item(QObject *object) const
|
||||
|
||||
Returns the item in the meta database associated with the given \a object.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerMetaDataBaseInterface::add(QObject *object)
|
||||
|
||||
Adds the specified \a object to the meta database.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerMetaDataBaseInterface::remove(QObject *object)
|
||||
|
||||
Removes the specified \a object from the meta database.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QList<QObject*> QDesignerMetaDataBaseInterface::objects() const
|
||||
|
||||
Returns the list of objects that have corresponding items in the meta database.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QDesignerFormEditorInterface *QDesignerMetaDataBaseInterface::core() const
|
||||
|
||||
Returns the core interface that is associated with the meta database.
|
||||
*/
|
||||
|
||||
|
||||
// Doc: Interface only
|
||||
|
||||
/*!
|
||||
\class QDesignerMetaDataBaseItemInterface
|
||||
\brief The QDesignerMetaDataBaseItemInterface class provides an interface to individual
|
||||
items in Qt Designer's meta database.
|
||||
\inmodule QtDesigner
|
||||
\internal
|
||||
|
||||
This class allows individual items in \QD's meta-data database to be accessed and modified.
|
||||
Use the QDesignerMetaDataBaseInterface class to change the properties of the database itself.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QDesignerMetaDataBaseItemInterface::~QDesignerMetaDataBaseItemInterface()
|
||||
|
||||
Destroys the item interface to the meta-data database.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerMetaDataBaseItemInterface::name() const
|
||||
|
||||
Returns the name of the item in the database.
|
||||
|
||||
\sa setName()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerMetaDataBaseItemInterface::setName(const QString &name)
|
||||
|
||||
Sets the name of the item to the given \a name.
|
||||
|
||||
\sa name()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QList<QWidget*> QDesignerMetaDataBaseItemInterface::tabOrder() const
|
||||
|
||||
Returns a list of widgets in the order defined by the form's tab order.
|
||||
|
||||
\sa setTabOrder()
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void QDesignerMetaDataBaseItemInterface::setTabOrder(const QList<QWidget*> &tabOrder)
|
||||
|
||||
Sets the tab order in the form using the list of widgets defined by \a tabOrder.
|
||||
|
||||
\sa tabOrder()
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn bool QDesignerMetaDataBaseItemInterface::enabled() const
|
||||
|
||||
Returns whether the item is enabled.
|
||||
|
||||
\sa setEnabled()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerMetaDataBaseItemInterface::setEnabled(bool enabled)
|
||||
|
||||
If \a enabled is true, the item is enabled; otherwise it is disabled.
|
||||
|
||||
\sa enabled()
|
||||
*/
|
||||
|
||||
QT_END_NAMESPACE
|
||||
99
third/designer/lib/sdk/abstractmetadatabase.h
Normal file
@@ -0,0 +1,99 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef ABSTRACTMETADATABASE_H
|
||||
#define ABSTRACTMETADATABASE_H
|
||||
|
||||
#include <QtDesigner/sdk_global.h>
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QHash>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QCursor;
|
||||
class QWidget;
|
||||
|
||||
class QDesignerFormEditorInterface;
|
||||
|
||||
class QDesignerMetaDataBaseItemInterface
|
||||
{
|
||||
public:
|
||||
virtual ~QDesignerMetaDataBaseItemInterface() {}
|
||||
|
||||
virtual QString name() const = 0;
|
||||
virtual void setName(const QString &name) = 0;
|
||||
|
||||
virtual QList<QWidget*> tabOrder() const = 0;
|
||||
virtual void setTabOrder(const QList<QWidget*> &tabOrder) = 0;
|
||||
|
||||
virtual bool enabled() const = 0;
|
||||
virtual void setEnabled(bool b) = 0;
|
||||
};
|
||||
|
||||
|
||||
class QDESIGNER_SDK_EXPORT QDesignerMetaDataBaseInterface: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QDesignerMetaDataBaseInterface(QObject *parent = 0);
|
||||
virtual ~QDesignerMetaDataBaseInterface();
|
||||
|
||||
virtual QDesignerMetaDataBaseItemInterface *item(QObject *object) const = 0;
|
||||
virtual void add(QObject *object) = 0;
|
||||
virtual void remove(QObject *object) = 0;
|
||||
|
||||
virtual QList<QObject*> objects() const = 0;
|
||||
|
||||
virtual QDesignerFormEditorInterface *core() const = 0;
|
||||
|
||||
Q_SIGNALS:
|
||||
void changed();
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // ABSTRACTMETADATABASE_H
|
||||
117
third/designer/lib/sdk/abstractnewformwidget.cpp
Normal file
@@ -0,0 +1,117 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "abstractnewformwidget_p.h"
|
||||
#include <newformwidget_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*!
|
||||
\class QDesignerNewFormWidgetInterface
|
||||
\since 4.5
|
||||
\internal
|
||||
|
||||
\brief QDesignerNewFormWidgetInterface provides an interface for chooser
|
||||
widgets that can be used within "New Form" dialogs and wizards.
|
||||
It presents the user with a list of choices taken from built-in
|
||||
templates, pre-defined template paths and suitable custom widgets.
|
||||
It provides a static creation function that returns \QD's
|
||||
implementation.
|
||||
|
||||
\inmodule QtDesigner
|
||||
*/
|
||||
|
||||
/*!
|
||||
Constructs a QDesignerNewFormWidgetInterface object.
|
||||
*/
|
||||
|
||||
QDesignerNewFormWidgetInterface::QDesignerNewFormWidgetInterface(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Destroys the QDesignerNewFormWidgetInterface object.
|
||||
*/
|
||||
|
||||
QDesignerNewFormWidgetInterface::~QDesignerNewFormWidgetInterface()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Creates an instance of the QDesignerNewFormWidgetInterface as a child
|
||||
of \a parent using \a core.
|
||||
*/
|
||||
|
||||
QDesignerNewFormWidgetInterface *QDesignerNewFormWidgetInterface::createNewFormWidget(QDesignerFormEditorInterface *core, QWidget *parent)
|
||||
{
|
||||
return new qdesigner_internal::NewFormWidget(core, parent);
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn bool QDesignerNewFormWidgetInterface::hasCurrentTemplate() const
|
||||
|
||||
Returns whether a form template is currently selected.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerNewFormWidgetInterface::currentTemplate(QString *errorMessage = 0)
|
||||
|
||||
Returns the contents of the currently selected template. If the method fails,
|
||||
an empty string is returned and \a errorMessage receives an error message.
|
||||
*/
|
||||
|
||||
// Signals
|
||||
|
||||
/*!
|
||||
\fn void QDesignerNewFormWidgetInterface::templateActivated()
|
||||
|
||||
This signal is emitted whenever the user activates a template by double-clicking.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerNewFormWidgetInterface::currentTemplateChanged(bool templateSelected)
|
||||
|
||||
This signal is emitted whenever the user changes the current template.
|
||||
\a templateSelected indicates whether a template is currently selected.
|
||||
*/
|
||||
|
||||
QT_END_NAMESPACE
|
||||
88
third/designer/lib/sdk/abstractnewformwidget_p.h
Normal file
@@ -0,0 +1,88 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of Qt Designer. This header
|
||||
// file may change from version to version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#ifndef ABSTRACTNEWFORMWIDGET_H
|
||||
#define ABSTRACTNEWFORMWIDGET_H
|
||||
|
||||
#include <QtDesigner/sdk_global.h>
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QDesignerFormEditorInterface;
|
||||
|
||||
class QDESIGNER_SDK_EXPORT QDesignerNewFormWidgetInterface : public QWidget
|
||||
{
|
||||
Q_DISABLE_COPY(QDesignerNewFormWidgetInterface)
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QDesignerNewFormWidgetInterface(QWidget *parent = 0);
|
||||
virtual ~QDesignerNewFormWidgetInterface();
|
||||
|
||||
virtual bool hasCurrentTemplate() const = 0;
|
||||
virtual QString currentTemplate(QString *errorMessage = 0) = 0;
|
||||
|
||||
static QDesignerNewFormWidgetInterface *createNewFormWidget(QDesignerFormEditorInterface *core, QWidget *parent = 0);
|
||||
|
||||
Q_SIGNALS:
|
||||
void templateActivated();
|
||||
void currentTemplateChanged(bool templateSelected);
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // ABSTRACTNEWFORMWIDGET_H
|
||||
110
third/designer/lib/sdk/abstractobjectinspector.cpp
Normal file
@@ -0,0 +1,110 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "abstractobjectinspector.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*!
|
||||
\class QDesignerObjectInspectorInterface
|
||||
|
||||
\brief The QDesignerObjectInspectorInterface class allows you to
|
||||
change the focus of Qt Designer's object inspector.
|
||||
|
||||
\inmodule QtDesigner
|
||||
|
||||
You can use the QDesignerObjectInspectorInterface to change the
|
||||
current form window selection. For example, when implementing a
|
||||
custom widget plugin:
|
||||
|
||||
\snippet doc/src/snippets/code/tools_designer_src_lib_sdk_abstractobjectinspector.cpp 0
|
||||
|
||||
The QDesignerObjectInspectorInterface class is not intended to be
|
||||
instantiated directly. You can retrieve an interface to \QD's
|
||||
object inspector using the
|
||||
QDesignerFormEditorInterface::objectInspector() function. A
|
||||
pointer to \QD's current QDesignerFormEditorInterface object (\c
|
||||
formEditor in the example above) is provided by the
|
||||
QDesignerCustomWidgetInterface::initialize() function's
|
||||
parameter. When implementing a custom widget plugin, you must
|
||||
subclass the QDesignerCustomWidgetInterface to expose your plugin
|
||||
to \QD.
|
||||
|
||||
The interface provides the core() function that you can use to
|
||||
retrieve a pointer to \QD's current QDesignerFormEditorInterface
|
||||
object, and the setFormWindow() function that enables you to
|
||||
change the current form window selection.
|
||||
|
||||
\sa QDesignerFormEditorInterface, QDesignerFormWindowInterface
|
||||
*/
|
||||
|
||||
/*!
|
||||
Constructs an object inspector interface with the given \a parent
|
||||
and the specified window \a flags.
|
||||
*/
|
||||
QDesignerObjectInspectorInterface::QDesignerObjectInspectorInterface(QWidget *parent, Qt::WindowFlags flags)
|
||||
: QWidget(parent, flags)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Destroys the object inspector interface.
|
||||
*/
|
||||
QDesignerObjectInspectorInterface::~QDesignerObjectInspectorInterface()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns a pointer to \QD's current QDesignerFormEditorInterface
|
||||
object.
|
||||
*/
|
||||
QDesignerFormEditorInterface *QDesignerObjectInspectorInterface::core() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn void QDesignerObjectInspectorInterface::setFormWindow(QDesignerFormWindowInterface *formWindow)
|
||||
|
||||
Sets the currently selected form window to \a formWindow.
|
||||
*/
|
||||
|
||||
QT_END_NAMESPACE
|
||||
73
third/designer/lib/sdk/abstractobjectinspector.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef ABSTRACTOBJECTINSPECTOR_H
|
||||
#define ABSTRACTOBJECTINSPECTOR_H
|
||||
|
||||
#include <QtDesigner/sdk_global.h>
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QDesignerFormEditorInterface;
|
||||
class QDesignerFormWindowInterface;
|
||||
|
||||
class QDESIGNER_SDK_EXPORT QDesignerObjectInspectorInterface: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QDesignerObjectInspectorInterface(QWidget *parent, Qt::WindowFlags flags = 0);
|
||||
virtual ~QDesignerObjectInspectorInterface();
|
||||
|
||||
virtual QDesignerFormEditorInterface *core() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
virtual void setFormWindow(QDesignerFormWindowInterface *formWindow) = 0;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // ABSTRACTOBJECTINSPECTOR_H
|
||||
79
third/designer/lib/sdk/abstractoptionspage_p.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of Qt Designer. This header
|
||||
// file may change from version to version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#ifndef ABSTRACTOPTIONSPAGE_P_H
|
||||
#define ABSTRACTOPTIONSPAGE_P_H
|
||||
|
||||
#include <QtDesigner/sdk_global.h>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QString;
|
||||
class QWidget;
|
||||
|
||||
class QDESIGNER_SDK_EXPORT QDesignerOptionsPageInterface
|
||||
{
|
||||
public:
|
||||
virtual ~QDesignerOptionsPageInterface() {}
|
||||
virtual QString name() const = 0;
|
||||
virtual QWidget *createPage(QWidget *parent) = 0;
|
||||
virtual void apply() = 0;
|
||||
virtual void finish() = 0;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // ABSTRACTOPTIONSPAGE_P_H
|
||||
113
third/designer/lib/sdk/abstractpromotioninterface.cpp
Normal file
@@ -0,0 +1,113 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "abstractpromotioninterface.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QDesignerPromotionInterface::~QDesignerPromotionInterface()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\class QDesignerPromotionInterface
|
||||
|
||||
\brief The QDesignerPromotionInterface provides functions for modifying
|
||||
the promoted classes in Designer.
|
||||
\inmodule QtDesigner
|
||||
\internal
|
||||
\since 4.3
|
||||
*/
|
||||
|
||||
/*!
|
||||
\class QDesignerPromotionInterface::PromotedClass
|
||||
A pair of database items containing the base class and the promoted class.
|
||||
|
||||
\typedef QDesignerPromotionInterface::PromotedClasses
|
||||
A list of PromotedClass items.
|
||||
|
||||
virtual QDesignerPromotionInterface::PromotedClasses promotedClasses() const
|
||||
|
||||
Returns a list of promoted classes along with their base classes in alphabetical order.
|
||||
It can be used to populate tree models for editing promoted widgets.
|
||||
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QSet<QString> QDesignerPromotionInterface::referencedPromotedClassNames() const
|
||||
|
||||
Returns a set of promoted classed that are referenced by the currently opened forms.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual bool QDesignerPromotionInterface::addPromotedClass(const QString &baseClass, const QString &className, const QString &includeFile, QString *errorMessage)
|
||||
|
||||
Add a promoted class named \a with the base class \a and include file \a includeFile. Returns \c true on success or \c false along
|
||||
with an error message in \a errorMessage on failure.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual bool QDesignerPromotionInterface::removePromotedClass(const QString &className, QString *errorMessage)
|
||||
|
||||
Remove the promoted class named \a className unless it is referenced by a form. Returns \c true on success or \c false along
|
||||
with an error message in \a errorMessage on failure.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual bool QDesignerPromotionInterface::changePromotedClassName(const QString &oldClassName, const QString &newClassName, QString *errorMessage)
|
||||
|
||||
Change the class name of a promoted class from \a oldClassName to \a newClassName. Returns \c true on success or \c false along
|
||||
with an error message in \a errorMessage on failure.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual bool QDesignerPromotionInterface::setPromotedClassIncludeFile(const QString &className, const QString &includeFile, QString *errorMessage)
|
||||
|
||||
Change the include file of a promoted class named \a className to be \a includeFile. Returns \c true on success or \c false along
|
||||
with an error message in \a errorMessage on failure.
|
||||
*/
|
||||
|
||||
/*! \fn virtual QList<QDesignerWidgetDataBaseItemInterface *> QDesignerPromotionInterface::promotionBaseClasses() const
|
||||
|
||||
Return a list of base classes that are suitable for promotion.
|
||||
*/
|
||||
|
||||
QT_END_NAMESPACE
|
||||
91
third/designer/lib/sdk/abstractpromotioninterface.h
Normal file
@@ -0,0 +1,91 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef ABSTRACTPROMOTIONINTERFACE_H
|
||||
#define ABSTRACTPROMOTIONINTERFACE_H
|
||||
|
||||
#include <QtDesigner/sdk_global.h>
|
||||
|
||||
#include <QtCore/QPair>
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QSet>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QDesignerWidgetDataBaseItemInterface;
|
||||
|
||||
class QDESIGNER_SDK_EXPORT QDesignerPromotionInterface
|
||||
{
|
||||
public:
|
||||
virtual ~QDesignerPromotionInterface();
|
||||
|
||||
struct PromotedClass {
|
||||
QDesignerWidgetDataBaseItemInterface *baseItem;
|
||||
QDesignerWidgetDataBaseItemInterface *promotedItem;
|
||||
};
|
||||
|
||||
typedef QList<PromotedClass> PromotedClasses;
|
||||
|
||||
virtual PromotedClasses promotedClasses() const = 0;
|
||||
|
||||
virtual QSet<QString> referencedPromotedClassNames() const = 0;
|
||||
|
||||
virtual bool addPromotedClass(const QString &baseClass,
|
||||
const QString &className,
|
||||
const QString &includeFile,
|
||||
QString *errorMessage) = 0;
|
||||
|
||||
virtual bool removePromotedClass(const QString &className, QString *errorMessage) = 0;
|
||||
|
||||
virtual bool changePromotedClassName(const QString &oldClassName, const QString &newClassName, QString *errorMessage) = 0;
|
||||
|
||||
virtual bool setPromotedClassIncludeFile(const QString &className, const QString &includeFile, QString *errorMessage) = 0;
|
||||
|
||||
virtual QList<QDesignerWidgetDataBaseItemInterface *> promotionBaseClasses() const = 0;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // ABSTRACTPROMOTIONINTERFACE_H
|
||||
193
third/designer/lib/sdk/abstractpropertyeditor.cpp
Normal file
@@ -0,0 +1,193 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "abstractpropertyeditor.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*!
|
||||
\class QDesignerPropertyEditorInterface
|
||||
|
||||
\brief The QDesignerPropertyEditorInterface class allows you to
|
||||
query and manipulate the current state of Qt Designer's property
|
||||
editor.
|
||||
|
||||
\inmodule QtDesigner
|
||||
|
||||
QDesignerPropertyEditorInterface contains a collection of
|
||||
functions that is typically used to query the property editor for
|
||||
its current state, and several slots manipulating it's state. The
|
||||
interface also provide a signal, propertyChanged(), which is
|
||||
emitted whenever a property changes in the property editor. The
|
||||
signal's arguments are the property that changed and its new
|
||||
value.
|
||||
|
||||
For example, when implementing a custom widget plugin, you can
|
||||
connect the signal to a custom slot:
|
||||
|
||||
\snippet doc/src/snippets/code/tools_designer_src_lib_sdk_abstractpropertyeditor.cpp 0
|
||||
|
||||
Then the custom slot can check if the new value is within the
|
||||
range we want when a specified property, belonging to a particular
|
||||
widget, changes:
|
||||
|
||||
\snippet doc/src/snippets/code/tools_designer_src_lib_sdk_abstractpropertyeditor.cpp 1
|
||||
|
||||
The QDesignerPropertyEditorInterface class is not intended to be
|
||||
instantiated directly. You can retrieve an interface to \QD's
|
||||
property editor using the
|
||||
QDesignerFormEditorInterface::propertyEditor() function. A pointer
|
||||
to \QD's current QDesignerFormEditorInterface object (\c
|
||||
formEditor in the examples above) is provided by the
|
||||
QDesignerCustomWidgetInterface::initialize() function's
|
||||
parameter. When implementing a custom widget plugin, you must
|
||||
subclass the QDesignerCustomWidgetInterface to expose your plugin
|
||||
to \QD.
|
||||
|
||||
The functions accessing the property editor are the core()
|
||||
function that you can use to retrieve an interface to the form
|
||||
editor, the currentPropertyName() function that returns the name
|
||||
of the currently selected property in the property editor, the
|
||||
object() function that returns the currently selected object in
|
||||
\QD's workspace, and the isReadOnly() function that returns true
|
||||
if the property editor is write proteced (otherwise false).
|
||||
|
||||
The slots manipulating the property editor's state are the
|
||||
setObject() slot that you can use to change the currently selected
|
||||
object in \QD's workspace, the setPropertyValue() slot that
|
||||
changes the value of a given property and the setReadOnly() slot
|
||||
that control the write protection of the property editor.
|
||||
|
||||
\sa QDesignerFormEditorInterface
|
||||
*/
|
||||
|
||||
/*!
|
||||
Constructs a property editor interface with the given \a parent and
|
||||
the specified window \a flags.
|
||||
*/
|
||||
QDesignerPropertyEditorInterface::QDesignerPropertyEditorInterface(QWidget *parent, Qt::WindowFlags flags)
|
||||
: QWidget(parent, flags)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Destroys the property editor interface.
|
||||
*/
|
||||
QDesignerPropertyEditorInterface::~QDesignerPropertyEditorInterface()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns a pointer to \QD's current QDesignerFormEditorInterface
|
||||
object.
|
||||
*/
|
||||
QDesignerFormEditorInterface *QDesignerPropertyEditorInterface::core() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn bool QDesignerPropertyEditorInterface::isReadOnly() const
|
||||
|
||||
Returns true if the property editor is write protected; otherwise
|
||||
false.
|
||||
|
||||
\sa setReadOnly()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QObject *QDesignerPropertyEditorInterface::object() const
|
||||
|
||||
Returns the currently selected object in \QD's workspace.
|
||||
|
||||
\sa setObject()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerPropertyEditorInterface::currentPropertyName() const
|
||||
|
||||
Returns the name of the currently selected property in the
|
||||
property editor.
|
||||
|
||||
\sa setPropertyValue()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerPropertyEditorInterface::propertyChanged(const QString &name, const QVariant &value)
|
||||
|
||||
This signal is emitted whenever a property changes in the property
|
||||
editor. The property that changed and its new value are specified
|
||||
by \a name and \a value respectively.
|
||||
|
||||
\sa setPropertyValue()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerPropertyEditorInterface::setObject(QObject *object)
|
||||
|
||||
Changes the currently selected object in \QD's workspace, to \a
|
||||
object.
|
||||
|
||||
\sa object()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerPropertyEditorInterface::setPropertyValue(const QString &name, const QVariant &value, bool changed = true)
|
||||
|
||||
Sets the value of the property specified by \a name to \a
|
||||
value.
|
||||
|
||||
In addition, the property is marked as \a changed in the property
|
||||
editor, i.e. its value is different from the default value.
|
||||
|
||||
\sa currentPropertyName(), propertyChanged()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerPropertyEditorInterface::setReadOnly(bool readOnly)
|
||||
|
||||
If \a readOnly is true, the property editor is made write
|
||||
protected; otherwise the write protection is removed.
|
||||
|
||||
\sa isReadOnly()
|
||||
*/
|
||||
|
||||
QT_END_NAMESPACE
|
||||
84
third/designer/lib/sdk/abstractpropertyeditor.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef ABSTRACTPROPERTYEDITOR_H
|
||||
#define ABSTRACTPROPERTYEDITOR_H
|
||||
|
||||
#include <QtDesigner/sdk_global.h>
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QDesignerFormEditorInterface;
|
||||
class QString;
|
||||
class QVariant;
|
||||
|
||||
class QDESIGNER_SDK_EXPORT QDesignerPropertyEditorInterface: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QDesignerPropertyEditorInterface(QWidget *parent, Qt::WindowFlags flags = 0);
|
||||
virtual ~QDesignerPropertyEditorInterface();
|
||||
|
||||
virtual QDesignerFormEditorInterface *core() const;
|
||||
|
||||
virtual bool isReadOnly() const = 0;
|
||||
virtual QObject *object() const = 0;
|
||||
|
||||
virtual QString currentPropertyName() const = 0;
|
||||
|
||||
Q_SIGNALS:
|
||||
void propertyChanged(const QString &name, const QVariant &value);
|
||||
|
||||
public Q_SLOTS:
|
||||
virtual void setObject(QObject *object) = 0;
|
||||
virtual void setPropertyValue(const QString &name, const QVariant &value, bool changed = true) = 0;
|
||||
virtual void setReadOnly(bool readOnly) = 0;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // ABSTRACTPROPERTYEDITOR_H
|
||||
57
third/designer/lib/sdk/abstractresourcebrowser.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "abstractresourcebrowser.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QDesignerResourceBrowserInterface::QDesignerResourceBrowserInterface(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QDesignerResourceBrowserInterface::~QDesignerResourceBrowserInterface()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
75
third/designer/lib/sdk/abstractresourcebrowser.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef ABSTRACTRESOURCEBROWSER_H
|
||||
#define ABSTRACTRESOURCEBROWSER_H
|
||||
|
||||
#include <QtDesigner/sdk_global.h>
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QWidget; // FIXME: fool syncqt
|
||||
|
||||
class QDESIGNER_SDK_EXPORT QDesignerResourceBrowserInterface: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QDesignerResourceBrowserInterface(QWidget *parent = 0);
|
||||
virtual ~QDesignerResourceBrowserInterface();
|
||||
|
||||
virtual void setCurrentPath(const QString &filePath) = 0;
|
||||
virtual QString currentPath() const = 0;
|
||||
|
||||
Q_SIGNALS:
|
||||
void currentPathChanged(const QString &filePath);
|
||||
void pathActivated(const QString &filePath);
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // ABSTRACTFORMEDITOR_H
|
||||
|
||||
87
third/designer/lib/sdk/abstractsettings_p.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of Qt Designer. This header
|
||||
// file may change from version to version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#ifndef ABSTRACTSETTINGS_P_H
|
||||
#define ABSTRACTSETTINGS_P_H
|
||||
|
||||
#include <QtDesigner/sdk_global.h>
|
||||
|
||||
#include <QVariant>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QString;
|
||||
|
||||
/*!
|
||||
To be implemented by IDEs that want to control the way designer retrieves/stores its settings.
|
||||
*/
|
||||
class QDESIGNER_SDK_EXPORT QDesignerSettingsInterface
|
||||
{
|
||||
public:
|
||||
virtual ~QDesignerSettingsInterface() {}
|
||||
|
||||
virtual void beginGroup(const QString &prefix) = 0;
|
||||
virtual void endGroup() = 0;
|
||||
|
||||
virtual bool contains(const QString &key) const = 0;
|
||||
virtual void setValue(const QString &key, const QVariant &value) = 0;
|
||||
virtual QVariant value(const QString &key, const QVariant &defaultValue = QVariant()) const = 0;
|
||||
virtual void remove(const QString &key) = 0;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // ABSTRACTSETTINGS_P_H
|
||||
340
third/designer/lib/sdk/abstractwidgetbox.cpp
Normal file
@@ -0,0 +1,340 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "abstractwidgetbox.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*!
|
||||
\class QDesignerWidgetBoxInterface
|
||||
|
||||
\brief The QDesignerWidgetBoxInterface class allows you to control
|
||||
the contents of Qt Designer's widget box.
|
||||
|
||||
\inmodule QtDesigner
|
||||
|
||||
QDesignerWidgetBoxInterface contains a collection of functions
|
||||
that is typically used to manipulate the contents of \QD's widget
|
||||
box.
|
||||
|
||||
\QD uses an XML file to populate its widget box. The name of that
|
||||
file is one of the widget box's properties, and you can retrieve
|
||||
it using the fileName() function.
|
||||
|
||||
QDesignerWidgetBoxInterface also provides the save() function that
|
||||
saves the contents of the widget box in the file specified by the
|
||||
widget box's file name property. If you have made changes to the
|
||||
widget box, for example by dropping a widget into the widget box,
|
||||
without calling the save() function, the original content can be
|
||||
restored by a simple invocation of the load() function:
|
||||
|
||||
\snippet doc/src/snippets/code/tools_designer_src_lib_sdk_abstractwidgetbox.cpp 0
|
||||
|
||||
The QDesignerWidgetBoxInterface class is not intended to be
|
||||
instantiated directly. You can retrieve an interface to Qt
|
||||
Designer's widget box using the
|
||||
QDesignerFormEditorInterface::widgetBox() function. A pointer to
|
||||
\QD's current QDesignerFormEditorInterface object (\c formEditor
|
||||
in the example above) is provided by the
|
||||
QDesignerCustomWidgetInterface::initialize() function's
|
||||
parameter. When implementing a custom widget plugin, you must
|
||||
subclass the QDesignerCustomWidgetInterface to expose your plugin
|
||||
to \QD.
|
||||
|
||||
If you want to save your changes, and at the same time preserve
|
||||
the original contents, you can use the save() function combined
|
||||
with the setFileName() function to save your changes into another
|
||||
file. Remember to store the name of the original file first:
|
||||
|
||||
\snippet doc/src/snippets/code/tools_designer_src_lib_sdk_abstractwidgetbox.cpp 1
|
||||
|
||||
Then you can restore the original contents of the widget box by
|
||||
resetting the file name to the original file and calling load():
|
||||
|
||||
\snippet doc/src/snippets/code/tools_designer_src_lib_sdk_abstractwidgetbox.cpp 2
|
||||
|
||||
In a similar way, you can later use your customized XML file:
|
||||
|
||||
\snippet doc/src/snippets/code/tools_designer_src_lib_sdk_abstractwidgetbox.cpp 3
|
||||
|
||||
|
||||
\sa QDesignerFormEditorInterface
|
||||
*/
|
||||
|
||||
/*!
|
||||
Constructs a widget box interface with the given \a parent and
|
||||
the specified window \a flags.
|
||||
*/
|
||||
QDesignerWidgetBoxInterface::QDesignerWidgetBoxInterface(QWidget *parent, Qt::WindowFlags flags)
|
||||
: QWidget(parent, flags)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Destroys the widget box interface.
|
||||
*/
|
||||
QDesignerWidgetBoxInterface::~QDesignerWidgetBoxInterface()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
int QDesignerWidgetBoxInterface::findOrInsertCategory(const QString &categoryName)
|
||||
{
|
||||
int count = categoryCount();
|
||||
for (int index=0; index<count; ++index) {
|
||||
Category c = category(index);
|
||||
if (c.name() == categoryName)
|
||||
return index;
|
||||
}
|
||||
|
||||
addCategory(Category(categoryName));
|
||||
return count;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
\fn int QDesignerWidgetBoxInterface::categoryCount() const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\internal
|
||||
\fn Category QDesignerWidgetBoxInterface::category(int cat_idx) const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\internal
|
||||
\fn void QDesignerWidgetBoxInterface::addCategory(const Category &cat)
|
||||
*/
|
||||
|
||||
/*!
|
||||
\internal
|
||||
\fn void QDesignerWidgetBoxInterface::removeCategory(int cat_idx)
|
||||
*/
|
||||
|
||||
/*!
|
||||
\internal
|
||||
\fn int QDesignerWidgetBoxInterface::widgetCount(int cat_idx) const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\internal
|
||||
\fn Widget QDesignerWidgetBoxInterface::widget(int cat_idx, int wgt_idx) const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\internal
|
||||
\fn void QDesignerWidgetBoxInterface::addWidget(int cat_idx, const Widget &wgt)
|
||||
*/
|
||||
|
||||
/*!
|
||||
\internal
|
||||
\fn void QDesignerWidgetBoxInterface::removeWidget(int cat_idx, int wgt_idx)
|
||||
*/
|
||||
|
||||
/*!
|
||||
\internal
|
||||
\fn void QDesignerWidgetBoxInterface::dropWidgets(const QList<QDesignerDnDItemInterface*> &item_list, const QPoint &global_mouse_pos)
|
||||
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerWidgetBoxInterface::setFileName(const QString &fileName)
|
||||
|
||||
Sets the XML file that \QD will use to populate its widget box, to
|
||||
\a fileName. You must call load() to update the widget box with
|
||||
the new XML file.
|
||||
|
||||
\sa fileName(), load()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerWidgetBoxInterface::fileName() const
|
||||
|
||||
Returns the name of the XML file \QD is currently using to
|
||||
populate its widget box.
|
||||
|
||||
\sa setFileName()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool QDesignerWidgetBoxInterface::load()
|
||||
|
||||
Populates \QD's widget box by loading (or reloading) the currently
|
||||
specified XML file. Returns true if the file is successfully
|
||||
loaded; otherwise false.
|
||||
|
||||
\sa setFileName()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool QDesignerWidgetBoxInterface::save()
|
||||
|
||||
Saves the contents of \QD's widget box in the file specified by
|
||||
the fileName() function. Returns true if the content is
|
||||
successfully saved; otherwise false.
|
||||
|
||||
\sa fileName(), setFileName()
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
||||
\class QDesignerWidgetBoxInterface::Widget
|
||||
|
||||
\brief The Widget class specified a widget in Qt Designer's widget
|
||||
box component.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum QDesignerWidgetBoxInterface::Widget::Type
|
||||
|
||||
\value Default
|
||||
\value Custom
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QDesignerWidgetBoxInterface::Widget::Widget(const QString &aname, const QString &xml, const QString &icon_name, Type atype)
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerWidgetBoxInterface::Widget::name() const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerWidgetBoxInterface::Widget::setName(const QString &aname)
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerWidgetBoxInterface::Widget::domXml() const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerWidgetBoxInterface::Widget::setDomXml(const QString &xml)
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerWidgetBoxInterface::Widget::iconName() const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerWidgetBoxInterface::Widget::setIconName(const QString &icon_name)
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn Type QDesignerWidgetBoxInterface::Widget::type() const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerWidgetBoxInterface::Widget::setType(Type atype)
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool QDesignerWidgetBoxInterface::Widget::isNull() const
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\class QDesignerWidgetBoxInterface::Category
|
||||
\brief The Category class specifies a category in Qt Designer's widget box component.
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum QDesignerWidgetBoxInterface::Category::Type
|
||||
|
||||
\value Default
|
||||
\value Scratchpad
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QDesignerWidgetBoxInterface::Category::Category(const QString &aname, Type atype)
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerWidgetBoxInterface::Category::name() const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerWidgetBoxInterface::Category::setName(const QString &aname)
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int QDesignerWidgetBoxInterface::Category::widgetCount() const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn Widget QDesignerWidgetBoxInterface::Category::widget(int idx) const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerWidgetBoxInterface::Category::removeWidget(int idx)
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerWidgetBoxInterface::Category::addWidget(const Widget &awidget)
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn Type QDesignerWidgetBoxInterface::Category::type() const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerWidgetBoxInterface::Category::setType(Type atype)
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool QDesignerWidgetBoxInterface::Category::isNull() const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\typedef QDesignerWidgetBoxInterface::CategoryList
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
\typedef QDesignerWidgetBoxInterface::WidgetList
|
||||
\internal
|
||||
*/
|
||||
|
||||
QT_END_NAMESPACE
|
||||
142
third/designer/lib/sdk/abstractwidgetbox.h
Normal file
@@ -0,0 +1,142 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef ABSTRACTWIDGETBOX_H
|
||||
#define ABSTRACTWIDGETBOX_H
|
||||
|
||||
#include <QtDesigner/sdk_global.h>
|
||||
|
||||
#include <QtCore/QMetaType>
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtGui/QIcon>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class DomUI;
|
||||
class QDesignerDnDItemInterface;
|
||||
|
||||
class QDESIGNER_SDK_EXPORT QDesignerWidgetBoxInterface : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
class Widget {
|
||||
public:
|
||||
enum Type { Default, Custom };
|
||||
Widget(const QString &aname = QString(), const QString &xml = QString(),
|
||||
const QString &icon_name = QString(), Type atype = Default)
|
||||
: m_name(aname), m_xml(xml), m_icon_name(icon_name), m_type(atype) {}
|
||||
QString name() const { return m_name; }
|
||||
void setName(const QString &aname) { m_name = aname; }
|
||||
QString domXml() const { return m_xml; }
|
||||
void setDomXml(const QString &xml) { m_xml = xml; }
|
||||
QString iconName() const { return m_icon_name; }
|
||||
void setIconName(const QString &icon_name) { m_icon_name = icon_name; }
|
||||
Type type() const { return m_type; }
|
||||
void setType(Type atype) { m_type = atype; }
|
||||
|
||||
bool isNull() const { return m_name.isEmpty(); }
|
||||
|
||||
private:
|
||||
QString m_name;
|
||||
QString m_xml;
|
||||
QString m_icon_name;
|
||||
Type m_type;
|
||||
};
|
||||
typedef QList<Widget> WidgetList;
|
||||
|
||||
class Category {
|
||||
public:
|
||||
enum Type { Default, Scratchpad };
|
||||
|
||||
Category(const QString &aname = QString(), Type atype = Default)
|
||||
: m_name(aname), m_type(atype) {}
|
||||
|
||||
QString name() const { return m_name; }
|
||||
void setName(const QString &aname) { m_name = aname; }
|
||||
int widgetCount() const { return m_widget_list.size(); }
|
||||
Widget widget(int idx) const { return m_widget_list.at(idx); }
|
||||
void removeWidget(int idx) { m_widget_list.removeAt(idx); }
|
||||
void addWidget(const Widget &awidget) { m_widget_list.append(awidget); }
|
||||
Type type() const { return m_type; }
|
||||
void setType(Type atype) { m_type = atype; }
|
||||
|
||||
bool isNull() const { return m_name.isEmpty(); }
|
||||
|
||||
private:
|
||||
QString m_name;
|
||||
Type m_type;
|
||||
QList<Widget> m_widget_list;
|
||||
};
|
||||
typedef QList<Category> CategoryList;
|
||||
|
||||
QDesignerWidgetBoxInterface(QWidget *parent = 0, Qt::WindowFlags flags = 0);
|
||||
virtual ~QDesignerWidgetBoxInterface();
|
||||
|
||||
virtual int categoryCount() const = 0;
|
||||
virtual Category category(int cat_idx) const = 0;
|
||||
virtual void addCategory(const Category &cat) = 0;
|
||||
virtual void removeCategory(int cat_idx) = 0;
|
||||
|
||||
virtual int widgetCount(int cat_idx) const = 0;
|
||||
virtual Widget widget(int cat_idx, int wgt_idx) const = 0;
|
||||
virtual void addWidget(int cat_idx, const Widget &wgt) = 0;
|
||||
virtual void removeWidget(int cat_idx, int wgt_idx) = 0;
|
||||
|
||||
int findOrInsertCategory(const QString &categoryName);
|
||||
|
||||
virtual void dropWidgets(const QList<QDesignerDnDItemInterface*> &item_list,
|
||||
const QPoint &global_mouse_pos) = 0;
|
||||
|
||||
virtual void setFileName(const QString &file_name) = 0;
|
||||
virtual QString fileName() const = 0;
|
||||
virtual bool load() = 0;
|
||||
virtual bool save() = 0;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QDesignerWidgetBoxInterface::Widget))
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // ABSTRACTWIDGETBOX_H
|
||||
360
third/designer/lib/sdk/abstractwidgetdatabase.cpp
Normal file
@@ -0,0 +1,360 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "abstractwidgetdatabase.h"
|
||||
#include <QtCore/qdebug.h>
|
||||
#include <qalgorithms.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace {
|
||||
enum { debugWidgetDataBase = 0 };
|
||||
}
|
||||
|
||||
/*!
|
||||
\class QDesignerWidgetDataBaseInterface
|
||||
\brief The QDesignerWidgetDataBaseInterface class provides an interface that is used to
|
||||
access and modify Qt Designer's widget database.
|
||||
\inmodule QtDesigner
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
Constructs an interface to the widget database with the given \a parent.
|
||||
*/
|
||||
QDesignerWidgetDataBaseInterface::QDesignerWidgetDataBaseInterface(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Destroys the interface to the widget database.
|
||||
*/
|
||||
QDesignerWidgetDataBaseInterface::~QDesignerWidgetDataBaseInterface()
|
||||
{
|
||||
qDeleteAll(m_items);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
*/
|
||||
int QDesignerWidgetDataBaseInterface::count() const
|
||||
{
|
||||
return m_items.count();
|
||||
}
|
||||
|
||||
/*!
|
||||
*/
|
||||
QDesignerWidgetDataBaseItemInterface *QDesignerWidgetDataBaseInterface::item(int index) const
|
||||
{
|
||||
return index != -1 ? m_items.at(index) : 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
*/
|
||||
int QDesignerWidgetDataBaseInterface::indexOf(QDesignerWidgetDataBaseItemInterface *item) const
|
||||
{
|
||||
return m_items.indexOf(item);
|
||||
}
|
||||
|
||||
/*!
|
||||
*/
|
||||
void QDesignerWidgetDataBaseInterface::insert(int index, QDesignerWidgetDataBaseItemInterface *item)
|
||||
{
|
||||
if (debugWidgetDataBase)
|
||||
qDebug() << "insert at " << index << ' ' << item->name() << " derived from " << item->extends();
|
||||
|
||||
m_items.insert(index, item);
|
||||
}
|
||||
|
||||
/*!
|
||||
*/
|
||||
void QDesignerWidgetDataBaseInterface::append(QDesignerWidgetDataBaseItemInterface *item)
|
||||
{
|
||||
if (debugWidgetDataBase)
|
||||
qDebug() << "append " << item->name() << " derived from " << item->extends();
|
||||
m_items.append(item);
|
||||
}
|
||||
|
||||
/*!
|
||||
*/
|
||||
QDesignerFormEditorInterface *QDesignerWidgetDataBaseInterface::core() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
*/
|
||||
int QDesignerWidgetDataBaseInterface::indexOfClassName(const QString &name, bool) const
|
||||
{
|
||||
const int itemCount = count();
|
||||
for (int i=0; i<itemCount; ++i) {
|
||||
const QDesignerWidgetDataBaseItemInterface *entry = item(i);
|
||||
if (entry->name() == name)
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*!
|
||||
*/
|
||||
int QDesignerWidgetDataBaseInterface::indexOfObject(QObject *object, bool) const
|
||||
{
|
||||
if (!object)
|
||||
return -1;
|
||||
|
||||
const QString className = QString::fromUtf8(object->metaObject()->className());
|
||||
return indexOfClassName(className);
|
||||
}
|
||||
|
||||
/*!
|
||||
*/
|
||||
bool QDesignerWidgetDataBaseInterface::isContainer(QObject *object, bool resolveName) const
|
||||
{
|
||||
if (const QDesignerWidgetDataBaseItemInterface *i = item(indexOfObject(object, resolveName)))
|
||||
return i->isContainer();
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
*/
|
||||
bool QDesignerWidgetDataBaseInterface::isCustom(QObject *object, bool resolveName) const
|
||||
{
|
||||
if (const QDesignerWidgetDataBaseItemInterface *i = item(indexOfObject(object, resolveName)))
|
||||
return i->isCustom();
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn void QDesignerWidgetDataBaseInterface::changed()
|
||||
|
||||
This signal is emitted ...
|
||||
*/
|
||||
|
||||
|
||||
// Doc: No implementation - an abstract class
|
||||
|
||||
/*!
|
||||
\class QDesignerWidgetDataBaseItemInterface
|
||||
\brief The QDesignerWidgetDataBaseItemInterface class provides an interface that is used to
|
||||
access individual items in Qt Designer's widget database.
|
||||
\inmodule QtDesigner
|
||||
\internal
|
||||
|
||||
This class enables individual items in the widget database to be accessed and modified.
|
||||
Changes to the widget database itself are made through the QDesignerWidgetDataBaseInterface
|
||||
class.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QDesignerWidgetDataBaseItemInterface::~QDesignerWidgetDataBaseItemInterface()
|
||||
|
||||
Destroys the interface.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QString QDesignerWidgetDataBaseItemInterface::name() const = 0
|
||||
|
||||
Returns the name of the widget.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerWidgetDataBaseItemInterface::setName(const QString &name) = 0
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QString QDesignerWidgetDataBaseItemInterface::group() const = 0
|
||||
|
||||
Returns the name of the group that the widget belongs to.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerWidgetDataBaseItemInterface::setGroup(const QString &group) = 0
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QString QDesignerWidgetDataBaseItemInterface::toolTip() const = 0
|
||||
|
||||
Returns the tool tip to be used by the widget.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerWidgetDataBaseItemInterface::setToolTip(const QString &toolTip) = 0
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QString QDesignerWidgetDataBaseItemInterface::whatsThis() const = 0
|
||||
|
||||
Returns the "What's This?" help for the widget.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerWidgetDataBaseItemInterface::setWhatsThis(const QString &whatsThis) = 0
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QString QDesignerWidgetDataBaseItemInterface::includeFile() const = 0
|
||||
|
||||
Returns the name of the include file that the widget needs when being built from source.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerWidgetDataBaseItemInterface::setIncludeFile(const QString &includeFile) = 0
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QIcon QDesignerWidgetDataBaseItemInterface::icon() const = 0
|
||||
|
||||
Returns the icon used to represent the item.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerWidgetDataBaseItemInterface::setIcon(const QIcon &icon) = 0
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual bool QDesignerWidgetDataBaseItemInterface::isCompat() const = 0
|
||||
|
||||
Returns true if this type of widget is provided for compatibility purposes (e.g. Qt3Support
|
||||
widgets); otherwise returns false.
|
||||
|
||||
\sa setCompat()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerWidgetDataBaseItemInterface::setCompat(bool compat) = 0
|
||||
|
||||
If \a compat is true, the widget is handled as a compatibility widget; otherwise it is
|
||||
handled normally by \QD.
|
||||
|
||||
\sa isCompat()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual bool QDesignerWidgetDataBaseItemInterface::isContainer() const = 0
|
||||
|
||||
Returns true if this widget is intended to be used to hold other widgets; otherwise returns
|
||||
false.
|
||||
|
||||
\sa setContainer()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerWidgetDataBaseItemInterface::setContainer(bool container) = 0
|
||||
|
||||
If \a container is true, the widget can be used to hold other widgets in \QD; otherwise
|
||||
\QD will refuse to let the user place other widgets inside it.
|
||||
|
||||
\sa isContainer()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual bool QDesignerWidgetDataBaseItemInterface::isCustom() const = 0
|
||||
|
||||
Returns true if the widget is a custom widget; otherwise return false if it is a standard
|
||||
Qt widget.
|
||||
|
||||
\sa setCustom()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerWidgetDataBaseItemInterface::setCustom(bool custom) = 0
|
||||
|
||||
If \a custom is true, the widget is handled specially by \QD; otherwise it is handled as
|
||||
a standard Qt widget.
|
||||
|
||||
\sa isCustom()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QString QDesignerWidgetDataBaseItemInterface::pluginPath() const = 0
|
||||
|
||||
Returns the path to use for the widget plugin.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerWidgetDataBaseItemInterface::setPluginPath(const QString &path) = 0
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual bool QDesignerWidgetDataBaseItemInterface::isPromoted() const = 0
|
||||
|
||||
Returns true if the widget is promoted; otherwise returns false.
|
||||
|
||||
Promoted widgets are those that represent custom widgets, but which are represented in
|
||||
\QD by either standard Qt widgets or readily-available custom widgets.
|
||||
|
||||
\sa setPromoted()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerWidgetDataBaseItemInterface::setPromoted(bool promoted) = 0
|
||||
|
||||
If \a promoted is true, the widget is handled as a promoted widget by \QD and will use
|
||||
a placeholder widget to represent it; otherwise it is handled as a standard widget.
|
||||
|
||||
\sa isPromoted()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QString QDesignerWidgetDataBaseItemInterface::extends() const = 0
|
||||
|
||||
Returns the name of the widget that the item extends.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerWidgetDataBaseItemInterface::setExtends(const QString &s) = 0
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerWidgetDataBaseItemInterface::setDefaultPropertyValues(const QList<QVariant> &list) = 0
|
||||
|
||||
Sets the default property values for the widget to the given \a list.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QList<QVariant> QDesignerWidgetDataBaseItemInterface::defaultPropertyValues() const = 0
|
||||
|
||||
Returns a list of default values to be used as properties for the item.
|
||||
*/
|
||||
|
||||
QT_END_NAMESPACE
|
||||
137
third/designer/lib/sdk/abstractwidgetdatabase.h
Normal file
@@ -0,0 +1,137 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef ABSTRACTWIDGETDATABASE_H
|
||||
#define ABSTRACTWIDGETDATABASE_H
|
||||
|
||||
#include <QtDesigner/sdk_global.h>
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QList>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QIcon;
|
||||
class QString;
|
||||
class QDesignerFormEditorInterface;
|
||||
class QDebug;
|
||||
|
||||
class QDesignerWidgetDataBaseItemInterface
|
||||
{
|
||||
public:
|
||||
virtual ~QDesignerWidgetDataBaseItemInterface() {}
|
||||
|
||||
virtual QString name() const = 0;
|
||||
virtual void setName(const QString &name) = 0;
|
||||
|
||||
virtual QString group() const = 0;
|
||||
virtual void setGroup(const QString &group) = 0;
|
||||
|
||||
virtual QString toolTip() const = 0;
|
||||
virtual void setToolTip(const QString &toolTip) = 0;
|
||||
|
||||
virtual QString whatsThis() const = 0;
|
||||
virtual void setWhatsThis(const QString &whatsThis) = 0;
|
||||
|
||||
virtual QString includeFile() const = 0;
|
||||
virtual void setIncludeFile(const QString &includeFile) = 0;
|
||||
|
||||
virtual QIcon icon() const = 0;
|
||||
virtual void setIcon(const QIcon &icon) = 0;
|
||||
|
||||
virtual bool isCompat() const = 0;
|
||||
virtual void setCompat(bool compat) = 0;
|
||||
|
||||
virtual bool isContainer() const = 0;
|
||||
virtual void setContainer(bool container) = 0;
|
||||
|
||||
virtual bool isCustom() const = 0;
|
||||
virtual void setCustom(bool custom) = 0;
|
||||
|
||||
virtual QString pluginPath() const = 0;
|
||||
virtual void setPluginPath(const QString &path) = 0;
|
||||
|
||||
virtual bool isPromoted() const = 0;
|
||||
virtual void setPromoted(bool b) = 0;
|
||||
|
||||
virtual QString extends() const = 0;
|
||||
virtual void setExtends(const QString &s) = 0;
|
||||
|
||||
virtual void setDefaultPropertyValues(const QList<QVariant> &list) = 0;
|
||||
virtual QList<QVariant> defaultPropertyValues() const = 0;
|
||||
};
|
||||
|
||||
class QDESIGNER_SDK_EXPORT QDesignerWidgetDataBaseInterface: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QDesignerWidgetDataBaseInterface(QObject *parent = 0);
|
||||
virtual ~QDesignerWidgetDataBaseInterface();
|
||||
|
||||
virtual int count() const;
|
||||
virtual QDesignerWidgetDataBaseItemInterface *item(int index) const;
|
||||
|
||||
virtual int indexOf(QDesignerWidgetDataBaseItemInterface *item) const;
|
||||
virtual void insert(int index, QDesignerWidgetDataBaseItemInterface *item);
|
||||
virtual void append(QDesignerWidgetDataBaseItemInterface *item);
|
||||
|
||||
virtual int indexOfObject(QObject *object, bool resolveName = true) const;
|
||||
virtual int indexOfClassName(const QString &className, bool resolveName = true) const;
|
||||
|
||||
virtual QDesignerFormEditorInterface *core() const;
|
||||
|
||||
bool isContainer(QObject *object, bool resolveName = true) const;
|
||||
bool isCustom(QObject *object, bool resolveName = true) const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void changed();
|
||||
|
||||
protected:
|
||||
QList<QDesignerWidgetDataBaseItemInterface *> m_items;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // ABSTRACTWIDGETDATABASE_H
|
||||
112
third/designer/lib/sdk/abstractwidgetfactory.cpp
Normal file
@@ -0,0 +1,112 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtDesigner/abstractwidgetfactory.h>
|
||||
#include "abstractformeditor.h"
|
||||
#include "abstractwidgetdatabase.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*!
|
||||
\class QDesignerWidgetFactoryInterface
|
||||
\brief The QDesignerWidgetFactoryInterface class provides an interface that is used to control
|
||||
the widget factory used by Qt Designer.
|
||||
\inmodule QtDesigner
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QDesignerWidgetFactoryInterface::QDesignerWidgetFactoryInterface(QObject *parent)
|
||||
|
||||
Constructs an interface to a widget factory with the given \a parent.
|
||||
*/
|
||||
QDesignerWidgetFactoryInterface::QDesignerWidgetFactoryInterface(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn virtual QDesignerWidgetFactoryInterface::~QDesignerWidgetFactoryInterface()
|
||||
*/
|
||||
QDesignerWidgetFactoryInterface::~QDesignerWidgetFactoryInterface()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn virtual QDesignerFormEditorInterface *QDesignerWidgetFactoryInterface::core() const = 0
|
||||
|
||||
Returns the core form editor interface associated with this interface.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QWidget* QDesignerWidgetFactoryInterface::containerOfWidget(QWidget *child) const = 0
|
||||
|
||||
Returns the widget that contains the specified \a child widget.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QWidget* QDesignerWidgetFactoryInterface::widgetOfContainer(QWidget *container) const = 0
|
||||
|
||||
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QWidget *QDesignerWidgetFactoryInterface::createWidget(const QString &name, QWidget *parent) const = 0
|
||||
|
||||
Returns a new widget with the given \a name and \a parent widget. If no parent is specified,
|
||||
the widget created will be a top-level widget.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QLayout *QDesignerWidgetFactoryInterface::createLayout(QWidget *widget, QLayout *layout, int type) const = 0
|
||||
|
||||
Returns a new layout of the specified \a type for the given \a widget or \a layout.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual bool QDesignerWidgetFactoryInterface::isPassiveInteractor(QWidget *widget) = 0
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerWidgetFactoryInterface::initialize(QObject *object) const = 0
|
||||
*/
|
||||
|
||||
QT_END_NAMESPACE
|
||||
79
third/designer/lib/sdk/abstractwidgetfactory.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef ABSTRACTWIDGETFACTORY_H
|
||||
#define ABSTRACTWIDGETFACTORY_H
|
||||
|
||||
#include <QtDesigner/sdk_global.h>
|
||||
#include <QtCore/QObject>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QDesignerFormEditorInterface;
|
||||
class QWidget;
|
||||
class QLayout;
|
||||
|
||||
class QDESIGNER_SDK_EXPORT QDesignerWidgetFactoryInterface: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QDesignerWidgetFactoryInterface(QObject *parent = 0);
|
||||
virtual ~QDesignerWidgetFactoryInterface();
|
||||
|
||||
virtual QDesignerFormEditorInterface *core() const = 0;
|
||||
|
||||
virtual QWidget* containerOfWidget(QWidget *w) const = 0;
|
||||
virtual QWidget* widgetOfContainer(QWidget *w) const = 0;
|
||||
|
||||
virtual QWidget *createWidget(const QString &name, QWidget *parentWidget = 0) const = 0;
|
||||
virtual QLayout *createLayout(QWidget *widget, QLayout *layout, int type) const = 0;
|
||||
|
||||
virtual bool isPassiveInteractor(QWidget *widget) = 0;
|
||||
virtual void initialize(QObject *object) const = 0;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // ABSTRACTWIDGETFACTORY_H
|
||||
81
third/designer/lib/sdk/dynamicpropertysheet.h
Normal file
@@ -0,0 +1,81 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of Qt Designer. This header
|
||||
// file may change from version to version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#ifndef DYNAMICPROPERTYSHEET_H
|
||||
#define DYNAMICPROPERTYSHEET_H
|
||||
|
||||
#include <QtDesigner/extension.h>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QString; // FIXME: fool syncqt
|
||||
|
||||
class QDesignerDynamicPropertySheetExtension
|
||||
{
|
||||
public:
|
||||
virtual ~QDesignerDynamicPropertySheetExtension() {}
|
||||
|
||||
virtual bool dynamicPropertiesAllowed() const = 0;
|
||||
virtual int addDynamicProperty(const QString &propertyName, const QVariant &value) = 0;
|
||||
virtual bool removeDynamicProperty(int index) = 0;
|
||||
virtual bool isDynamicProperty(int index) const = 0;
|
||||
virtual bool canAddDynamicProperty(const QString &propertyName) const = 0;
|
||||
};
|
||||
Q_DECLARE_EXTENSION_INTERFACE(QDesignerDynamicPropertySheetExtension, "com.trolltech.Qt.Designer.DynamicPropertySheet")
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // DYNAMICPROPERTYSHEET_H
|
||||
80
third/designer/lib/sdk/dynamicpropertysheet.qdoc
Normal file
@@ -0,0 +1,80 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the documentation of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:FDL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in a
|
||||
** written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Free Documentation License
|
||||
** Alternatively, this file may be used under the terms of the GNU Free
|
||||
** Documentation License version 1.3 as published by the Free Software
|
||||
** Foundation and appearing in the file included in the packaging of this
|
||||
** file.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
/*!
|
||||
\class QDesignerDynamicPropertySheetExtension
|
||||
|
||||
\brief The QDesignerDynamicPropertySheetExtension class allows you to
|
||||
manipulate a widget's dynamic properties in Qt Designer's property editor.
|
||||
|
||||
\sa QDesignerPropertySheetExtension, {QObject#Dynamic Properties}{Dynamic Properties}
|
||||
|
||||
\inmodule QtDesigner
|
||||
\since 4.3
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QDesignerDynamicPropertySheetExtension::~QDesignerDynamicPropertySheetExtension()
|
||||
|
||||
Destroys the dynamic property sheet extension.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool QDesignerDynamicPropertySheetExtension::dynamicPropertiesAllowed() const
|
||||
|
||||
Returns true if the widget supports dynamic properties; otherwise returns false.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int QDesignerDynamicPropertySheetExtension::addDynamicProperty(const QString &propertyName, const QVariant &value)
|
||||
|
||||
Adds a dynamic property named \a propertyName and sets its value to \a value.
|
||||
Returns the index of the property if it was added successfully; otherwise returns -1 to
|
||||
indicate failure.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool QDesignerDynamicPropertySheetExtension::removeDynamicProperty(int index)
|
||||
|
||||
Removes the dynamic property at the given \a index.
|
||||
Returns true if the operation succeeds; otherwise returns false.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool QDesignerDynamicPropertySheetExtension::isDynamicProperty(int index) const
|
||||
|
||||
Returns true if the property at the given \a index is a dynamic property; otherwise
|
||||
returns false.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool QDesignerDynamicPropertySheetExtension::canAddDynamicProperty(const QString &propertyName) const
|
||||
|
||||
Returns true if \a propertyName is a valid, unique name for a dynamic
|
||||
property; otherwise returns false.
|
||||
|
||||
*/
|
||||
116
third/designer/lib/sdk/extrainfo.cpp
Normal file
@@ -0,0 +1,116 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "extrainfo.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*!
|
||||
\class QDesignerExtraInfoExtension
|
||||
\brief The QDesignerExtraInfoExtension class provides extra information about a widget in
|
||||
Qt Designer.
|
||||
\inmodule QtDesigner
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
Returns the path to the working directory used by this extension.*/
|
||||
QString QDesignerExtraInfoExtension::workingDirectory() const
|
||||
{
|
||||
return m_workingDirectory;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the path to the working directory used by the extension to \a workingDirectory.*/
|
||||
void QDesignerExtraInfoExtension::setWorkingDirectory(const QString &workingDirectory)
|
||||
{
|
||||
m_workingDirectory = workingDirectory;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn virtual QDesignerExtraInfoExtension::~QDesignerExtraInfoExtension()
|
||||
|
||||
Destroys the extension.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QDesignerFormEditorInterface *QDesignerExtraInfoExtension::core() const = 0
|
||||
|
||||
\omit
|
||||
### Description required
|
||||
\endomit
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QWidget *QDesignerExtraInfoExtension::widget() const = 0
|
||||
|
||||
Returns the widget described by this extension.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual bool QDesignerExtraInfoExtension::saveUiExtraInfo(DomUI *ui) = 0
|
||||
|
||||
Saves the information about the user interface specified by \a ui, and returns true if
|
||||
successful; otherwise returns false.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual bool QDesignerExtraInfoExtension::loadUiExtraInfo(DomUI *ui) = 0
|
||||
|
||||
Loads extra information about the user interface specified by \a ui, and returns true if
|
||||
successful; otherwise returns false.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual bool QDesignerExtraInfoExtension::saveWidgetExtraInfo(DomWidget *widget) = 0
|
||||
|
||||
Saves the information about the specified \a widget, and returns true if successful;
|
||||
otherwise returns false.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual bool QDesignerExtraInfoExtension::loadWidgetExtraInfo(DomWidget *widget) = 0
|
||||
|
||||
Loads extra information about the specified \a widget, and returns true if successful;
|
||||
otherwise returns false.
|
||||
*/
|
||||
|
||||
QT_END_NAMESPACE
|
||||
84
third/designer/lib/sdk/extrainfo.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef EXTRAINFO_H
|
||||
#define EXTRAINFO_H
|
||||
|
||||
#include <QtDesigner/sdk_global.h>
|
||||
#include <QtDesigner/extension.h>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class DomWidget;
|
||||
class DomUI;
|
||||
class QWidget;
|
||||
|
||||
class QDesignerFormEditorInterface;
|
||||
|
||||
class QDESIGNER_SDK_EXPORT QDesignerExtraInfoExtension
|
||||
{
|
||||
public:
|
||||
virtual ~QDesignerExtraInfoExtension() {}
|
||||
|
||||
virtual QDesignerFormEditorInterface *core() const = 0;
|
||||
virtual QWidget *widget() const = 0;
|
||||
|
||||
virtual bool saveUiExtraInfo(DomUI *ui) = 0;
|
||||
virtual bool loadUiExtraInfo(DomUI *ui) = 0;
|
||||
|
||||
virtual bool saveWidgetExtraInfo(DomWidget *ui_widget) = 0;
|
||||
virtual bool loadWidgetExtraInfo(DomWidget *ui_widget) = 0;
|
||||
|
||||
QString workingDirectory() const;
|
||||
void setWorkingDirectory(const QString &workingDirectory);
|
||||
|
||||
private:
|
||||
QString m_workingDirectory;
|
||||
};
|
||||
Q_DECLARE_EXTENSION_INTERFACE(QDesignerExtraInfoExtension, "com.trolltech.Qt.Designer.ExtraInfo.2")
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // EXTRAINFO_H
|
||||
99
third/designer/lib/sdk/layoutdecoration.h
Normal file
@@ -0,0 +1,99 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef LAYOUTDECORATION_H
|
||||
#define LAYOUTDECORATION_H
|
||||
|
||||
#include <QtDesigner/extension.h>
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QPair>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QPoint;
|
||||
class QLayoutItem;
|
||||
class QWidget;
|
||||
class QRect;
|
||||
class QLayout;
|
||||
|
||||
class QDesignerLayoutDecorationExtension
|
||||
{
|
||||
public:
|
||||
enum InsertMode
|
||||
{
|
||||
InsertWidgetMode,
|
||||
InsertRowMode,
|
||||
InsertColumnMode
|
||||
};
|
||||
|
||||
virtual ~QDesignerLayoutDecorationExtension() {}
|
||||
|
||||
virtual QList<QWidget*> widgets(QLayout *layout) const = 0;
|
||||
|
||||
virtual QRect itemInfo(int index) const = 0;
|
||||
virtual int indexOf(QWidget *widget) const = 0;
|
||||
virtual int indexOf(QLayoutItem *item) const = 0;
|
||||
|
||||
virtual InsertMode currentInsertMode() const = 0;
|
||||
virtual int currentIndex() const = 0;
|
||||
virtual QPair<int, int> currentCell() const = 0;
|
||||
virtual void insertWidget(QWidget *widget, const QPair<int, int> &cell) = 0;
|
||||
virtual void removeWidget(QWidget *widget) = 0;
|
||||
|
||||
virtual void insertRow(int row) = 0;
|
||||
virtual void insertColumn(int column) = 0;
|
||||
virtual void simplify() = 0;
|
||||
|
||||
virtual int findItemAt(const QPoint &pos) const = 0;
|
||||
virtual int findItemAt(int row, int column) const = 0; // atm only for grid.
|
||||
|
||||
virtual void adjustIndicator(const QPoint &pos, int index) = 0;
|
||||
};
|
||||
Q_DECLARE_EXTENSION_INTERFACE(QDesignerLayoutDecorationExtension, "com.trolltech.Qt.Designer.LayoutDecoration")
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // LAYOUTDECORATION_H
|
||||
149
third/designer/lib/sdk/layoutdecoration.qdoc
Normal file
@@ -0,0 +1,149 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the documentation of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:FDL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in a
|
||||
** written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Free Documentation License
|
||||
** Alternatively, this file may be used under the terms of the GNU Free
|
||||
** Documentation License version 1.3 as published by the Free Software
|
||||
** Foundation and appearing in the file included in the packaging of this
|
||||
** file.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
/*!
|
||||
\class QDesignerLayoutDecorationExtension
|
||||
\brief The QDesignerLayoutDecorationExtension class provides an extension to a layout in \QD.
|
||||
\inmodule QtDesigner
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum QDesignerLayoutDecorationExtension::InsertMode
|
||||
|
||||
This enum describes the modes that are used to insert items into a layout.
|
||||
|
||||
\value InsertWidgetMode Widgets are inserted into empty cells in a layout.
|
||||
\value InsertRowMode Whole rows are inserted into a vertical or grid layout.
|
||||
\value InsertColumnMode Whole columns are inserted into a horizontal or grid layout.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QDesignerLayoutDecorationExtension::~QDesignerLayoutDecorationExtension()
|
||||
|
||||
Destroys the extension.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QList<QWidget*> QDesignerLayoutDecorationExtension::widgets(QLayout *layout) const
|
||||
|
||||
Returns the widgets that are managed by the given \a layout.
|
||||
|
||||
\sa insertWidget(), removeWidget()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QRect QDesignerLayoutDecorationExtension::itemInfo(int index) const
|
||||
|
||||
Returns the rectangle covered by the item at the given \a index in the layout.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int QDesignerLayoutDecorationExtension::indexOf(QWidget *widget) const
|
||||
|
||||
Returns the index of the specified \a widget in the layout.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int QDesignerLayoutDecorationExtension::indexOf(QLayoutItem *item) const
|
||||
|
||||
Returns the index of the specified layout \a item.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QDesignerLayoutDecorationExtension::InsertMode QDesignerLayoutDecorationExtension::currentInsertMode() const
|
||||
|
||||
Returns the current insertion mode.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int QDesignerLayoutDecorationExtension::currentIndex() const
|
||||
|
||||
Returns the current index in the layout.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QPair<int, int> QDesignerLayoutDecorationExtension::currentCell() const
|
||||
|
||||
Returns a pair containing the row and column of the current cell in the layout.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerLayoutDecorationExtension::insertWidget(QWidget *widget, const QPair<int, int> &cell)
|
||||
|
||||
Inserts the given \a widget into the specified \a cell in the layout.
|
||||
|
||||
\sa removeWidget()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerLayoutDecorationExtension::removeWidget(QWidget *widget)
|
||||
|
||||
Removes the specified \a widget from the layout.
|
||||
|
||||
\sa insertWidget()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerLayoutDecorationExtension::insertRow(int row)
|
||||
|
||||
Inserts a new row into the form at the position specified by \a row.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerLayoutDecorationExtension::insertColumn(int column)
|
||||
|
||||
Inserts a new column into the form at the position specified by \a column.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerLayoutDecorationExtension::simplify()
|
||||
|
||||
Simplifies the layout by removing unnecessary empty rows and columns, and by changing the
|
||||
number of rows or columns spanned by widgets.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int QDesignerLayoutDecorationExtension::findItemAt(const QPoint &position) const
|
||||
|
||||
Returns the index of the item in the layout that covers the given \a position.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int QDesignerLayoutDecorationExtension::findItemAt(int row, int column) const
|
||||
|
||||
Returns the item in the layout that occupies the specified \a row and \a column in the layout.
|
||||
|
||||
Currently, this only applies to grid layouts.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerLayoutDecorationExtension::adjustIndicator(const QPoint &position, int index)
|
||||
|
||||
Adjusts the indicator for the item specified by \a index so that
|
||||
it lies at the given \a position on the form.
|
||||
*/
|
||||
89
third/designer/lib/sdk/membersheet.h
Normal file
@@ -0,0 +1,89 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef MEMBERSHEET_H
|
||||
#define MEMBERSHEET_H
|
||||
|
||||
#include <QtDesigner/extension.h>
|
||||
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QByteArray>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QString; // FIXME: fool syncqt
|
||||
|
||||
class QDesignerMemberSheetExtension
|
||||
{
|
||||
public:
|
||||
virtual ~QDesignerMemberSheetExtension() {}
|
||||
|
||||
virtual int count() const = 0;
|
||||
|
||||
virtual int indexOf(const QString &name) const = 0;
|
||||
|
||||
virtual QString memberName(int index) const = 0;
|
||||
virtual QString memberGroup(int index) const = 0;
|
||||
virtual void setMemberGroup(int index, const QString &group) = 0;
|
||||
|
||||
virtual bool isVisible(int index) const = 0;
|
||||
virtual void setVisible(int index, bool b) = 0;
|
||||
|
||||
virtual bool isSignal(int index) const = 0;
|
||||
virtual bool isSlot(int index) const = 0;
|
||||
|
||||
virtual bool inheritedFromWidget(int index) const = 0;
|
||||
|
||||
virtual QString declaredInClass(int index) const = 0;
|
||||
|
||||
virtual QString signature(int index) const = 0;
|
||||
virtual QList<QByteArray> parameterTypes(int index) const = 0;
|
||||
virtual QList<QByteArray> parameterNames(int index) const = 0;
|
||||
};
|
||||
Q_DECLARE_EXTENSION_INTERFACE(QDesignerMemberSheetExtension, "com.trolltech.Qt.Designer.MemberSheet")
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // MEMBERSHEET_H
|
||||
249
third/designer/lib/sdk/membersheet.qdoc
Normal file
@@ -0,0 +1,249 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the documentation of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:FDL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in a
|
||||
** written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Free Documentation License
|
||||
** Alternatively, this file may be used under the terms of the GNU Free
|
||||
** Documentation License version 1.3 as published by the Free Software
|
||||
** Foundation and appearing in the file included in the packaging of this
|
||||
** file.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
/*!
|
||||
\class QDesignerMemberSheetExtension
|
||||
|
||||
\brief The QDesignerMemberSheetExtension class allows you to
|
||||
manipulate a widget's member functions which is displayed when
|
||||
configuring connections using Qt Designer's mode for editing
|
||||
signals and slots.
|
||||
|
||||
\inmodule QtDesigner
|
||||
|
||||
QDesignerMemberSheetExtension is a collection of functions that is
|
||||
typically used to query a widget's member functions, and to
|
||||
manipulate the member functions' appearance in \QD's signals and
|
||||
slots editing mode. For example:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_qtdesigner.qdoc 2
|
||||
|
||||
When implementing a custom widget plugin, a pointer to \QD's
|
||||
current QDesignerFormEditorInterface object (\c formEditor in the
|
||||
example above) is provided by the
|
||||
QDesignerCustomWidgetInterface::initialize() function's parameter.
|
||||
|
||||
The member sheet (and any other extension), can be retrieved by
|
||||
querying \QD's extension manager using the qt_extension()
|
||||
function. When you want to release the extension, you only need to
|
||||
delete the pointer.
|
||||
|
||||
All widgets have a default member sheet used in \QD's signals and
|
||||
slots editing mode with the widget's member functions. But
|
||||
QDesignerMemberSheetExtension also provides an interface for
|
||||
creating custom member sheet extensions.
|
||||
|
||||
\warning \QD uses the QDesignerMemberSheetExtension to facilitate
|
||||
the signal and slot editing mode. Whenever a connection between
|
||||
two widgets is requested, \QD will query for the widgets' member
|
||||
sheet extensions. If a widget has an implemented member sheet
|
||||
extension, this extension will override the default member sheet.
|
||||
|
||||
To create a member sheet extension, your extension class must
|
||||
inherit from both QObject and QDesignerMemberSheetExtension. Then,
|
||||
since we are implementing an interface, we must ensure that it's
|
||||
made known to the meta object system using the Q_INTERFACES()
|
||||
macro:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_qtdesigner.qdoc 3
|
||||
|
||||
This enables \QD to use qobject_cast() to query for
|
||||
supported interfaces using nothing but a QObject pointer.
|
||||
|
||||
In \QD the extensions are not created until they are
|
||||
required. For that reason, when implementing a member sheet
|
||||
extension, you must also create a QExtensionFactory, i.e a class
|
||||
that is able to make an instance of your extension, and register
|
||||
it using \QD's \l {QExtensionManager}{extension manager}.
|
||||
|
||||
When a widget's member sheet extension is required, \QD's \l
|
||||
{QExtensionManager}{extension manager} will run through all its
|
||||
registered factories calling QExtensionFactory::createExtension()
|
||||
for each until the first one that is able to create a member sheet
|
||||
extension for that widget, is found. This factory will then make
|
||||
an instance of the extension. If no such factory is found, \QD
|
||||
will use the default member sheet.
|
||||
|
||||
There are four available types of extensions in \QD:
|
||||
QDesignerContainerExtension, QDesignerMemberSheetExtension,
|
||||
QDesignerPropertySheetExtension and
|
||||
QDesignerTaskMenuExtension. \QD's behavior is the same whether the
|
||||
requested extension is associated with a multi page container, a
|
||||
member sheet, a property sheet or a task menu.
|
||||
|
||||
The QExtensionFactory class provides a standard extension
|
||||
factory, and can also be used as an interface for custom
|
||||
extension factories. You can either create a new
|
||||
QExtensionFactory and reimplement the
|
||||
QExtensionFactory::createExtension() function. For example:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_qtdesigner.qdoc 4
|
||||
|
||||
Or you can use an existing factory, expanding the
|
||||
QExtensionFactory::createExtension() function to make the factory
|
||||
able to create a member sheet extension as well. For example:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_qtdesigner.qdoc 5
|
||||
|
||||
For a complete example using an extension class, see \l
|
||||
{designer/taskmenuextension}{Task Menu Extension example}. The
|
||||
example shows how to create a custom widget plugin for Qt
|
||||
Designer, and how to to use the QDesignerTaskMenuExtension class
|
||||
to add custom items to \QD's task menu.
|
||||
|
||||
\sa QExtensionFactory, QExtensionManager, {Creating Custom Widget
|
||||
Extensions}
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QDesignerMemberSheetExtension::~QDesignerMemberSheetExtension()
|
||||
|
||||
Destroys the member sheet extension.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int QDesignerMemberSheetExtension::count() const
|
||||
|
||||
Returns the extension's number of member functions.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int QDesignerMemberSheetExtension::indexOf(const QString &name) const
|
||||
|
||||
Returns the index of the member function specified by the given \a
|
||||
name.
|
||||
|
||||
\sa memberName()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerMemberSheetExtension::memberName(int index) const
|
||||
|
||||
Returns the name of the member function with the given \a index.
|
||||
|
||||
\sa indexOf()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerMemberSheetExtension::memberGroup(int index) const
|
||||
|
||||
Returns the name of the member group specified for the function
|
||||
with the given \a index.
|
||||
|
||||
\sa indexOf(), setMemberGroup()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerMemberSheetExtension::setMemberGroup(int index, const QString &group)
|
||||
|
||||
Sets the member group of the member function with the given \a
|
||||
index, to \a group.
|
||||
|
||||
\sa indexOf(), memberGroup()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool QDesignerMemberSheetExtension::isVisible(int index) const
|
||||
|
||||
Returns true if the member function with the given \a index is
|
||||
visible in \QD's signal and slot editor, otherwise false.
|
||||
|
||||
\sa indexOf(), setVisible()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerMemberSheetExtension::setVisible(int index, bool visible)
|
||||
|
||||
If \a visible is true, the member function with the given \a index
|
||||
is visible in \QD's signals and slots editing mode; otherwise the
|
||||
member function is hidden.
|
||||
|
||||
\sa indexOf(), isVisible()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual bool QDesignerMemberSheetExtension::isSignal(int index) const
|
||||
|
||||
Returns true if the member function with the given \a index is a
|
||||
signal, otherwise false.
|
||||
|
||||
\sa indexOf()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool QDesignerMemberSheetExtension::isSlot(int index) const
|
||||
|
||||
Returns true if the member function with the given \a index is a
|
||||
slot, otherwise false.
|
||||
|
||||
\sa indexOf()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool QDesignerMemberSheetExtension::inheritedFromWidget(int index) const
|
||||
|
||||
Returns true if the member function with the given \a index is
|
||||
inherited from QWidget, otherwise false.
|
||||
|
||||
\sa indexOf()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerMemberSheetExtension::declaredInClass(int index) const
|
||||
|
||||
Returns the name of the class in which the member function with
|
||||
the given \a index is declared.
|
||||
|
||||
\sa indexOf()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerMemberSheetExtension::signature(int index) const
|
||||
|
||||
Returns the signature of the member function with the given \a
|
||||
index.
|
||||
|
||||
\sa indexOf()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QList<QByteArray> QDesignerMemberSheetExtension::parameterTypes(int index) const
|
||||
|
||||
Returns the parameter types of the member function with the given
|
||||
\a index, as a QByteArray list.
|
||||
|
||||
\sa indexOf(), parameterNames()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QList<QByteArray> QDesignerMemberSheetExtension::parameterNames(int index) const
|
||||
|
||||
Returns the parameter names of the member function with the given
|
||||
\a index, as a QByteArray list.
|
||||
|
||||
\sa indexOf(), parameterTypes()
|
||||
*/
|
||||
90
third/designer/lib/sdk/propertysheet.h
Normal file
@@ -0,0 +1,90 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef PROPERTYSHEET_H
|
||||
#define PROPERTYSHEET_H
|
||||
|
||||
#include <QtDesigner/extension.h>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QVariant;
|
||||
|
||||
class QDesignerPropertySheetExtension
|
||||
{
|
||||
public:
|
||||
virtual ~QDesignerPropertySheetExtension() {}
|
||||
|
||||
virtual int count() const = 0;
|
||||
|
||||
virtual int indexOf(const QString &name) const = 0;
|
||||
|
||||
virtual QString propertyName(int index) const = 0;
|
||||
virtual QString propertyGroup(int index) const = 0;
|
||||
virtual void setPropertyGroup(int index, const QString &group) = 0;
|
||||
|
||||
virtual bool hasReset(int index) const = 0;
|
||||
virtual bool reset(int index) = 0;
|
||||
|
||||
virtual bool isVisible(int index) const = 0;
|
||||
virtual void setVisible(int index, bool b) = 0;
|
||||
|
||||
virtual bool isAttribute(int index) const = 0;
|
||||
virtual void setAttribute(int index, bool b) = 0;
|
||||
|
||||
virtual QVariant property(int index) const = 0;
|
||||
virtual void setProperty(int index, const QVariant &value) = 0;
|
||||
|
||||
virtual bool isChanged(int index) const = 0;
|
||||
virtual void setChanged(int index, bool changed) = 0;
|
||||
|
||||
};
|
||||
|
||||
Q_DECLARE_EXTENSION_INTERFACE(QDesignerPropertySheetExtension,
|
||||
"com.trolltech.Qt.Designer.PropertySheet")
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // PROPERTYSHEET_H
|
||||
288
third/designer/lib/sdk/propertysheet.qdoc
Normal file
@@ -0,0 +1,288 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the documentation of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:FDL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in a
|
||||
** written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Free Documentation License
|
||||
** Alternatively, this file may be used under the terms of the GNU Free
|
||||
** Documentation License version 1.3 as published by the Free Software
|
||||
** Foundation and appearing in the file included in the packaging of this
|
||||
** file.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
/*!
|
||||
\class QDesignerPropertySheetExtension
|
||||
|
||||
\brief The QDesignerPropertySheetExtension class allows you to
|
||||
manipulate a widget's properties which is displayed in Qt
|
||||
Designer's property editor.
|
||||
|
||||
\sa QDesignerDynamicPropertySheetExtension
|
||||
|
||||
\inmodule QtDesigner
|
||||
|
||||
QDesignerPropertySheetExtension provides a collection of functions that
|
||||
are typically used to query a widget's properties, and to
|
||||
manipulate the properties' appearance in the property editor. For
|
||||
example:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_qtdesigner.qdoc 15
|
||||
|
||||
Note that if you change the value of a property using the
|
||||
QDesignerPropertySheetExtension::setProperty() function, the undo
|
||||
stack is not updated. To ensure that a property's value can be
|
||||
reverted using the undo stack, you must use the
|
||||
QDesignerFormWindowCursorInterface::setProperty() function, or its
|
||||
buddy \l
|
||||
{QDesignerFormWindowCursorInterface::setWidgetProperty()}{setWidgetProperty()},
|
||||
instead.
|
||||
|
||||
When implementing a custom widget plugin, a pointer to \QD's
|
||||
current QDesignerFormEditorInterface object (\c formEditor in the
|
||||
example above) is provided by the
|
||||
QDesignerCustomWidgetInterface::initialize() function's parameter.
|
||||
|
||||
The property sheet, or any other extension, can be retrieved by
|
||||
querying \QD's extension manager using the qt_extension()
|
||||
function. When you want to release the extension, you only need to
|
||||
delete the pointer.
|
||||
|
||||
All widgets have a default property sheet which populates \QD's
|
||||
property editor with the widget's properties (i.e the ones defined
|
||||
with the Q_PROPERTY() macro). But QDesignerPropertySheetExtension
|
||||
also provides an interface for creating custom property sheet
|
||||
extensions.
|
||||
|
||||
\warning \QD uses the QDesignerPropertySheetExtension to feed its
|
||||
property editor. Whenever a widget is selected in its workspace,
|
||||
\QD will query for the widget's property sheet extension. If the
|
||||
selected widget has an implemented property sheet extension, this
|
||||
extension will override the default property sheet.
|
||||
|
||||
To create a property sheet extension, your extension class must
|
||||
inherit from both QObject and
|
||||
QDesignerPropertySheetExtension. Then, since we are implementing
|
||||
an interface, we must ensure that it's made known to the meta
|
||||
object system using the Q_INTERFACES() macro:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_qtdesigner.qdoc 16
|
||||
|
||||
This enables \QD to use qobject_cast() to query for supported
|
||||
interfaces using nothing but a QObject pointer.
|
||||
|
||||
In \QD the extensions are not created until they are
|
||||
required. For that reason, when implementing a property sheet
|
||||
extension, you must also create a QExtensionFactory, i.e a class
|
||||
that is able to make an instance of your extension, and register
|
||||
it using \QD's \l {QExtensionManager}{extension manager}.
|
||||
|
||||
When a property sheet extension is required, \QD's \l
|
||||
{QExtensionManager}{extension manager} will run through all its
|
||||
registered factories calling QExtensionFactory::createExtension()
|
||||
for each until the first one that is able to create a property
|
||||
sheet extension for the selected widget, is found. This factory
|
||||
will then make an instance of the extension. If no such factory
|
||||
can be found, \QD will use the default property sheet.
|
||||
|
||||
There are four available types of extensions in \QD:
|
||||
QDesignerContainerExtension, QDesignerMemberSheetExtension,
|
||||
QDesignerPropertySheetExtension and QDesignerTaskMenuExtension. Qt
|
||||
Designer's behavior is the same whether the requested extension is
|
||||
associated with a multi page container, a member sheet, a property
|
||||
sheet or a task menu.
|
||||
|
||||
The QExtensionFactory class provides a standard extension factory,
|
||||
and can also be used as an interface for custom extension
|
||||
factories. You can either create a new QExtensionFactory and
|
||||
reimplement the QExtensionFactory::createExtension() function. For
|
||||
example:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_qtdesigner.qdoc 17
|
||||
|
||||
Or you can use an existing factory, expanding the
|
||||
QExtensionFactory::createExtension() function to make the factory
|
||||
able to create a property sheet extension extension as well. For
|
||||
example:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_qtdesigner.qdoc 18
|
||||
|
||||
For a complete example using an extension class, see the \l
|
||||
{designer/taskmenuextension}{Task Menu Extension example}. The
|
||||
example shows how to create a custom widget plugin for Qt
|
||||
Designer, and how to to use the QDesignerTaskMenuExtension class
|
||||
to add custom items to \QD's task menu.
|
||||
|
||||
\sa QExtensionFactory, QExtensionManager, {Creating Custom Widget
|
||||
Extensions}
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QDesignerPropertySheetExtension::~QDesignerPropertySheetExtension()
|
||||
|
||||
Destroys the property sheet extension.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int QDesignerPropertySheetExtension::count() const
|
||||
|
||||
Returns the selected widget's number of properties.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int QDesignerPropertySheetExtension::indexOf(const QString &name) const
|
||||
|
||||
Returns the index for a given property \a name.
|
||||
|
||||
\sa propertyName()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerPropertySheetExtension::propertyName(int index) const
|
||||
|
||||
Returns the name of the property at the given \a index.
|
||||
|
||||
\sa indexOf()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QDesignerPropertySheetExtension::propertyGroup(int index) const
|
||||
|
||||
Returns the property group for the property at the given \a index.
|
||||
|
||||
\QD's property editor supports property groups, i.e. sections of
|
||||
related properties. A property can be related to a group using the
|
||||
setPropertyGroup() function. The default group of any property is
|
||||
the name of the class that defines it. For example, the
|
||||
QObject::objectName property appears within the QObject property
|
||||
group.
|
||||
|
||||
\sa indexOf(), setPropertyGroup()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerPropertySheetExtension::setPropertyGroup(int index, const QString &group)
|
||||
|
||||
Sets the property group for the property at the given \a index to
|
||||
\a group.
|
||||
|
||||
Relating a property to a group makes it appear within that group's
|
||||
section in the property editor. The default property group of any
|
||||
property is the name of the class that defines it. For example,
|
||||
the QObject::objectName property appears within the QObject
|
||||
property group.
|
||||
|
||||
\sa indexOf(), property(), propertyGroup()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool QDesignerPropertySheetExtension::hasReset(int index) const
|
||||
|
||||
Returns true if the property at the given \a index has a reset
|
||||
button in \QD's property editor, otherwise false.
|
||||
|
||||
\sa indexOf(), reset()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool QDesignerPropertySheetExtension::reset(int index)
|
||||
|
||||
Resets the value of the property at the given \a index, to the
|
||||
default value. Returns true if a default value could be found, otherwise false.
|
||||
|
||||
\sa indexOf(), hasReset(), isChanged()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool QDesignerPropertySheetExtension::isVisible(int index) const
|
||||
|
||||
Returns true if the property at the given \a index is visible in
|
||||
\QD's property editor, otherwise false.
|
||||
|
||||
\sa indexOf(), setVisible()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerPropertySheetExtension::setVisible(int index, bool visible)
|
||||
|
||||
If \a visible is true, the property at the given \a index is
|
||||
visible in \QD's property editor; otherwise the property is
|
||||
hidden.
|
||||
|
||||
\sa indexOf(), isVisible()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool QDesignerPropertySheetExtension::isAttribute(int index) const
|
||||
|
||||
Returns true if the property at the given \a index is an attribute,
|
||||
which will be \e excluded from the UI file, otherwise false.
|
||||
|
||||
\sa indexOf(), setAttribute()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerPropertySheetExtension::setAttribute(int index, bool attribute)
|
||||
|
||||
If \a attribute is true, the property at the given \a index is
|
||||
made an attribute which will be \e excluded from the UI file;
|
||||
otherwise it will be included.
|
||||
|
||||
\sa indexOf(), isAttribute()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QVariant QDesignerPropertySheetExtension::property(int index) const
|
||||
|
||||
Returns the value of the property at the given \a index.
|
||||
|
||||
\sa indexOf(), setProperty(), propertyGroup()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerPropertySheetExtension::setProperty(int index, const QVariant &value)
|
||||
|
||||
Sets the \a value of the property at the given \a index.
|
||||
|
||||
\warning If you change the value of a property using this
|
||||
function, the undo stack is not updated. To ensure that a
|
||||
property's value can be reverted using the undo stack, you must
|
||||
use the QDesignerFormWindowCursorInterface::setProperty()
|
||||
function, or its buddy \l
|
||||
{QDesignerFormWindowCursorInterface::setWidgetProperty()}{setWidgetProperty()},
|
||||
instead.
|
||||
|
||||
\sa indexOf(), property(), propertyGroup()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool QDesignerPropertySheetExtension::isChanged(int index) const
|
||||
|
||||
Returns true if the value of the property at the given \a index
|
||||
differs from the property's default value, otherwise false.
|
||||
|
||||
\sa indexOf(), setChanged(), reset()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDesignerPropertySheetExtension::setChanged(int index, bool changed)
|
||||
|
||||
Sets whether the property at the given \a index is different from
|
||||
its default value, or not, depending on the \a changed parameter.
|
||||
|
||||
\sa indexOf(), isChanged()
|
||||
*/
|
||||
109
third/designer/lib/sdk/script.cpp
Normal file
@@ -0,0 +1,109 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "script_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*!
|
||||
\class QDesignerScriptExtension
|
||||
\brief The QDesignerScriptExtension class allows you to generate a
|
||||
per-widget \l{QtScript} {Qt Script} snippet to be executed while
|
||||
building the form.
|
||||
|
||||
\internal
|
||||
\inmodule QtDesigner
|
||||
\since 4.3
|
||||
|
||||
On saving the form, the extension is queried for a script snippet
|
||||
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.
|
||||
|
||||
As opposed to \l QDesignerCustomWidgetInterface::codeTemplate(),
|
||||
it allows for applying an internal state of the widget
|
||||
that can be manipulated using \QD.
|
||||
|
||||
Such a state might for example be the contents of a custom item view widget,
|
||||
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 UI file. This is
|
||||
handled by data() and setData().
|
||||
|
||||
For item view contents, there might be for example a key that determines
|
||||
the number of items and other keys that contain the actual items following
|
||||
a naming scheme (\c numItems, \c item1, \c item2, ...).
|
||||
|
||||
On saving, script() is invoked, which should return a script snippet that
|
||||
applies the state to the widget while building the form.
|
||||
|
||||
\sa {Creating Custom Widgets for Qt Designer#Using Qt Script to Aid in Building Forms}{Creating Custom Widgets for Qt Designer}, QtScript
|
||||
*/
|
||||
|
||||
/*!
|
||||
Destroys the extension.
|
||||
*/
|
||||
|
||||
QDesignerScriptExtension::~QDesignerScriptExtension()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn virtual QString QDesignerScriptExtension::script() const
|
||||
|
||||
Returns a script snippet to be associated with the widget.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QVariantMap QDesignerScriptExtension::data() const
|
||||
|
||||
Returns a map of variants describing the internal state to be
|
||||
stored in the UI file.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void QDesignerScriptExtension::setData(const QVariantMap &data)
|
||||
|
||||
Applies the internal state stored in \a data to the widget while loading a form.
|
||||
*/
|
||||
|
||||
QT_END_NAMESPACE
|
||||
83
third/designer/lib/sdk/script_p.h
Normal file
@@ -0,0 +1,83 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Designer of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of Qt Designer. This header
|
||||
// file may change from version to version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#ifndef SCRIPT_H
|
||||
#define SCRIPT_H
|
||||
|
||||
#include <QtDesigner/sdk_global.h>
|
||||
#include <QtDesigner/extension.h>
|
||||
#include <QtCore/QVariant>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QString; // FIXME: fool syncqt
|
||||
|
||||
class QDESIGNER_SDK_EXPORT QDesignerScriptExtension
|
||||
{
|
||||
public:
|
||||
virtual ~QDesignerScriptExtension();
|
||||
|
||||
virtual QVariantMap data() const = 0;
|
||||
virtual void setData(const QVariantMap &data) = 0;
|
||||
|
||||
virtual QString script() const = 0;
|
||||
|
||||
};
|
||||
Q_DECLARE_EXTENSION_INTERFACE(QDesignerScriptExtension, "com.trolltech.Qt.Designer.Script")
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // SCRIPT_H
|
||||