Merge remote branch 'origin/2.0'
Conflicts: src/plugins/texteditor/texteditoractionhandler.cpp
2
dist/changes-2.0.0
vendored
@@ -34,6 +34,8 @@ Editing
|
||||
* Fixed auto indent for C style coments
|
||||
* Copying text from the editor now supports HTML mime type, preserving
|
||||
the syntax highlighting.
|
||||
* Block selection defines a find & replace scope
|
||||
* Added customizable default file encoding (in addition to the project setting)
|
||||
|
||||
CodePaster
|
||||
* Implemented new protocol of pastebin.com including list functionality
|
||||
|
||||
BIN
doc/images/qmldesigner-code-completion.png
Normal file
|
After Width: | Height: | Size: 5.3 KiB |
BIN
doc/images/qmldesigner-run-custom-exe.png
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
doc/images/qmldesigner-run-settings.png
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
doc/images/qtcreator-build-dependencies.png
Normal file
|
After Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 21 KiB |
BIN
doc/images/qtcreator-build-steps.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
doc/images/qtcreator-clean-steps.png
Normal file
|
After Width: | Height: | Size: 7.0 KiB |
BIN
doc/images/qtcreator-editor-settings.png
Normal file
|
After Width: | Height: | Size: 41 KiB |
BIN
doc/images/qtcreator-maemo-emulator-button.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
doc/images/qtcreator-maemo-emulator-connection-key.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
doc/images/qtcreator-maemo-emulator-connection.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 91 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 22 KiB |
BIN
doc/images/qtcreator-ssh-key-configuration.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
@@ -17608,7 +17608,7 @@ Sie können die Änderungen in einem Stash ablegen oder rücksetzen.</translatio
|
||||
<message>
|
||||
<location filename="../../../src/plugins/debugger/cdb/coreengine.cpp" line="+54"/>
|
||||
<source>Unable to load the debugger engine library '%1': %2</source>
|
||||
<translation>Die Debugger-Bibliothek konnte '%1' nicht geladen werden: %2</translation>
|
||||
<translation>Die Debugger-Bibliothek '%1' konnte nicht geladen werden: %2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+163"/>
|
||||
|
||||
2
src/libs/3rdparty/net7ssh/src/src.pro
vendored
@@ -12,7 +12,7 @@ include(../net7ssh_dependencies.pri)
|
||||
|
||||
win32 {
|
||||
LIBS += -lWs2_32
|
||||
win32-msvc*: QMAKE_CXXFLAGS += -wd4250 -wd4251 -wd4290
|
||||
win32-msvc*: QMAKE_CXXFLAGS += -wd4100 -wd4101 -wd4250 -wd4251 -wd4290
|
||||
|
||||
DEFINES += _CRT_SECURE_NO_WARNINGS
|
||||
DEFINES += NE7SSH_EXPORTS=1 _WINDLL _USRDLL _CONSOLE _WINDOWS
|
||||
|
||||
@@ -38,10 +38,34 @@
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
FadingPanel::FadingPanel(QWidget *parent) : QWidget(parent), m_opacityEffect(0)
|
||||
|
||||
{
|
||||
m_opacityEffect = new QGraphicsOpacityEffect;
|
||||
m_opacityEffect->setOpacity(0);
|
||||
setGraphicsEffect(m_opacityEffect);
|
||||
|
||||
// Workaround for issue with QGraphicsEffect. GraphicsEffect
|
||||
// currently clears with Window color. Remove if flickering
|
||||
// no longer occurs on fade-in
|
||||
QPalette pal;
|
||||
pal.setBrush(QPalette::All, QPalette::Window, Qt::transparent);
|
||||
setPalette(pal);
|
||||
}
|
||||
|
||||
void FadingPanel::fadeTo(float value)
|
||||
{
|
||||
QPropertyAnimation *animation = new QPropertyAnimation(m_opacityEffect, "opacity");
|
||||
animation->setDuration(200);
|
||||
animation->setEndValue(value);
|
||||
animation->start(QAbstractAnimation::DeleteWhenStopped);
|
||||
}
|
||||
|
||||
DetailsButton::DetailsButton(QWidget *parent) : QAbstractButton(parent), m_fader(0)
|
||||
{
|
||||
setCheckable(true);
|
||||
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
|
||||
setText(tr("Details"));
|
||||
}
|
||||
|
||||
QSize DetailsButton::sizeHint() const
|
||||
@@ -114,7 +138,6 @@ QPixmap DetailsButton::cacheRendering(const QSize &size, bool checked)
|
||||
p.setRenderHint(QPainter::Antialiasing, true);
|
||||
p.translate(0.5, 0.5);
|
||||
p.setPen(Qt::NoPen);
|
||||
QColor color = palette().highlight().color();
|
||||
if(!checked) {
|
||||
lg.setColorAt(0, QColor(0, 0, 0, 10));
|
||||
lg.setColorAt(1, QColor(0, 0, 0, 16));
|
||||
@@ -133,12 +156,11 @@ QPixmap DetailsButton::cacheRendering(const QSize &size, bool checked)
|
||||
|
||||
p.setPen(palette().color(QPalette::Text));
|
||||
|
||||
QString text = tr("Details");
|
||||
QRect textRect = p.fontMetrics().boundingRect(text);
|
||||
QRect textRect = p.fontMetrics().boundingRect(text());
|
||||
textRect.setWidth(textRect.width() + 15);
|
||||
textRect.moveCenter(rect().center());
|
||||
|
||||
p.drawText(textRect, Qt::AlignLeft | Qt::AlignVCenter, text);
|
||||
p.drawText(textRect, Qt::AlignLeft | Qt::AlignVCenter, text());
|
||||
|
||||
int arrowsize = 15;
|
||||
QStyleOption arrowOpt;
|
||||
|
||||
@@ -31,12 +31,26 @@
|
||||
#define DETAILSBUTTON_H
|
||||
|
||||
#include <QtGui/QAbstractButton>
|
||||
#include <QtGui/QToolButton>
|
||||
#include <QtGui/QPixmap>
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QGraphicsOpacityEffect>
|
||||
#include <QtCore/QPropertyAnimation>
|
||||
|
||||
#include "utils_global.h"
|
||||
|
||||
namespace Utils {
|
||||
|
||||
class QTCREATOR_UTILS_EXPORT FadingPanel : public QWidget
|
||||
{
|
||||
public:
|
||||
FadingPanel(QWidget *parent = 0);
|
||||
void fadeTo(float value);
|
||||
protected:
|
||||
QGraphicsOpacityEffect *m_opacityEffect;
|
||||
};
|
||||
|
||||
|
||||
class QTCREATOR_UTILS_EXPORT DetailsButton : public QAbstractButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "detailsbutton.h"
|
||||
|
||||
#include <QtCore/QStack>
|
||||
#include <QtCore/QPropertyAnimation>
|
||||
|
||||
#include <QtGui/QGridLayout>
|
||||
#include <QtGui/QLabel>
|
||||
@@ -57,7 +58,7 @@ namespace Utils {
|
||||
DetailsButton *m_detailsButton;
|
||||
QGridLayout *m_grid;
|
||||
QLabel *m_summaryLabel;
|
||||
QWidget *m_toolWidget;
|
||||
Utils::FadingPanel *m_toolWidget;
|
||||
QWidget *m_widget;
|
||||
|
||||
QPixmap m_collapsedPixmap;
|
||||
@@ -210,7 +211,7 @@ namespace Utils {
|
||||
updateControls();
|
||||
}
|
||||
|
||||
void DetailsWidget::setToolWidget(QWidget *widget)
|
||||
void DetailsWidget::setToolWidget(Utils::FadingPanel *widget)
|
||||
{
|
||||
if (d->m_toolWidget == widget)
|
||||
return;
|
||||
@@ -221,7 +222,7 @@ namespace Utils {
|
||||
return;
|
||||
|
||||
d->m_toolWidget->adjustSize();
|
||||
d->m_grid->addWidget(d->m_toolWidget, 0, 0, 1, 1, Qt::AlignCenter);
|
||||
d->m_grid->addWidget(d->m_toolWidget, 0, 1, 1, 1, Qt::AlignRight);
|
||||
|
||||
d->m_grid->setColumnMinimumWidth(0, d->m_toolWidget->width());
|
||||
d->m_grid->setRowMinimumHeight(0, d->m_toolWidget->height());
|
||||
@@ -271,9 +272,11 @@ namespace Utils {
|
||||
{
|
||||
if (!d->m_toolWidget)
|
||||
return;
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
d->m_toolWidget->setVisible(hovered);
|
||||
|
||||
#else
|
||||
d->m_toolWidget->fadeTo(hovered ? 1.0 : 0);
|
||||
#endif
|
||||
d->m_hovered = hovered;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ QT_END_NAMESPACE
|
||||
namespace Utils {
|
||||
|
||||
struct DetailsWidgetPrivate;
|
||||
class FadingPanel;
|
||||
|
||||
class QTCREATOR_UTILS_EXPORT DetailsWidget : public QWidget
|
||||
{
|
||||
@@ -68,7 +69,7 @@ public:
|
||||
void setWidget(QWidget *widget);
|
||||
QWidget *widget() const;
|
||||
|
||||
void setToolWidget(QWidget *widget);
|
||||
void setToolWidget(Utils::FadingPanel *widget);
|
||||
QWidget *toolWidget() const;
|
||||
|
||||
private slots:
|
||||
|
||||
@@ -70,7 +70,7 @@ void Utils::unCommentSelection(QPlainTextEdit *edit)
|
||||
start -= 2;
|
||||
}
|
||||
|
||||
bool hasSelStart = (startPos < startText.length() - 2
|
||||
bool hasSelStart = (startPos < startText.length() - 1
|
||||
&& startText.at(startPos) == QLatin1Char('/')
|
||||
&& startText.at(startPos+1) == QLatin1Char('*'));
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
#include "cmakerunconfiguration.h"
|
||||
#include "cmakebuildconfiguration.h"
|
||||
|
||||
#include <projectexplorer/customexecutablerunconfiguration.h>
|
||||
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QStyle>
|
||||
|
||||
@@ -131,6 +133,12 @@ void CMakeTarget::updateRunConfigurations()
|
||||
CMakeRunConfiguration *rc = it.value();
|
||||
removeRunConfiguration(rc);
|
||||
}
|
||||
if (runConfigurations().isEmpty()) {
|
||||
// Oh no, no run configuration,
|
||||
// create a custom executable run configuration
|
||||
ProjectExplorer::CustomExecutableRunConfiguration *rc = new ProjectExplorer::CustomExecutableRunConfiguration(this);
|
||||
addRunConfiguration(rc);
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@@ -54,5 +54,10 @@
|
||||
<file>images/progressbar.png</file>
|
||||
<file>images/help.png</file>
|
||||
<file>images/editclear.png</file>
|
||||
<file>images/darkarrowdown.png</file>
|
||||
<file>images/darkarrowup.png</file>
|
||||
<file>images/darkclose.png</file>
|
||||
<file>images/arrowdown.png</file>
|
||||
<file>images/arrowup.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -282,6 +282,9 @@ Core::IWizard *NewDialog::showDialog()
|
||||
for (int row = 0; row < m_proxyModel->rowCount(); ++row)
|
||||
m_ui->templateCategoryView->setExpanded(m_proxyModel->index(row, 0), true);
|
||||
|
||||
// Ensure that item description is visible on first show
|
||||
currentItemChanged(m_ui->templatesView->rootIndex().child(0,0));
|
||||
|
||||
updateOkButton();
|
||||
if (exec() != Accepted)
|
||||
return 0;
|
||||
|
||||
BIN
src/plugins/coreplugin/images/arrowdown.png
Normal file
|
After Width: | Height: | Size: 362 B |
BIN
src/plugins/coreplugin/images/arrowup.png
Normal file
|
After Width: | Height: | Size: 352 B |
BIN
src/plugins/coreplugin/images/darkarrowdown.png
Normal file
|
After Width: | Height: | Size: 333 B |
BIN
src/plugins/coreplugin/images/darkarrowup.png
Normal file
|
After Width: | Height: | Size: 386 B |
BIN
src/plugins/coreplugin/images/darkclose.png
Normal file
|
After Width: | Height: | Size: 398 B |
@@ -177,7 +177,7 @@ void ModeManager::objectAdded(QObject *obj)
|
||||
ActionManager *am = d->m_mainWindow->actionManager();
|
||||
const QString shortcutId = QLatin1String("QtCreator.Mode.") + mode->id();
|
||||
QShortcut *shortcut = new QShortcut(d->m_mainWindow);
|
||||
shortcut->setWhatsThis(tr("Switch to %1 mode").arg(mode->displayName()));
|
||||
shortcut->setWhatsThis(tr("Switch to <b>%1</b> mode").arg(mode->displayName()));
|
||||
Command *cmd = am->registerShortcut(shortcut, shortcutId, QList<int>() << Constants::C_GLOBAL_ID);
|
||||
|
||||
d->m_modeShortcuts.insert(index, cmd);
|
||||
|
||||
@@ -201,7 +201,10 @@ OutputPaneManager::OutputPaneManager(QWidget *parent) :
|
||||
m_prevAction(0),
|
||||
m_lastIndex(-1),
|
||||
m_outputWidgetPane(new QStackedWidget),
|
||||
m_opToolBarWidgets(new QStackedWidget)
|
||||
m_opToolBarWidgets(new QStackedWidget),
|
||||
m_minimizeIcon(":/core/images/arrowdown.png"),
|
||||
m_maximizeIcon(":/core/images/arrowup.png"),
|
||||
m_maximised(false)
|
||||
{
|
||||
setWindowTitle(tr("Output"));
|
||||
connect(m_widgetComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(changePage()));
|
||||
@@ -221,8 +224,9 @@ OutputPaneManager::OutputPaneManager(QWidget *parent) :
|
||||
connect(m_prevAction, SIGNAL(triggered()), this, SLOT(slotPrev()));
|
||||
|
||||
m_minMaxAction = new QAction(this);
|
||||
m_minMaxAction->setText(tr("Maximize Output Pane"));
|
||||
m_minMaxButton->setArrowType(Qt::UpArrow);
|
||||
m_minMaxButton->setIcon(m_maximizeIcon);
|
||||
m_minMaxButton->setToolTip(tr("Maximize Output Pane"));
|
||||
m_minMaxAction->setText(m_minMaxButton->toolTip());
|
||||
|
||||
m_closeButton->setIcon(QIcon(":/core/images/closebutton.png"));
|
||||
connect(m_closeButton, SIGNAL(clicked()), this, SLOT(slotHide()));
|
||||
@@ -309,8 +313,8 @@ void OutputPaneManager::init()
|
||||
#endif
|
||||
cmd->setAttribute(Command::CA_UpdateText);
|
||||
mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup");
|
||||
m_minMaxButton->setDefaultAction(cmd->action());
|
||||
connect(m_minMaxAction, SIGNAL(triggered()), this, SLOT(slotMinMax()));
|
||||
connect(m_minMaxButton, SIGNAL(clicked()), this, SLOT(slotMinMax()));
|
||||
|
||||
QAction *sep = new QAction(this);
|
||||
sep->setSeparator(true);
|
||||
@@ -403,7 +407,7 @@ void OutputPaneManager::shortcutTriggered()
|
||||
|
||||
bool OutputPaneManager::isMaximized()const
|
||||
{
|
||||
return m_minMaxButton->arrowType() == Qt::DownArrow;
|
||||
return m_maximised;
|
||||
}
|
||||
|
||||
void OutputPaneManager::slotMinMax()
|
||||
@@ -412,11 +416,12 @@ void OutputPaneManager::slotMinMax()
|
||||
|
||||
if (!OutputPanePlaceHolder::m_current->isVisible()) // easier than disabling/enabling the action
|
||||
return;
|
||||
bool maximize = m_minMaxButton->arrowType() == Qt::UpArrow;
|
||||
OutputPanePlaceHolder::m_current->maximizeOrMinimize(maximize);
|
||||
m_minMaxButton->setArrowType(maximize ? Qt::DownArrow : Qt::UpArrow);
|
||||
m_minMaxAction->setToolTip(maximize ? tr("Minimize Output Pane")
|
||||
: tr("Maximize Output Pane"));
|
||||
m_maximised = !m_maximised;
|
||||
OutputPanePlaceHolder::m_current->maximizeOrMinimize(m_maximised);
|
||||
m_minMaxButton->setIcon(m_maximised ? m_minimizeIcon : m_maximizeIcon);
|
||||
m_minMaxButton->setToolTip(m_maximised ? tr("Minimize Output Pane")
|
||||
: tr("Maximize Output Pane"));
|
||||
m_minMaxAction->setText(m_minMaxButton->toolTip());
|
||||
}
|
||||
|
||||
void OutputPaneManager::buttonTriggered()
|
||||
|
||||
@@ -148,6 +148,9 @@ private:
|
||||
QWidget *m_buttonsWidget;
|
||||
QMap<int, QPushButton *> m_buttons;
|
||||
QMap<QAction *, int> m_actions;
|
||||
QPixmap m_minimizeIcon;
|
||||
QPixmap m_maximizeIcon;
|
||||
bool m_maximised;
|
||||
};
|
||||
|
||||
class OutputPaneToggleButton : public QPushButton
|
||||
|
||||
@@ -90,8 +90,8 @@ void FormEditorFactory::updateEditorInfoBar(Core::IEditor *editor)
|
||||
{
|
||||
if (qobject_cast<FormWindowEditor *>(editor)) {
|
||||
Core::EditorManager::instance()->showEditorInfoBar(Constants::INFO_READ_ONLY,
|
||||
tr("This file can only be edited in Design Mode."),
|
||||
tr("Open Designer"), this, SLOT(designerModeClicked()));
|
||||
tr("This file can only be edited in <b>Design</b> mode."),
|
||||
tr("Switch mode"), this, SLOT(designerModeClicked()));
|
||||
} else {
|
||||
Core::EditorManager::instance()->hideEditorInfoBar(Constants::INFO_READ_ONLY);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "buildstepspage.h"
|
||||
#include "buildconfiguration.h"
|
||||
#include "detailsbutton.h"
|
||||
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/icore.h>
|
||||
@@ -117,6 +118,12 @@ void BuildStepsPage::init(BuildConfiguration *bc)
|
||||
s.detailsWidget->setSummaryText(s.widget->summaryText());
|
||||
}
|
||||
updateBuildStepButtonsState();
|
||||
|
||||
static QLatin1String buttonStyle(
|
||||
"QToolButton{ border-width: 2;}"
|
||||
"QToolButton:hover{border-image: url(:/welcome/images/btn_26_hover.png) 4;}"
|
||||
"QToolButton:pressed{ border-image: url(:/welcome/images/btn_26_pressed.png) 4;}");
|
||||
setStyleSheet(buttonStyle);
|
||||
}
|
||||
|
||||
void BuildStepsPage::updateAddBuildStepMenu()
|
||||
@@ -160,30 +167,32 @@ void BuildStepsPage::addBuildStepWidget(int pos, BuildStep *step)
|
||||
s.detailsWidget->setSummaryText(s.widget->summaryText());
|
||||
s.detailsWidget->setWidget(s.widget);
|
||||
|
||||
s.upButton = new QToolButton(this);
|
||||
s.upButton->setArrowType(Qt::UpArrow);
|
||||
s.upButton->setMaximumHeight(22);
|
||||
s.upButton->setMaximumWidth(22);
|
||||
|
||||
s.downButton = new QToolButton(this);
|
||||
s.downButton->setArrowType(Qt::DownArrow);
|
||||
s.downButton->setMaximumHeight(22);
|
||||
s.downButton->setMaximumWidth(22);
|
||||
#ifdef Q_OS_MAC
|
||||
s.upButton->setIconSize(QSize(10, 10));
|
||||
s.downButton->setIconSize(QSize(10, 10));
|
||||
#endif
|
||||
s.removeButton = new QToolButton(this);
|
||||
s.removeButton->setText(QChar('X'));
|
||||
s.removeButton->setMaximumHeight(22);
|
||||
s.removeButton->setMaximumWidth(22);
|
||||
|
||||
// layout
|
||||
QWidget *toolWidget = new QWidget(s.detailsWidget);
|
||||
toolWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
Utils::FadingPanel *toolWidget = new Utils::FadingPanel(s.detailsWidget);
|
||||
QSize buttonSize(20, 26);
|
||||
|
||||
s.upButton = new QToolButton(toolWidget);
|
||||
s.upButton->setAutoRaise(true);
|
||||
s.upButton->setToolTip(tr("Move Up"));
|
||||
s.upButton->setFixedSize(buttonSize);
|
||||
s.upButton->setIcon(QIcon(":/core/images/darkarrowup.png"));
|
||||
|
||||
s.downButton = new QToolButton(toolWidget);
|
||||
s.downButton->setAutoRaise(true);
|
||||
s.downButton->setToolTip(tr("Move Down"));
|
||||
s.downButton->setFixedSize(buttonSize);
|
||||
s.downButton->setIcon(QIcon(":/core/images/darkarrowdown.png"));
|
||||
|
||||
s.removeButton = new QToolButton(toolWidget);
|
||||
s.removeButton->setAutoRaise(true);
|
||||
s.removeButton->setToolTip(tr("Remove Item"));
|
||||
s.removeButton->setFixedSize(buttonSize);
|
||||
s.removeButton->setIcon(QIcon(":/core/images/darkclose.png"));
|
||||
|
||||
toolWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
|
||||
QHBoxLayout *hbox = new QHBoxLayout();
|
||||
toolWidget->setLayout(hbox);
|
||||
hbox->setMargin(0);
|
||||
hbox->setMargin(4);
|
||||
hbox->setSpacing(0);
|
||||
hbox->addWidget(s.upButton);
|
||||
hbox->addWidget(s.downButton);
|
||||
@@ -316,9 +325,14 @@ void BuildStepsPage::updateBuildStepButtonsState()
|
||||
BuildStepsWidgetStruct s = m_buildSteps.at(i);
|
||||
s.removeButton->setEnabled(!steps.at(i)->immutable());
|
||||
m_removeMapper->setMapping(s.removeButton, i);
|
||||
|
||||
s.upButton->setEnabled((i > 0) && !(steps.at(i)->immutable() && steps.at(i - 1)));
|
||||
m_upMapper->setMapping(s.upButton, i);
|
||||
s.downButton->setEnabled((i + 1 < steps.count()) && !(steps.at(i)->immutable() && steps.at(i + 1)->immutable()));
|
||||
m_downMapper->setMapping(s.downButton, i);
|
||||
|
||||
// Only show buttons when needed
|
||||
s.downButton->setVisible(steps.count() != 1);
|
||||
s.upButton->setVisible(steps.count() != 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,7 +266,7 @@ void DoubleTabWidget::paintEvent(QPaintEvent *event)
|
||||
|
||||
// draw background of second bar
|
||||
painter.fillRect(QRect(0, r.height(), r.width(), OTHER_HEIGHT), grad);
|
||||
painter.setPen(Qt::black);
|
||||
painter.setPen(QColor(0x505050));
|
||||
painter.drawLine(0, r.height() + OTHER_HEIGHT,
|
||||
r.width(), r.height() + OTHER_HEIGHT);
|
||||
painter.setPen(Qt::white);
|
||||
|
||||
|
Before Width: | Height: | Size: 393 B After Width: | Height: | Size: 373 B |
@@ -1390,9 +1390,9 @@ void ProjectExplorerPlugin::updateActions()
|
||||
d->m_rebuildAction->setEnabled(enableBuildActions);
|
||||
d->m_cleanAction->setEnabled(enableBuildActions);
|
||||
|
||||
d->m_buildAction->setParameter(projectNameContextMenu);
|
||||
d->m_rebuildAction->setParameter(projectNameContextMenu);
|
||||
d->m_cleanAction->setParameter(projectNameContextMenu);
|
||||
d->m_buildActionContextMenu->setParameter(projectNameContextMenu);
|
||||
d->m_rebuildActionContextMenu->setParameter(projectNameContextMenu);
|
||||
d->m_cleanActionContextMenu->setParameter(projectNameContextMenu);
|
||||
|
||||
d->m_buildActionContextMenu->setEnabled(enableBuildActionsContextMenu);
|
||||
d->m_rebuildActionContextMenu->setEnabled(enableBuildActionsContextMenu);
|
||||
|
||||
@@ -219,6 +219,8 @@ void TargetSelector::paintEvent(QPaintEvent *event)
|
||||
} else {
|
||||
image= m_runselected;
|
||||
}
|
||||
} else {
|
||||
p.setPen(Qt::black);
|
||||
}
|
||||
|
||||
QRect buttonRect(x, 1, targetWidth() , image.height());
|
||||
|
||||
@@ -127,8 +127,7 @@ void TargetSettingsPanelWidget::setupUi()
|
||||
|
||||
updateTargetAddAndRemoveButtons();
|
||||
|
||||
// Restore target originally set:
|
||||
m_project->setActiveTarget(activeTarget);
|
||||
activeTargetChanged(activeTarget);
|
||||
}
|
||||
|
||||
void TargetSettingsPanelWidget::currentTargetChanged(int targetIndex, int subIndex)
|
||||
|
||||
@@ -133,7 +133,7 @@ void DragTool::beginWithPoint(const QPointF &beginPoint)
|
||||
|
||||
}
|
||||
|
||||
void DragTool::createQmlItemNode(const ItemLibraryInfo &itemLibraryRepresentation, QmlItemNode parentNode, QPointF scenePos)
|
||||
void DragTool::createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry, QmlItemNode parentNode, QPointF scenePos)
|
||||
{
|
||||
QmlDesignerItemLibraryDragAndDrop::CustomDragAndDrop::hide();
|
||||
|
||||
@@ -142,7 +142,7 @@ void DragTool::createQmlItemNode(const ItemLibraryInfo &itemLibraryRepresentatio
|
||||
FormEditorItem *parentItem = scene()->itemForQmlItemNode(parentNode);
|
||||
QPointF pos = parentItem->mapFromScene(scenePos);
|
||||
|
||||
m_dragNode = view()->createQmlItemNode(itemLibraryRepresentation, pos, parentNode);
|
||||
m_dragNode = view()->createQmlItemNode(itemLibraryEntry, pos, parentNode);
|
||||
|
||||
Q_ASSERT(m_dragNode.modelNode().isValid());
|
||||
Q_ASSERT(m_dragNode.isValid());
|
||||
@@ -238,14 +238,14 @@ void DragTool::dragLeaveEvent(QGraphicsSceneDragDropEvent * event)
|
||||
}
|
||||
}
|
||||
|
||||
static ItemLibraryInfo ItemLibraryInfoFromData(const QByteArray &data)
|
||||
static ItemLibraryEntry itemLibraryEntryFromData(const QByteArray &data)
|
||||
{
|
||||
QDataStream stream(data);
|
||||
|
||||
ItemLibraryInfo itemLibraryInfo;
|
||||
stream >> itemLibraryInfo;
|
||||
ItemLibraryEntry itemLibraryEntry;
|
||||
stream >> itemLibraryEntry;
|
||||
|
||||
return itemLibraryInfo;
|
||||
return itemLibraryEntry;
|
||||
}
|
||||
|
||||
void DragTool::dragMoveEvent(QGraphicsSceneDragDropEvent * event)
|
||||
@@ -277,8 +277,8 @@ void DragTool::dragMoveEvent(QGraphicsSceneDragDropEvent * event)
|
||||
|
||||
if (event->mimeData()->hasFormat("application/vnd.bauhaus.itemlibraryinfo")) {
|
||||
Q_ASSERT(!event->mimeData()->data("application/vnd.bauhaus.itemlibraryinfo").isEmpty());
|
||||
ItemLibraryInfo ItemLibraryInfo = ItemLibraryInfoFromData(event->mimeData()->data("application/vnd.bauhaus.itemlibraryinfo"));
|
||||
createQmlItemNode(ItemLibraryInfo, parentNode, event->scenePos());
|
||||
ItemLibraryEntry itemLibraryEntry = itemLibraryEntryFromData(event->mimeData()->data("application/vnd.bauhaus.itemlibraryinfo"));
|
||||
createQmlItemNode(itemLibraryEntry, parentNode, event->scenePos());
|
||||
} else if (event->mimeData()->hasFormat("application/vnd.bauhaus.libraryresource")) {
|
||||
Q_ASSERT(!event->mimeData()->data("application/vnd.bauhaus.libraryresource").isEmpty());
|
||||
QString imageName = QString::fromLatin1((event->mimeData()->data("application/vnd.bauhaus.libraryresource")));
|
||||
|
||||
@@ -86,7 +86,7 @@ protected:
|
||||
|
||||
private:
|
||||
|
||||
void createQmlItemNode(const ItemLibraryInfo &ItemLibraryRepresentation, QmlItemNode parentNode, QPointF scenePos);
|
||||
void createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry, QmlItemNode parentNode, QPointF scenePos);
|
||||
void createQmlItemNodeFromImage(const QString &imageName, QmlItemNode parentNode, QPointF scenePos);
|
||||
FormEditorItem* calculateContainer(const QPointF &point, FormEditorItem * currentItem = 0);
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ class ResizeTool;
|
||||
class AnchorTool;
|
||||
class DragTool;
|
||||
class ItemCreatorTool;
|
||||
class ItemLibraryInfo;
|
||||
class ItemLibraryEntry;
|
||||
class QmlItemNode;
|
||||
|
||||
class FormEditorView : public QmlModelView
|
||||
|
||||
@@ -170,8 +170,8 @@ void ItemCreatorTool::createAtItem(const QRectF &rect)
|
||||
return;
|
||||
if (list.first() == "item") {
|
||||
RewriterTransaction transaction = view()->beginRewriterTransaction();
|
||||
ItemLibraryInfo itemLibraryRepresentation = view()->model()->metaInfo().itemLibraryRepresentation(list.at(1));
|
||||
QmlItemNode newNode = view()->createQmlItemNode(itemLibraryRepresentation, pos, parentNode);
|
||||
ItemLibraryEntry itemLibraryEntry = view()->model()->metaInfo().itemLibraryInfo().entry(list.at(1));
|
||||
QmlItemNode newNode = view()->createQmlItemNode(itemLibraryEntry, pos, parentNode);
|
||||
newNode.modelNode().variantProperty("width") = rect.width();
|
||||
newNode.modelNode().variantProperty("height") = rect.height();
|
||||
QList<QmlItemNode> nodeList;
|
||||
|
||||
@@ -45,7 +45,6 @@ namespace QmlDesignerItemLibraryDragAndDrop {
|
||||
void CustomDragAndDropIcon::startDrag()
|
||||
{
|
||||
m_size = m_icon.size();
|
||||
setPixmap(m_icon);
|
||||
m_iconAlpha = 1;
|
||||
m_previewAlpha = 0;
|
||||
|
||||
@@ -83,7 +82,6 @@ void CustomDragAndDropIcon::mouseMoveEvent(QMouseEvent *event)
|
||||
move(pos);
|
||||
else
|
||||
move(-1000, -1000); //no hiding because of mouse grabbing
|
||||
setPixmap(currentImage());
|
||||
resize(m_size);
|
||||
show();
|
||||
update();
|
||||
@@ -119,13 +117,10 @@ void CustomDragAndDropIcon::mouseMoveEvent(QMouseEvent *event)
|
||||
m_oldTarget = target;
|
||||
}
|
||||
|
||||
|
||||
QPixmap CustomDragAndDropIcon::currentImage()
|
||||
void CustomDragAndDropIcon::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
//blend the two images (icon and preview) according to alpha values
|
||||
QPixmap pixmap(m_size);
|
||||
pixmap.fill(Qt::white);
|
||||
QPainter p(&pixmap);
|
||||
QWidget::paintEvent(event);
|
||||
QPainter p(this);
|
||||
if (CustomDragAndDrop::isAccepted()) {
|
||||
p.setOpacity(m_previewAlpha);
|
||||
p.drawPixmap(0 ,0 , m_size.width(), m_size.height(), m_preview);
|
||||
@@ -137,7 +132,6 @@ QPixmap CustomDragAndDropIcon::currentImage()
|
||||
p.setOpacity(m_previewAlpha);
|
||||
p.drawPixmap(0 ,0 , m_size.width(), m_size.height(), m_preview);
|
||||
}
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
void CustomDragAndDropIcon::enter()
|
||||
@@ -185,7 +179,6 @@ void CustomDragAndDropIcon::animateDrag(int frame)
|
||||
m_size = QSize(width, height);
|
||||
}
|
||||
QPoint p = pos();
|
||||
setPixmap(currentImage());
|
||||
resize(m_size);
|
||||
move(p);
|
||||
update(); //redrawing needed
|
||||
|
||||
@@ -60,10 +60,9 @@ public slots:
|
||||
|
||||
protected:
|
||||
virtual void mouseMoveEvent(QMouseEvent *);
|
||||
virtual void paintEvent(QPaintEvent *event);
|
||||
virtual void mouseReleaseEvent(QMouseEvent *);
|
||||
private:
|
||||
QPixmap currentImage();
|
||||
|
||||
QWidget *m_oldTarget;
|
||||
QPixmap m_preview;
|
||||
QPixmap m_icon;
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace QmlDesigner {
|
||||
|
||||
class ItemLibraryPrivate;
|
||||
class MetaInfo;
|
||||
class ItemLibraryInfo;
|
||||
class ItemLibraryEntry;
|
||||
|
||||
class ItemLibrary : public QFrame
|
||||
{
|
||||
@@ -47,7 +47,6 @@ public:
|
||||
ItemLibrary(QWidget *parent = 0);
|
||||
virtual ~ItemLibrary();
|
||||
|
||||
void addItemLibraryInfo(const ItemLibraryInfo &ItemLibraryInfo);
|
||||
void setMetaInfo(const MetaInfo &metaInfo);
|
||||
|
||||
public Q_SLOTS:
|
||||
|
||||
@@ -387,7 +387,6 @@ bool ItemLibraryModel::isItemVisible(int itemLibId)
|
||||
return elementModel(sectionLibId)->isItemVisible(itemLibId);
|
||||
}
|
||||
|
||||
|
||||
void ItemLibraryModel::update(const MetaInfo &metaInfo)
|
||||
{
|
||||
QMap<QString, int> sections;
|
||||
@@ -403,32 +402,36 @@ void ItemLibraryModel::update(const MetaInfo &metaInfo)
|
||||
*m_metaInfo = metaInfo;
|
||||
}
|
||||
|
||||
foreach (const QString &type, metaInfo.itemLibraryItems()) {
|
||||
foreach (const ItemLibraryInfo &itemLibraryRepresentation, itemLibraryRepresentations(type)) {
|
||||
foreach (ItemLibraryEntry entry, metaInfo.itemLibraryInfo().entries()) {
|
||||
QString itemSectionName = entry.category();
|
||||
ItemLibrarySectionModel *sectionModel;
|
||||
ItemLibraryItemModel *itemModel;
|
||||
int itemId = m_nextLibId++, sectionId;
|
||||
|
||||
QString itemSectionName = itemLibraryRepresentation.category();
|
||||
ItemLibrarySectionModel *sectionModel;
|
||||
ItemLibraryItemModel *itemModel;
|
||||
int itemId = m_nextLibId++, sectionId;
|
||||
|
||||
if (sections.contains(itemSectionName)) {
|
||||
sectionId = sections.value(itemSectionName);
|
||||
sectionModel = elementModel(sectionId);
|
||||
} else {
|
||||
sectionId = m_nextLibId++;
|
||||
sectionModel = new ItemLibrarySectionModel(m_scriptEngine.data(), sectionId, itemSectionName, this);
|
||||
addElement(sectionModel, sectionId);
|
||||
sections.insert(itemSectionName, sectionId);
|
||||
}
|
||||
|
||||
m_itemInfos.insert(itemId, itemLibraryRepresentation);
|
||||
|
||||
itemModel = new ItemLibraryItemModel(m_scriptEngine.data(), itemId, itemLibraryRepresentation.name());
|
||||
itemModel->setItemIcon(itemLibraryRepresentation.icon());
|
||||
itemModel->setItemIconSize(m_itemIconSize);
|
||||
sectionModel->addSectionEntry(itemModel);
|
||||
m_sections.insert(itemId, sectionId);
|
||||
if (sections.contains(itemSectionName)) {
|
||||
sectionId = sections.value(itemSectionName);
|
||||
sectionModel = elementModel(sectionId);
|
||||
} else {
|
||||
sectionId = m_nextLibId++;
|
||||
sectionModel = new ItemLibrarySectionModel(m_scriptEngine.data(), sectionId, itemSectionName, this);
|
||||
addElement(sectionModel, sectionId);
|
||||
sections.insert(itemSectionName, sectionId);
|
||||
}
|
||||
|
||||
m_itemInfos.insert(itemId, entry);
|
||||
|
||||
itemModel = new ItemLibraryItemModel(m_scriptEngine.data(), itemId, entry.name());
|
||||
|
||||
// delayed creation of (default) icons
|
||||
if (entry.icon().isNull())
|
||||
entry.setIcon(QIcon(QLatin1String(":/ItemLibrary/images/item-default-icon.png")));
|
||||
if (entry.dragIcon().isNull())
|
||||
entry.setDragIcon(createDragPixmap(getWidth(entry), getHeight(entry)));
|
||||
|
||||
itemModel->setItemIcon(entry.icon());
|
||||
itemModel->setItemIconSize(m_itemIconSize);
|
||||
sectionModel->addSectionEntry(itemModel);
|
||||
m_sections.insert(itemId, sectionId);
|
||||
}
|
||||
|
||||
updateVisibility();
|
||||
@@ -499,9 +502,9 @@ void ItemLibraryModel::updateVisibility()
|
||||
emit visibilityChanged();
|
||||
}
|
||||
|
||||
static inline int getWidth(const ItemLibraryInfo &itemLibraryRepresentation)
|
||||
int ItemLibraryModel::getWidth(const ItemLibraryEntry &itemLibraryEntry)
|
||||
{
|
||||
foreach (const ItemLibraryInfo::Property &property, itemLibraryRepresentation.properties())
|
||||
foreach (const ItemLibraryEntry::Property &property, itemLibraryEntry.properties())
|
||||
{
|
||||
if (property.name() == QLatin1String("width"))
|
||||
return property.value().toInt();
|
||||
@@ -509,9 +512,9 @@ static inline int getWidth(const ItemLibraryInfo &itemLibraryRepresentation)
|
||||
return 64;
|
||||
}
|
||||
|
||||
static inline int getHeight(const ItemLibraryInfo &itemLibraryRepresentation)
|
||||
int ItemLibraryModel::getHeight(const ItemLibraryEntry &itemLibraryEntry)
|
||||
{
|
||||
foreach (const ItemLibraryInfo::Property &property, itemLibraryRepresentation.properties())
|
||||
foreach (const ItemLibraryEntry::Property &property, itemLibraryEntry.properties())
|
||||
{
|
||||
if (property.name() == QLatin1String("height"))
|
||||
return property.value().toInt();
|
||||
@@ -519,7 +522,7 @@ static inline int getHeight(const ItemLibraryInfo &itemLibraryRepresentation)
|
||||
return 64;
|
||||
}
|
||||
|
||||
static inline QPixmap createDragPixmap(int width, int height)
|
||||
QPixmap ItemLibraryModel::createDragPixmap(int width, int height)
|
||||
{
|
||||
QImage dragImage(width, height, QImage::Format_RGB32); // TODO: draw item drag icon
|
||||
dragImage.fill(0xffffffff);
|
||||
@@ -531,53 +534,6 @@ static inline QPixmap createDragPixmap(int width, int height)
|
||||
return QPixmap::fromImage(dragImage);
|
||||
}
|
||||
|
||||
QList<ItemLibraryInfo> ItemLibraryModel::itemLibraryRepresentations(const QString &type)
|
||||
{
|
||||
QList<ItemLibraryInfo> itemLibraryRepresentationList;
|
||||
NodeMetaInfo nodeInfo = m_metaInfo->nodeMetaInfo(type);
|
||||
|
||||
if (nodeInfo.isQmlGraphicsItem()) {
|
||||
itemLibraryRepresentationList = m_metaInfo->itemLibraryRepresentations(nodeInfo);
|
||||
|
||||
if (!m_metaInfo->hasNodeMetaInfo(type))
|
||||
qWarning() << "ItemLibrary: type not declared: " << type;
|
||||
|
||||
static QIcon defaultIcon(QLatin1String(":/ItemLibrary/images/item-default-icon.png"));
|
||||
|
||||
if (itemLibraryRepresentationList.isEmpty() || !m_metaInfo->hasNodeMetaInfo(type)) {
|
||||
QIcon icon = nodeInfo.icon();
|
||||
if (icon.isNull())
|
||||
icon = defaultIcon;
|
||||
|
||||
ItemLibraryInfo itemLibraryInfo;
|
||||
itemLibraryInfo.setName(type);
|
||||
itemLibraryInfo.setTypeName(nodeInfo.typeName());
|
||||
itemLibraryInfo.setCategory(nodeInfo.category());
|
||||
itemLibraryInfo.setIcon(icon);
|
||||
itemLibraryInfo.setDragIcon(createDragPixmap(64, 64));
|
||||
itemLibraryInfo.setMajorVersion(nodeInfo.majorVersion());
|
||||
itemLibraryInfo.setMinorVersion(nodeInfo.minorVersion());
|
||||
itemLibraryRepresentationList.append(itemLibraryInfo);
|
||||
}
|
||||
else {
|
||||
foreach (ItemLibraryInfo itemLibraryRepresentation, itemLibraryRepresentationList) {
|
||||
|
||||
QIcon icon = itemLibraryRepresentation.icon();
|
||||
if (itemLibraryRepresentation.icon().isNull())
|
||||
itemLibraryRepresentation.setIcon(defaultIcon);
|
||||
|
||||
if (itemLibraryRepresentation.dragIcon().isNull())
|
||||
itemLibraryRepresentation.setDragIcon(createDragPixmap(getWidth(itemLibraryRepresentation), getHeight(itemLibraryRepresentation)));
|
||||
|
||||
if (itemLibraryRepresentation.category().isEmpty())
|
||||
itemLibraryRepresentation.setCategory(nodeInfo.category());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return itemLibraryRepresentationList;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmlDesigner
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ QT_FORWARD_DECLARE_CLASS(QMimeData);
|
||||
namespace QmlDesigner {
|
||||
|
||||
class MetaInfo;
|
||||
class ItemLibraryInfo;
|
||||
class ItemLibraryEntry;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
@@ -153,11 +153,14 @@ signals:
|
||||
|
||||
private:
|
||||
void updateVisibility();
|
||||
QList<ItemLibraryInfo> itemLibraryRepresentations(const QString &type);
|
||||
|
||||
int getWidth(const ItemLibraryEntry &entry);
|
||||
int getHeight(const ItemLibraryEntry &entry);
|
||||
QPixmap createDragPixmap(int width, int height);
|
||||
|
||||
QWeakPointer<QScriptEngine> m_scriptEngine;
|
||||
MetaInfo *m_metaInfo;
|
||||
QMap<int, ItemLibraryInfo> m_itemInfos;
|
||||
QMap<int, ItemLibraryEntry> m_itemInfos;
|
||||
QMap<int, int> m_sections;
|
||||
|
||||
QString m_searchText;
|
||||
|
||||
@@ -171,8 +171,9 @@ void IdItemDelegate::paint(QPainter *painter,
|
||||
if (icon.isNull())
|
||||
{
|
||||
// if node has no own icon, search for it in the itemlibrary
|
||||
QList <ItemLibraryInfo> InfoList = node.metaInfo().metaInfo().itemLibraryRepresentations(node.metaInfo());
|
||||
foreach (const ItemLibraryInfo &entry, InfoList)
|
||||
const ItemLibraryInfo libraryInfo = node.metaInfo().metaInfo().itemLibraryInfo();
|
||||
QList <ItemLibraryEntry> infoList = libraryInfo.entriesForNodeMetaInfo(node.metaInfo());
|
||||
foreach (const ItemLibraryEntry &entry, infoList)
|
||||
{
|
||||
if (entry.typeName()==node.metaInfo().typeName()) {
|
||||
icon = entry.icon();
|
||||
|
||||
|
Before Width: | Height: | Size: 275 B After Width: | Height: | Size: 308 B |
@@ -27,8 +27,8 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef ItemLibraryINFO_H
|
||||
#define ItemLibraryINFO_H
|
||||
#ifndef ITEMLIBRARYINFO_H
|
||||
#define ITEMLIBRARYINFO_H
|
||||
|
||||
#include "corelib_global.h"
|
||||
|
||||
@@ -45,23 +45,26 @@ class NodeMetaInfo;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class ItemLibraryInfoData;
|
||||
class MetaInfoPrivate;
|
||||
class ItemLibraryEntryData;
|
||||
class ItemLibraryInfoPrivate;
|
||||
|
||||
}
|
||||
|
||||
class ItemLibraryInfo;
|
||||
class ItemLibraryEntry;
|
||||
|
||||
CORESHARED_EXPORT QDataStream& operator<<(QDataStream& stream, const ItemLibraryInfo& ItemLibraryInfo);
|
||||
CORESHARED_EXPORT QDataStream& operator>>(QDataStream& stream, ItemLibraryInfo& ItemLibraryInfo);
|
||||
CORESHARED_EXPORT QDataStream& operator<<(QDataStream& stream, const ItemLibraryEntry &itemLibraryEntry);
|
||||
CORESHARED_EXPORT QDataStream& operator>>(QDataStream& stream, ItemLibraryEntry &itemLibraryEntry);
|
||||
|
||||
class CORESHARED_EXPORT ItemLibraryInfo
|
||||
class CORESHARED_EXPORT ItemLibraryEntry
|
||||
{
|
||||
friend class QmlDesigner::MetaInfo;
|
||||
friend class QmlDesigner::Internal::MetaInfoParser;
|
||||
friend CORESHARED_EXPORT QDataStream& QmlDesigner::operator<<(QDataStream& stream, const ItemLibraryInfo& image);
|
||||
friend CORESHARED_EXPORT QDataStream& QmlDesigner::operator>>(QDataStream& stream, ItemLibraryInfo& image);
|
||||
friend CORESHARED_EXPORT QDataStream& QmlDesigner::operator<<(QDataStream& stream, const ItemLibraryEntry &itemLibraryEntry);
|
||||
friend CORESHARED_EXPORT QDataStream& QmlDesigner::operator>>(QDataStream& stream, ItemLibraryEntry &itemLibraryEntry);
|
||||
public:
|
||||
ItemLibraryInfo();
|
||||
~ItemLibraryInfo();
|
||||
ItemLibraryEntry();
|
||||
~ItemLibraryEntry();
|
||||
|
||||
QString name() const;
|
||||
QString typeName() const;
|
||||
@@ -72,8 +75,8 @@ public:
|
||||
QIcon dragIcon() const;
|
||||
QString qml() const;
|
||||
|
||||
ItemLibraryInfo(const ItemLibraryInfo &other);
|
||||
ItemLibraryInfo& operator=(const ItemLibraryInfo &other);
|
||||
ItemLibraryEntry(const ItemLibraryEntry &other);
|
||||
ItemLibraryEntry& operator=(const ItemLibraryEntry &other);
|
||||
|
||||
typedef QmlDesigner::PropertyContainer Property;
|
||||
|
||||
@@ -90,11 +93,35 @@ public:
|
||||
void setCategory(const QString &category);
|
||||
void setQml(const QString &qml);
|
||||
private:
|
||||
QExplicitlySharedDataPointer<Internal::ItemLibraryInfoData> m_data;
|
||||
QExplicitlySharedDataPointer<Internal::ItemLibraryEntryData> m_data;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(QmlDesigner::ItemLibraryInfo)
|
||||
class CORESHARED_EXPORT ItemLibraryInfo
|
||||
{
|
||||
friend class Internal::MetaInfoPrivate;
|
||||
public:
|
||||
ItemLibraryInfo();
|
||||
ItemLibraryInfo(const ItemLibraryInfo &other);
|
||||
~ItemLibraryInfo();
|
||||
|
||||
#endif // ItemLibraryINFO_H
|
||||
ItemLibraryInfo& operator=(const ItemLibraryInfo &other);
|
||||
|
||||
bool isValid();
|
||||
|
||||
QList<ItemLibraryEntry> entries() const;
|
||||
QList<ItemLibraryEntry> entriesForNodeMetaInfo(const NodeMetaInfo &nodeMetaInfo) const;
|
||||
ItemLibraryEntry entry(const QString &name) const;
|
||||
|
||||
ItemLibraryEntry addItemLibraryEntry(const NodeMetaInfo &nodeMetaInfo, const QString &itemLibraryRepresentationName);
|
||||
void remove(const NodeMetaInfo &nodeMetaInfo);
|
||||
void clear();
|
||||
|
||||
private:
|
||||
static ItemLibraryInfo createItemLibraryInfo(const ItemLibraryInfo &parentInfo);
|
||||
QSharedPointer<Internal::ItemLibraryInfoPrivate> m_data;
|
||||
};
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
||||
#endif // ITEMLIBRARYINFO_H
|
||||
|
||||
@@ -47,6 +47,7 @@ namespace QmlDesigner {
|
||||
|
||||
class ModelNode;
|
||||
class AbstractProperty;
|
||||
class ItemLibraryInfo;
|
||||
|
||||
namespace Internal {
|
||||
class MetaInfoPrivate;
|
||||
@@ -58,6 +59,7 @@ namespace Internal {
|
||||
CORESHARED_EXPORT bool operator==(const MetaInfo &first, const MetaInfo &second);
|
||||
CORESHARED_EXPORT bool operator!=(const MetaInfo &first, const MetaInfo &second);
|
||||
|
||||
|
||||
class CORESHARED_EXPORT MetaInfo
|
||||
{
|
||||
friend class QmlDesigner::Internal::MetaInfoPrivate;
|
||||
@@ -82,11 +84,11 @@ public:
|
||||
bool hasEnumerator(const QString &enumeratorName) const;
|
||||
EnumeratorMetaInfo enumerator(const QString &enumeratorName) const;
|
||||
|
||||
QStringList itemLibraryItems() const;
|
||||
QList<ItemLibraryInfo> itemLibraryRepresentations(const NodeMetaInfo &nodeMetaInfo) const;
|
||||
ItemLibraryInfo itemLibraryRepresentation(const QString &name) const;
|
||||
ItemLibraryInfo itemLibraryInfo() const;
|
||||
|
||||
QString fromQtTypes(const QString &type) const;
|
||||
|
||||
|
||||
public:
|
||||
static MetaInfo global();
|
||||
static void clearGlobal();
|
||||
@@ -107,7 +109,6 @@ private:
|
||||
|
||||
EnumeratorMetaInfo addEnumerator(const QString &enumeratorScope, const QString &enumeratorName);
|
||||
EnumeratorMetaInfo addFlag(const QString &enumeratorScope, const QString &enumeratorName);
|
||||
ItemLibraryInfo addItemLibraryInfo(const NodeMetaInfo &nodeMetaInfo, const QString &itemLibraryRepresentationName);
|
||||
|
||||
bool isGlobal() const;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace QmlDesigner {
|
||||
|
||||
class NodeMetaInfo;
|
||||
class EnumeratorMetaInfo;
|
||||
class ItemLibraryInfo;
|
||||
class ItemLibraryEntry;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
@@ -63,10 +63,10 @@ protected:
|
||||
void handleFlagElementElement(QXmlStreamReader &reader, EnumeratorMetaInfo &enumeratorMetaInfo);
|
||||
void handleNodeElement(QXmlStreamReader &reader);
|
||||
void handleNodeInheritElement(QXmlStreamReader &reader, const QString &className);
|
||||
void handleNodeItemLibraryRepresentationElement(QXmlStreamReader &reader, const QString &className);
|
||||
void handleNodeItemLibraryEntryElement(QXmlStreamReader &reader, const QString &className);
|
||||
void handleAbstractPropertyElement(QXmlStreamReader &reader, NodeMetaInfo &nodeMetaInfo);
|
||||
void handleAbstractPropertyDefaultValueElement(QXmlStreamReader &reader, NodeMetaInfo &nodeMetaInfo);
|
||||
void handleItemLibraryInfoPropertyElement(QXmlStreamReader &reader, ItemLibraryInfo &ItemLibraryInfo);
|
||||
void handleItemLibraryEntryPropertyElement(QXmlStreamReader &reader, ItemLibraryEntry &itemLibraryEntry);
|
||||
|
||||
private:
|
||||
MetaInfo m_metaInfo;
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Internal {
|
||||
class MetaInfoParser;
|
||||
class NodeMetaInfoData;
|
||||
class SubComponentManagerPrivate;
|
||||
class ItemLibraryInfoData;
|
||||
class ItemLibraryEntryData;
|
||||
}
|
||||
|
||||
class PropertyMetaInfo;
|
||||
@@ -60,7 +60,7 @@ class PropertyMetaInfo;
|
||||
class CORESHARED_EXPORT NodeMetaInfo
|
||||
{
|
||||
friend class QmlDesigner::MetaInfo;
|
||||
friend class QmlDesigner::Internal::ItemLibraryInfoData;
|
||||
friend class QmlDesigner::Internal::ItemLibraryEntryData;
|
||||
friend class QmlDesigner::Internal::MetaInfoPrivate;
|
||||
friend class QmlDesigner::Internal::MetaInfoParser;
|
||||
friend class QmlDesigner::Internal::SubComponentManagerPrivate;
|
||||
@@ -95,7 +95,6 @@ public:
|
||||
|
||||
bool hasProperty(const QString &propertyName, bool resolveDotSyntax = false) const;
|
||||
bool isContainer() const;
|
||||
bool isVisibleToItemLibrary() const;
|
||||
|
||||
bool isWidget() const;
|
||||
bool isGraphicsWidget() const;
|
||||
@@ -105,7 +104,6 @@ public:
|
||||
bool isSubclassOf(const QString& type, int majorVersion = 4, int minorVersion = 6) const;
|
||||
|
||||
QIcon icon() const;
|
||||
QString category() const;
|
||||
|
||||
private:
|
||||
NodeMetaInfo();
|
||||
@@ -115,9 +113,7 @@ private:
|
||||
void setTypeName(const QString &typeName);
|
||||
void addProperty(const PropertyMetaInfo &property);
|
||||
void setIsContainer(bool isContainer);
|
||||
void setIsVisibleToItemLibrary(bool isVisibleToItemLibrary);
|
||||
void setIcon(const QIcon &icon);
|
||||
void setCategory(const QString &category);
|
||||
void setQmlFile(const QString &filePath);
|
||||
void setDefaultProperty(const QString &defaultProperty);
|
||||
void setMajorVersion(int version);
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
class ItemLibraryInfo;
|
||||
class ItemLibraryEntry;
|
||||
|
||||
class CORESHARED_EXPORT QmlModelView : public ForwardView<NodeInstanceView>
|
||||
{
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
int minorVersion,
|
||||
const PropertyListType &propertyList = PropertyListType());
|
||||
|
||||
QmlItemNode createQmlItemNode(const ItemLibraryInfo &ItemLibraryRepresentation, const QPointF &position, QmlItemNode parentNode);
|
||||
QmlItemNode createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry, const QPointF &position, QmlItemNode parentNode);
|
||||
QmlItemNode createQmlItemNodeFromImage(const QString &imageName, const QPointF &position, QmlItemNode parentNode);
|
||||
|
||||
QmlObjectNode rootQmlObjectNode() const;
|
||||
|
||||
@@ -54,8 +54,6 @@ public:
|
||||
QStringList qmlFiles() const;
|
||||
QStringList directories() const;
|
||||
|
||||
signals:
|
||||
void qmlFilesChanged(const QStringList &oldPathList, const QStringList &newPathList);
|
||||
|
||||
private:
|
||||
friend class Internal::SubComponentManagerPrivate;
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
|
||||
#include <private/qdeclarativeanchors_p.h>
|
||||
#include <private/qdeclarativeanchors_p_p.h>
|
||||
#include <private/qdeclarativeitem_p.h>
|
||||
#include <private/qdeclarativeproperty_p.h>
|
||||
#include <private/qdeclarativerectangle_p.h>
|
||||
|
||||
@@ -292,33 +293,33 @@ void QmlGraphicsItemNodeInstance::resetProperty(const QString &name)
|
||||
|
||||
GraphicsObjectNodeInstance::resetProperty(name);
|
||||
if (name == "anchors.fill") {
|
||||
qmlGraphicsItem()->anchors()->resetFill();
|
||||
anchors()->resetFill();
|
||||
resetHorizontal();
|
||||
resetVertical();
|
||||
} else if (name == "anchors.centerIn") {
|
||||
qmlGraphicsItem()->anchors()->resetCenterIn();
|
||||
anchors()->resetCenterIn();
|
||||
resetHorizontal();
|
||||
resetVertical();
|
||||
} else if (name == "anchors.top") {
|
||||
qmlGraphicsItem()->anchors()->resetTop();
|
||||
anchors()->resetTop();
|
||||
resetVertical();
|
||||
} else if (name == "anchors.left") {
|
||||
qmlGraphicsItem()->anchors()->resetLeft();
|
||||
anchors()->resetLeft();
|
||||
resetHorizontal();
|
||||
} else if (name == "anchors.right") {
|
||||
qmlGraphicsItem()->anchors()->resetRight();
|
||||
anchors()->resetRight();
|
||||
resetHorizontal();
|
||||
} else if (name == "anchors.bottom") {
|
||||
qmlGraphicsItem()->anchors()->resetBottom();
|
||||
anchors()->resetBottom();
|
||||
resetVertical();
|
||||
} else if (name == "anchors.horizontalCenter") {
|
||||
qmlGraphicsItem()->anchors()->resetHorizontalCenter();
|
||||
anchors()->resetHorizontalCenter();
|
||||
resetHorizontal();
|
||||
} else if (name == "anchors.verticalCenter") {
|
||||
qmlGraphicsItem()->anchors()->resetVerticalCenter();
|
||||
anchors()->resetVerticalCenter();
|
||||
resetVertical();
|
||||
} else if (name == "anchors.baseline") {
|
||||
qmlGraphicsItem()->anchors()->resetBaseline();
|
||||
anchors()->resetBaseline();
|
||||
resetVertical();
|
||||
}
|
||||
}
|
||||
@@ -333,11 +334,11 @@ void QmlGraphicsItemNodeInstance::resetProperty(const QString &name)
|
||||
//
|
||||
// if (instance.isQmlGraphicsItem()) {
|
||||
// Pointer qmlGraphicsItemInstance(instance.QmlGraphicsItemNodeInstance());
|
||||
// qmlGraphicsItem()->anchors()->setProperty("top", anchorLineFor(qmlGraphicsItemInstance->qmlGraphicsItem(), anchorLine));
|
||||
// anchors()->setProperty("top", anchorLineFor(qmlGraphicsItemInstance->qmlGraphicsItem(), anchorLine));
|
||||
// }
|
||||
// } else {
|
||||
// if (qmlGraphicsItem()->anchors()->usedAnchors().testFlag(QDeclarativeAnchors::HasTopAnchor)) {
|
||||
// qmlGraphicsItem()->anchors()->resetTop();
|
||||
// if (anchors()->usedAnchors().testFlag(QDeclarativeAnchors::HasTopAnchor)) {
|
||||
// anchors()->resetTop();
|
||||
// setPropertyValue("y", modelNode().property("y").value());
|
||||
// setPropertyValue("height", modelNode().property("height").value());
|
||||
// }
|
||||
@@ -350,11 +351,11 @@ void QmlGraphicsItemNodeInstance::resetProperty(const QString &name)
|
||||
//
|
||||
// if (instance.isQmlGraphicsItem()) {
|
||||
// Pointer qmlGraphicsItemInstance(instance.QmlGraphicsItemNodeInstance());
|
||||
// qmlGraphicsItem()->anchors()->setProperty("left", anchorLineFor(qmlGraphicsItemInstance->qmlGraphicsItem(), anchorLine));
|
||||
// anchors()->setProperty("left", anchorLineFor(qmlGraphicsItemInstance->qmlGraphicsItem(), anchorLine));
|
||||
// }
|
||||
// } else {
|
||||
// if (qmlGraphicsItem()->anchors()->usedAnchors().testFlag(QDeclarativeAnchors::HasLeftAnchor)) {
|
||||
// qmlGraphicsItem()->anchors()->resetLeft();
|
||||
// if (anchors()->usedAnchors().testFlag(QDeclarativeAnchors::HasLeftAnchor)) {
|
||||
// anchors()->resetLeft();
|
||||
// setPropertyValue("x", modelNode().property("x").value());
|
||||
// setPropertyValue("width", modelNode().property("width").value());
|
||||
// }
|
||||
@@ -367,11 +368,11 @@ void QmlGraphicsItemNodeInstance::resetProperty(const QString &name)
|
||||
//
|
||||
// if (instance.isQmlGraphicsItem()) {
|
||||
// Pointer qmlGraphicsItemInstance(instance.QmlGraphicsItemNodeInstance());
|
||||
// qmlGraphicsItem()->anchors()->setProperty("right", anchorLineFor(qmlGraphicsItemInstance->qmlGraphicsItem(), anchorLine));
|
||||
// anchors()->setProperty("right", anchorLineFor(qmlGraphicsItemInstance->qmlGraphicsItem(), anchorLine));
|
||||
// }
|
||||
// } else {
|
||||
// if (qmlGraphicsItem()->anchors()->usedAnchors().testFlag(QDeclarativeAnchors::HasRightAnchor)) {
|
||||
// qmlGraphicsItem()->anchors()->resetRight();
|
||||
// if (anchors()->usedAnchors().testFlag(QDeclarativeAnchors::HasRightAnchor)) {
|
||||
// anchors()->resetRight();
|
||||
// setPropertyValue("x", modelNode().property("x").value());
|
||||
// setPropertyValue("width", modelNode().property("width").value());
|
||||
// }
|
||||
@@ -384,11 +385,11 @@ void QmlGraphicsItemNodeInstance::resetProperty(const QString &name)
|
||||
//
|
||||
// if (instance.isQmlGraphicsItem()) {
|
||||
// Pointer qmlGraphicsItemInstance(instance.QmlGraphicsItemNodeInstance());
|
||||
// qmlGraphicsItem()->anchors()->setProperty("bottom", anchorLineFor(qmlGraphicsItemInstance->qmlGraphicsItem(), anchorLine));
|
||||
// anchors()->setProperty("bottom", anchorLineFor(qmlGraphicsItemInstance->qmlGraphicsItem(), anchorLine));
|
||||
// }
|
||||
// } else {
|
||||
// if (qmlGraphicsItem()->anchors()->usedAnchors().testFlag(QDeclarativeAnchors::HasBottomAnchor)) {
|
||||
// qmlGraphicsItem()->anchors()->resetBottom();
|
||||
// if (anchors()->usedAnchors().testFlag(QDeclarativeAnchors::HasBottomAnchor)) {
|
||||
// anchors()->resetBottom();
|
||||
// setPropertyValue("y", modelNode().property("y").value());
|
||||
// setPropertyValue("height", modelNode().property("height").value());
|
||||
// }
|
||||
@@ -401,11 +402,11 @@ void QmlGraphicsItemNodeInstance::resetProperty(const QString &name)
|
||||
//
|
||||
// if (instance.isQmlGraphicsItem()) {
|
||||
// Pointer qmlGraphicsItemInstance(instance.QmlGraphicsItemNodeInstance());
|
||||
// qmlGraphicsItem()->anchors()->setProperty("horizontalCenter", anchorLineFor(qmlGraphicsItemInstance->qmlGraphicsItem(), anchorLine));
|
||||
// anchors()->setProperty("horizontalCenter", anchorLineFor(qmlGraphicsItemInstance->qmlGraphicsItem(), anchorLine));
|
||||
// }
|
||||
// } else {
|
||||
// if (qmlGraphicsItem()->anchors()->usedAnchors().testFlag(QDeclarativeAnchors::HasHCenterAnchor)) {
|
||||
// qmlGraphicsItem()->anchors()->resetHorizontalCenter();
|
||||
// if (anchors()->usedAnchors().testFlag(QDeclarativeAnchors::HasHCenterAnchor)) {
|
||||
// anchors()->resetHorizontalCenter();
|
||||
// setPropertyValue("x", modelNode().property("x").value());
|
||||
// setPropertyValue("width", modelNode().property("width").value());
|
||||
// }
|
||||
@@ -418,23 +419,23 @@ void QmlGraphicsItemNodeInstance::resetProperty(const QString &name)
|
||||
//
|
||||
// if (instance.isQmlGraphicsItem()) {
|
||||
// Pointer qmlGraphicsItemInstance(instance.QmlGraphicsItemNodeInstance());
|
||||
// qmlGraphicsItem()->anchors()->setProperty("verticalCenter",anchorLineFor(qmlGraphicsItemInstance->qmlGraphicsItem(), anchorLine));
|
||||
// anchors()->setProperty("verticalCenter",anchorLineFor(qmlGraphicsItemInstance->qmlGraphicsItem(), anchorLine));
|
||||
// }
|
||||
// } else {
|
||||
// if (qmlGraphicsItem()->anchors()->usedAnchors().testFlag(QDeclarativeAnchors::HasVCenterAnchor)) {
|
||||
// qmlGraphicsItem()->anchors()->resetVerticalCenter();
|
||||
// if (anchors()->usedAnchors().testFlag(QDeclarativeAnchors::HasVCenterAnchor)) {
|
||||
// anchors()->resetVerticalCenter();
|
||||
// setPropertyValue("y", modelNode().property("y").value());
|
||||
// setPropertyValue("height", modelNode().property("height").value());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// qmlGraphicsItem()->anchors()->setTopMargin(anchors.margin(AnchorLine::Top));
|
||||
// qmlGraphicsItem()->anchors()->setLeftMargin(anchors.margin(AnchorLine::Left));
|
||||
// qmlGraphicsItem()->anchors()->setBottomMargin(anchors.margin(AnchorLine::Bottom));
|
||||
// qmlGraphicsItem()->anchors()->setRightMargin(anchors.margin(AnchorLine::Right));
|
||||
// qmlGraphicsItem()->anchors()->setHorizontalCenterOffset(anchors.margin(AnchorLine::HorizontalCenter));
|
||||
// qmlGraphicsItem()->anchors()->setVerticalCenterOffset(anchors.margin(AnchorLine::VerticalCenter));
|
||||
// anchors()->setTopMargin(anchors.margin(AnchorLine::Top));
|
||||
// anchors()->setLeftMargin(anchors.margin(AnchorLine::Left));
|
||||
// anchors()->setBottomMargin(anchors.margin(AnchorLine::Bottom));
|
||||
// anchors()->setRightMargin(anchors.margin(AnchorLine::Right));
|
||||
// anchors()->setHorizontalCenterOffset(anchors.margin(AnchorLine::HorizontalCenter));
|
||||
// anchors()->setVerticalCenterOffset(anchors.margin(AnchorLine::VerticalCenter));
|
||||
//}
|
||||
|
||||
QDeclarativeAnchors::Anchor anchorLineFlagForName(const QString &name)
|
||||
@@ -504,9 +505,9 @@ QPair<QString, NodeInstance> QmlGraphicsItemNodeInstance::anchor(const QString &
|
||||
QString targetName;
|
||||
|
||||
if (name == "anchors.fill") {
|
||||
targetObject = qmlGraphicsItem()->anchors()->fill();
|
||||
targetObject = anchors()->fill();
|
||||
} else if (name == "anchors.centerIn") {
|
||||
targetObject = qmlGraphicsItem()->anchors()->centerIn();
|
||||
targetObject = anchors()->centerIn();
|
||||
} else {
|
||||
QDeclarativeProperty metaProperty(object(), name, context());
|
||||
if (!metaProperty.isValid())
|
||||
@@ -533,46 +534,49 @@ bool QmlGraphicsItemNodeInstance::hasAnchor(const QString &name) const
|
||||
return false;
|
||||
|
||||
if (name == "anchors.fill")
|
||||
return qmlGraphicsItem()->anchors()->fill() != 0;
|
||||
return anchors()->fill() != 0;
|
||||
|
||||
if (name == "anchors.centerIn")
|
||||
return qmlGraphicsItem()->anchors()->centerIn() != 0;
|
||||
return anchors()->centerIn() != 0;
|
||||
|
||||
if (name == "anchors.right")
|
||||
return qmlGraphicsItem()->anchors()->right().item != 0;
|
||||
return anchors()->right().item != 0;
|
||||
|
||||
if (name == "anchors.top")
|
||||
return qmlGraphicsItem()->anchors()->top().item != 0;
|
||||
return anchors()->top().item != 0;
|
||||
|
||||
if (name == "anchors.left")
|
||||
return qmlGraphicsItem()->anchors()->left().item != 0;
|
||||
return anchors()->left().item != 0;
|
||||
|
||||
if (name == "anchors.bottom")
|
||||
return qmlGraphicsItem()->anchors()->bottom().item != 0;
|
||||
return anchors()->bottom().item != 0;
|
||||
|
||||
if (name == "anchors.horizontalCenter")
|
||||
return qmlGraphicsItem()->anchors()->horizontalCenter().item != 0;
|
||||
return anchors()->horizontalCenter().item != 0;
|
||||
|
||||
if (name == "anchors.verticalCenter")
|
||||
return qmlGraphicsItem()->anchors()->verticalCenter().item != 0;
|
||||
return anchors()->verticalCenter().item != 0;
|
||||
|
||||
if (name == "anchors.baseline")
|
||||
return qmlGraphicsItem()->anchors()->baseline().item != 0;
|
||||
return anchors()->baseline().item != 0;
|
||||
|
||||
return qmlGraphicsItem()->anchors()->usedAnchors().testFlag(anchorLineFlagForName(name));
|
||||
return anchors()->usedAnchors().testFlag(anchorLineFlagForName(name));
|
||||
}
|
||||
|
||||
bool isAnchoredTo(QDeclarativeItem *fromItem, QDeclarativeItem *toItem)
|
||||
{
|
||||
return fromItem->anchors()->fill() == toItem
|
||||
|| fromItem->anchors()->centerIn() == toItem
|
||||
|| fromItem->anchors()->bottom().item == toItem
|
||||
|| fromItem->anchors()->top().item == toItem
|
||||
|| fromItem->anchors()->left().item == toItem
|
||||
|| fromItem->anchors()->right().item == toItem
|
||||
|| fromItem->anchors()->verticalCenter().item == toItem
|
||||
|| fromItem->anchors()->horizontalCenter().item == toItem
|
||||
|| fromItem->anchors()->baseline().item == toItem;
|
||||
Q_ASSERT(dynamic_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(fromItem)));
|
||||
QDeclarativeItemPrivate *fromItemPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(fromItem));
|
||||
QDeclarativeAnchors *anchors = fromItemPrivate->anchors();
|
||||
return anchors->fill() == toItem
|
||||
|| anchors->centerIn() == toItem
|
||||
|| anchors->bottom().item == toItem
|
||||
|| anchors->top().item == toItem
|
||||
|| anchors->left().item == toItem
|
||||
|| anchors->right().item == toItem
|
||||
|| anchors->verticalCenter().item == toItem
|
||||
|| anchors->horizontalCenter().item == toItem
|
||||
|| anchors->baseline().item == toItem;
|
||||
}
|
||||
|
||||
bool areChildrenAnchoredTo(QDeclarativeItem *fromItem, QDeclarativeItem *toItem)
|
||||
@@ -612,8 +616,6 @@ bool QmlGraphicsItemNodeInstance::isAnchoredBy() const
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
QDeclarativeItem *QmlGraphicsItemNodeInstance::qmlGraphicsItem() const
|
||||
{
|
||||
if (object() == 0)
|
||||
@@ -622,5 +624,13 @@ QDeclarativeItem *QmlGraphicsItemNodeInstance::qmlGraphicsItem() const
|
||||
Q_ASSERT(qobject_cast<QDeclarativeItem*>(object()));
|
||||
return static_cast<QDeclarativeItem*>(object());
|
||||
}
|
||||
|
||||
QDeclarativeAnchors *QmlGraphicsItemNodeInstance::anchors() const
|
||||
{
|
||||
Q_ASSERT(dynamic_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(qmlGraphicsItem())));
|
||||
QDeclarativeItemPrivate *itemPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(qmlGraphicsItem()));
|
||||
return itemPrivate->anchors();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmlDesigner
|
||||
|
||||
@@ -68,6 +68,7 @@ public:
|
||||
protected:
|
||||
QmlGraphicsItemNodeInstance(QDeclarativeItem *item, bool hasContent);
|
||||
QDeclarativeItem *qmlGraphicsItem() const;
|
||||
QDeclarativeAnchors *anchors() const;
|
||||
void resetHorizontal();
|
||||
void resetVertical();
|
||||
|
||||
|
||||
@@ -28,22 +28,18 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "itemlibraryinfo.h"
|
||||
#include "model/internalproperty.h"
|
||||
#include "nodemetainfo.h"
|
||||
|
||||
#include <QSharedData>
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
#include <QtDebug>
|
||||
#include <QIcon>
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class ItemLibraryInfoData : public QSharedData
|
||||
class ItemLibraryEntryData : public QSharedData
|
||||
{
|
||||
public:
|
||||
ItemLibraryInfoData() : majorVersion(-1), minorVersion(-1)
|
||||
ItemLibraryEntryData() : majorVersion(-1), minorVersion(-1)
|
||||
{ }
|
||||
QString name;
|
||||
QString typeName;
|
||||
@@ -55,14 +51,31 @@ public:
|
||||
QList<PropertyContainer> properties;
|
||||
QString qml;
|
||||
};
|
||||
}
|
||||
|
||||
ItemLibraryInfo::ItemLibraryInfo(const ItemLibraryInfo &other)
|
||||
class ItemLibraryInfoPrivate
|
||||
{
|
||||
public:
|
||||
typedef QSharedPointer<ItemLibraryInfoPrivate> Pointer;
|
||||
typedef QSharedPointer<ItemLibraryInfoPrivate> WeakPointer;
|
||||
|
||||
QMultiHash<NodeMetaInfo, ItemLibraryEntry> itemLibraryInfoHash;
|
||||
QHash<QString, ItemLibraryEntry> itemLibraryInfoHashAll;
|
||||
|
||||
Pointer parentData;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
//
|
||||
// ItemLibraryEntry
|
||||
//
|
||||
|
||||
ItemLibraryEntry::ItemLibraryEntry(const ItemLibraryEntry &other)
|
||||
: m_data(other.m_data)
|
||||
{
|
||||
}
|
||||
|
||||
ItemLibraryInfo& ItemLibraryInfo::operator=(const ItemLibraryInfo &other)
|
||||
ItemLibraryEntry& ItemLibraryEntry::operator=(const ItemLibraryEntry &other)
|
||||
{
|
||||
if (this !=&other)
|
||||
m_data = other.m_data;
|
||||
@@ -70,139 +83,237 @@ ItemLibraryInfo& ItemLibraryInfo::operator=(const ItemLibraryInfo &other)
|
||||
return *this;
|
||||
}
|
||||
|
||||
void ItemLibraryInfo::setDragIcon(const QIcon &icon)
|
||||
void ItemLibraryEntry::setDragIcon(const QIcon &icon)
|
||||
{
|
||||
m_data->dragIcon = icon;
|
||||
}
|
||||
|
||||
QIcon ItemLibraryInfo::dragIcon() const
|
||||
QIcon ItemLibraryEntry::dragIcon() const
|
||||
{
|
||||
return m_data->dragIcon;
|
||||
}
|
||||
|
||||
void ItemLibraryInfo::addProperty(const Property &property)
|
||||
void ItemLibraryEntry::addProperty(const Property &property)
|
||||
{
|
||||
m_data->properties.append(property);
|
||||
}
|
||||
|
||||
QList<ItemLibraryInfo::Property> ItemLibraryInfo::properties() const
|
||||
QList<ItemLibraryEntry::Property> ItemLibraryEntry::properties() const
|
||||
{
|
||||
return m_data->properties;
|
||||
}
|
||||
|
||||
ItemLibraryInfo::ItemLibraryInfo() : m_data(new Internal::ItemLibraryInfoData)
|
||||
ItemLibraryEntry::ItemLibraryEntry() : m_data(new Internal::ItemLibraryEntryData)
|
||||
{
|
||||
m_data->name.clear();
|
||||
}
|
||||
|
||||
ItemLibraryInfo::~ItemLibraryInfo()
|
||||
ItemLibraryEntry::~ItemLibraryEntry()
|
||||
{
|
||||
}
|
||||
|
||||
QString ItemLibraryInfo::name() const
|
||||
QString ItemLibraryEntry::name() const
|
||||
{
|
||||
return m_data->name;
|
||||
}
|
||||
|
||||
QString ItemLibraryInfo::typeName() const
|
||||
QString ItemLibraryEntry::typeName() const
|
||||
{
|
||||
return m_data->typeName;
|
||||
}
|
||||
|
||||
QString ItemLibraryInfo::qml() const
|
||||
QString ItemLibraryEntry::qml() const
|
||||
{
|
||||
return m_data->qml;
|
||||
}
|
||||
|
||||
int ItemLibraryInfo::majorVersion() const
|
||||
int ItemLibraryEntry::majorVersion() const
|
||||
{
|
||||
return m_data->majorVersion;
|
||||
}
|
||||
|
||||
int ItemLibraryInfo::minorVersion() const
|
||||
int ItemLibraryEntry::minorVersion() const
|
||||
{
|
||||
return m_data->minorVersion;
|
||||
}
|
||||
|
||||
QString ItemLibraryInfo::category() const
|
||||
QString ItemLibraryEntry::category() const
|
||||
{
|
||||
return m_data->category;
|
||||
}
|
||||
|
||||
void ItemLibraryInfo::setCategory(const QString &category)
|
||||
void ItemLibraryEntry::setCategory(const QString &category)
|
||||
{
|
||||
m_data->category = category;
|
||||
}
|
||||
|
||||
QIcon ItemLibraryInfo::icon() const
|
||||
QIcon ItemLibraryEntry::icon() const
|
||||
{
|
||||
return m_data->icon;
|
||||
}
|
||||
|
||||
void ItemLibraryInfo::setName(const QString &name)
|
||||
void ItemLibraryEntry::setName(const QString &name)
|
||||
{
|
||||
m_data->name = name;
|
||||
}
|
||||
|
||||
void ItemLibraryInfo::setTypeName(const QString &typeName)
|
||||
void ItemLibraryEntry::setTypeName(const QString &typeName)
|
||||
{
|
||||
m_data->typeName = typeName;
|
||||
}
|
||||
|
||||
void ItemLibraryInfo::setIcon(const QIcon &icon)
|
||||
void ItemLibraryEntry::setIcon(const QIcon &icon)
|
||||
{
|
||||
m_data->icon = icon;
|
||||
}
|
||||
|
||||
void ItemLibraryInfo::setMajorVersion(int majorVersion)
|
||||
void ItemLibraryEntry::setMajorVersion(int majorVersion)
|
||||
{
|
||||
m_data->majorVersion = majorVersion;
|
||||
}
|
||||
|
||||
void ItemLibraryInfo::setMinorVersion(int minorVersion)
|
||||
void ItemLibraryEntry::setMinorVersion(int minorVersion)
|
||||
{
|
||||
m_data->minorVersion = minorVersion;
|
||||
}
|
||||
|
||||
void ItemLibraryInfo::setQml(const QString &qml)
|
||||
void ItemLibraryEntry::setQml(const QString &qml)
|
||||
{
|
||||
m_data->qml = qml;
|
||||
}
|
||||
|
||||
void ItemLibraryInfo::addProperty(QString &name, QString &type, QString &value)
|
||||
void ItemLibraryEntry::addProperty(QString &name, QString &type, QString &value)
|
||||
{
|
||||
Property property;
|
||||
property.set(name, type, value);
|
||||
addProperty(property);
|
||||
}
|
||||
|
||||
QDataStream& operator<<(QDataStream& stream, const ItemLibraryInfo& itemLibraryInfo)
|
||||
QDataStream& operator<<(QDataStream& stream, const ItemLibraryEntry &itemLibraryEntry)
|
||||
{
|
||||
stream << itemLibraryInfo.name();
|
||||
stream << itemLibraryInfo.typeName();
|
||||
stream << itemLibraryInfo.majorVersion();
|
||||
stream << itemLibraryInfo.minorVersion();
|
||||
stream << itemLibraryInfo.icon();
|
||||
stream << itemLibraryInfo.category();
|
||||
stream << itemLibraryInfo.dragIcon();
|
||||
stream << itemLibraryInfo.m_data->properties;
|
||||
stream << itemLibraryEntry.name();
|
||||
stream << itemLibraryEntry.typeName();
|
||||
stream << itemLibraryEntry.majorVersion();
|
||||
stream << itemLibraryEntry.minorVersion();
|
||||
stream << itemLibraryEntry.icon();
|
||||
stream << itemLibraryEntry.category();
|
||||
stream << itemLibraryEntry.dragIcon();
|
||||
stream << itemLibraryEntry.m_data->properties;
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
QDataStream& operator>>(QDataStream& stream, ItemLibraryInfo& itemLibraryInfo)
|
||||
QDataStream& operator>>(QDataStream& stream, ItemLibraryEntry &itemLibraryEntry)
|
||||
{
|
||||
stream >> itemLibraryInfo.m_data->name;
|
||||
stream >> itemLibraryInfo.m_data->typeName;
|
||||
stream >> itemLibraryInfo.m_data->majorVersion;
|
||||
stream >> itemLibraryInfo.m_data->minorVersion;
|
||||
stream >> itemLibraryInfo.m_data->icon;
|
||||
stream >> itemLibraryInfo.m_data->category;
|
||||
stream >> itemLibraryInfo.m_data->dragIcon;
|
||||
stream >> itemLibraryInfo.m_data->properties;
|
||||
stream >> itemLibraryEntry.m_data->name;
|
||||
stream >> itemLibraryEntry.m_data->typeName;
|
||||
stream >> itemLibraryEntry.m_data->majorVersion;
|
||||
stream >> itemLibraryEntry.m_data->minorVersion;
|
||||
stream >> itemLibraryEntry.m_data->icon;
|
||||
stream >> itemLibraryEntry.m_data->category;
|
||||
stream >> itemLibraryEntry.m_data->dragIcon;
|
||||
stream >> itemLibraryEntry.m_data->properties;
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
//
|
||||
// ItemLibraryInfo
|
||||
//
|
||||
|
||||
ItemLibraryInfo::ItemLibraryInfo(const ItemLibraryInfo &other) :
|
||||
m_data(other.m_data)
|
||||
{
|
||||
}
|
||||
|
||||
ItemLibraryInfo::ItemLibraryInfo() :
|
||||
m_data(new Internal::ItemLibraryInfoPrivate())
|
||||
{
|
||||
}
|
||||
|
||||
ItemLibraryInfo::~ItemLibraryInfo()
|
||||
{
|
||||
}
|
||||
|
||||
ItemLibraryInfo& ItemLibraryInfo::operator=(const ItemLibraryInfo &other)
|
||||
{
|
||||
m_data = other.m_data;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool ItemLibraryInfo::isValid()
|
||||
{
|
||||
return m_data;
|
||||
}
|
||||
|
||||
ItemLibraryInfo ItemLibraryInfo::createItemLibraryInfo(const ItemLibraryInfo &parentInfo)
|
||||
{
|
||||
ItemLibraryInfo info;
|
||||
Q_ASSERT(parentInfo.m_data);
|
||||
info.m_data->parentData = parentInfo.m_data;
|
||||
return info;
|
||||
}
|
||||
|
||||
QList<ItemLibraryEntry> ItemLibraryInfo::entriesForNodeMetaInfo(const NodeMetaInfo &nodeMetaInfo) const
|
||||
{
|
||||
QList<ItemLibraryEntry> itemLibraryItems;
|
||||
|
||||
Internal::ItemLibraryInfoPrivate::WeakPointer pointer(m_data);
|
||||
while (pointer) {
|
||||
itemLibraryItems += pointer->itemLibraryInfoHash.values(nodeMetaInfo);
|
||||
pointer = pointer->parentData;
|
||||
}
|
||||
return itemLibraryItems;
|
||||
}
|
||||
|
||||
ItemLibraryEntry ItemLibraryInfo::entry(const QString &name) const
|
||||
{
|
||||
Internal::ItemLibraryInfoPrivate::WeakPointer pointer(m_data);
|
||||
while (pointer) {
|
||||
if (pointer->itemLibraryInfoHashAll.contains(name))
|
||||
return pointer->itemLibraryInfoHashAll.value(name);
|
||||
pointer = pointer->parentData;
|
||||
}
|
||||
|
||||
return ItemLibraryEntry();
|
||||
}
|
||||
|
||||
|
||||
QList<ItemLibraryEntry> ItemLibraryInfo::entries() const
|
||||
{
|
||||
QList<ItemLibraryEntry> list;
|
||||
|
||||
Internal::ItemLibraryInfoPrivate::WeakPointer pointer(m_data);
|
||||
while (pointer) {
|
||||
list += pointer->itemLibraryInfoHashAll.values();
|
||||
pointer = pointer->parentData;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
ItemLibraryEntry ItemLibraryInfo::addItemLibraryEntry(const NodeMetaInfo &nodeMetaInfo,
|
||||
const QString &itemLibraryRepresentationName)
|
||||
{
|
||||
ItemLibraryEntry itemLibraryType;
|
||||
itemLibraryType.setName(itemLibraryRepresentationName);
|
||||
itemLibraryType.setTypeName(nodeMetaInfo.typeName());
|
||||
itemLibraryType.setMajorVersion(nodeMetaInfo.majorVersion());
|
||||
itemLibraryType.setMinorVersion(nodeMetaInfo.minorVersion());
|
||||
m_data->itemLibraryInfoHash.insert(nodeMetaInfo, itemLibraryType);
|
||||
m_data->itemLibraryInfoHashAll.insert(itemLibraryRepresentationName, itemLibraryType);
|
||||
return itemLibraryType;
|
||||
}
|
||||
|
||||
void ItemLibraryInfo::remove(const NodeMetaInfo &info)
|
||||
{
|
||||
m_data->itemLibraryInfoHash.remove(info);
|
||||
m_data->itemLibraryInfoHashAll.remove(info.typeName());
|
||||
}
|
||||
|
||||
void ItemLibraryInfo::clear()
|
||||
{
|
||||
m_data->itemLibraryInfoHash.clear();
|
||||
m_data->itemLibraryInfoHashAll.clear();
|
||||
}
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
||||
@@ -82,9 +82,8 @@ public:
|
||||
QMultiHash<QString, QString> m_superClassHash; // the list of direct superclasses
|
||||
QHash<QString, NodeMetaInfo> m_nodeMetaInfoHash;
|
||||
QHash<QString, EnumeratorMetaInfo> m_enumeratorMetaInfoHash;
|
||||
QMultiHash<NodeMetaInfo, ItemLibraryInfo> m_itemLibraryInfoHash;
|
||||
QHash<QString, ItemLibraryInfo> m_itemLibraryInfoHashAll;
|
||||
QHash<QString, QString> m_QtTypesToQmlTypes;
|
||||
ItemLibraryInfo m_itemLibraryInfo;
|
||||
|
||||
MetaInfo *m_q;
|
||||
bool m_isInitialized;
|
||||
@@ -94,6 +93,8 @@ MetaInfoPrivate::MetaInfoPrivate(MetaInfo *q) :
|
||||
m_q(q),
|
||||
m_isInitialized(false)
|
||||
{
|
||||
if (!m_q->isGlobal())
|
||||
m_itemLibraryInfo = ItemLibraryInfo::createItemLibraryInfo(m_q->global().itemLibraryInfo());
|
||||
}
|
||||
|
||||
void MetaInfoPrivate::clear()
|
||||
@@ -101,8 +102,7 @@ void MetaInfoPrivate::clear()
|
||||
m_superClassHash.clear();
|
||||
m_nodeMetaInfoHash.clear();
|
||||
m_enumeratorMetaInfoHash.clear();
|
||||
m_itemLibraryInfoHash.clear();
|
||||
m_itemLibraryInfoHashAll.clear();
|
||||
m_itemLibraryInfo.clear();
|
||||
m_isInitialized = false;
|
||||
}
|
||||
|
||||
@@ -492,23 +492,6 @@ QList<NodeMetaInfo> MetaInfo::directSuperClasses(const NodeMetaInfo &nodeInfo) c
|
||||
return superClassList;
|
||||
}
|
||||
|
||||
QList<ItemLibraryInfo> MetaInfo::itemLibraryRepresentations(const NodeMetaInfo &nodeMetaInfo) const
|
||||
{
|
||||
QList<ItemLibraryInfo> itemLibraryItems = m_p->m_itemLibraryInfoHash.values(nodeMetaInfo);
|
||||
if (!isGlobal())
|
||||
itemLibraryItems += global().itemLibraryRepresentations(nodeMetaInfo);
|
||||
return itemLibraryItems;
|
||||
}
|
||||
|
||||
ItemLibraryInfo MetaInfo::itemLibraryRepresentation(const QString &name) const
|
||||
{
|
||||
if (m_p->m_itemLibraryInfoHashAll.contains(name))
|
||||
return m_p->m_itemLibraryInfoHashAll.value(name);
|
||||
if (!isGlobal())
|
||||
return global().itemLibraryRepresentation(name);
|
||||
return ItemLibraryInfo();
|
||||
}
|
||||
|
||||
QString MetaInfo::fromQtTypes(const QString &type) const
|
||||
{
|
||||
if (m_p->m_QtTypesToQmlTypes.contains(type))
|
||||
@@ -517,21 +500,6 @@ QString MetaInfo::fromQtTypes(const QString &type) const
|
||||
return type;
|
||||
}
|
||||
|
||||
QStringList MetaInfo::itemLibraryItems() const
|
||||
{
|
||||
QStringList completeList = m_p->m_nodeMetaInfoHash.keys();
|
||||
QStringList finalList;
|
||||
foreach (const QString &name, completeList) {
|
||||
if (nodeMetaInfo(name).isVisibleToItemLibrary())
|
||||
finalList.append(name);
|
||||
}
|
||||
|
||||
if (!isGlobal())
|
||||
finalList += global().itemLibraryItems();
|
||||
|
||||
return finalList;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Returns whether className is the same type or a type derived from superClassName.
|
||||
*/
|
||||
@@ -574,6 +542,11 @@ EnumeratorMetaInfo MetaInfo::enumerator(const QString &enumeratorName) const
|
||||
return EnumeratorMetaInfo();
|
||||
}
|
||||
|
||||
ItemLibraryInfo MetaInfo::itemLibraryInfo() const
|
||||
{
|
||||
return m_p->m_itemLibraryInfo;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Access to the global meta information object.
|
||||
You almost always want to use Model::metaInfo() instead.
|
||||
@@ -643,8 +616,7 @@ void MetaInfo::removeNodeInfo(NodeMetaInfo &info)
|
||||
|
||||
m_p->m_superClassHash.remove(info.typeName());
|
||||
// TODO: Other types might specify type as parent type
|
||||
m_p->m_itemLibraryInfoHash.remove(info);
|
||||
m_p->m_itemLibraryInfoHashAll.remove(info.typeName());
|
||||
m_p->m_itemLibraryInfo.remove(info);
|
||||
|
||||
} else if (!isGlobal()) {
|
||||
global().removeNodeInfo(info);
|
||||
@@ -688,18 +660,6 @@ EnumeratorMetaInfo MetaInfo::addFlag(const QString &enumeratorScope, const QStri
|
||||
return enumeratorMetaInfo;
|
||||
}
|
||||
|
||||
ItemLibraryInfo MetaInfo::addItemLibraryInfo(const NodeMetaInfo &nodeMetaInfo, const QString &itemLibraryRepresentationName)
|
||||
{
|
||||
ItemLibraryInfo itemLibraryInfo;
|
||||
itemLibraryInfo.setName(itemLibraryRepresentationName);
|
||||
itemLibraryInfo.setTypeName(nodeMetaInfo.typeName());
|
||||
itemLibraryInfo.setMajorVersion(nodeMetaInfo.majorVersion());
|
||||
itemLibraryInfo.setMinorVersion(nodeMetaInfo.minorVersion());
|
||||
m_p->m_itemLibraryInfoHash.insert(nodeMetaInfo, itemLibraryInfo);
|
||||
m_p->m_itemLibraryInfoHashAll.insert(itemLibraryRepresentationName, itemLibraryInfo);
|
||||
return itemLibraryInfo;
|
||||
}
|
||||
|
||||
bool MetaInfo::isGlobal() const
|
||||
{
|
||||
return (this->m_p == s_global.m_p);
|
||||
@@ -714,4 +674,5 @@ bool operator!=(const MetaInfo &first, const MetaInfo &second)
|
||||
{
|
||||
return !(first == second);
|
||||
}
|
||||
|
||||
} //namespace QmlDesigner
|
||||
|
||||
@@ -179,16 +179,6 @@ void MetaInfoParser::handleNodeElement(QXmlStreamReader &reader)
|
||||
nodeMetaInfo.setIsContainer(stringToBool(isContainer));
|
||||
}
|
||||
|
||||
if (attributes.hasAttribute("showInItemLibrary")) {
|
||||
const QString showInItemLibrary = attributes.value("showInItemLibrary").toString();
|
||||
nodeMetaInfo.setIsVisibleToItemLibrary(stringToBool(showInItemLibrary));
|
||||
}
|
||||
|
||||
if (attributes.hasAttribute("category")) {
|
||||
const QString category = attributes.value("category").toString();
|
||||
nodeMetaInfo.setCategory(category);
|
||||
}
|
||||
|
||||
if (attributes.hasAttribute("icon")) {
|
||||
const QString iconPath = reader.attributes().value("icon").toString();
|
||||
nodeMetaInfo.setIcon(QIcon(iconPath));
|
||||
@@ -200,29 +190,33 @@ void MetaInfoParser::handleNodeElement(QXmlStreamReader &reader)
|
||||
handleNodeInheritElement(reader, className);
|
||||
handleAbstractPropertyElement(reader, nodeMetaInfo);
|
||||
handleAbstractPropertyDefaultValueElement(reader, nodeMetaInfo);
|
||||
handleNodeItemLibraryRepresentationElement(reader, className);
|
||||
handleNodeItemLibraryEntryElement(reader, className);
|
||||
}
|
||||
}
|
||||
|
||||
void MetaInfoParser::handleNodeItemLibraryRepresentationElement(QXmlStreamReader &reader, const QString & className)
|
||||
void MetaInfoParser::handleNodeItemLibraryEntryElement(QXmlStreamReader &reader, const QString & className)
|
||||
{
|
||||
if (reader.isStartElement() && reader.name() == "itemlibraryrepresentation")
|
||||
if (reader.isStartElement() && reader.name() == "itemlibraryentry")
|
||||
{
|
||||
QString name = reader.attributes().value("name").toString();
|
||||
ItemLibraryInfo ItemLibraryInfo = m_metaInfo.addItemLibraryInfo(m_metaInfo.nodeMetaInfo(className), name);
|
||||
ItemLibraryEntry itemLibraryEntry = m_metaInfo.itemLibraryInfo().addItemLibraryEntry(m_metaInfo.nodeMetaInfo(className), name);
|
||||
|
||||
QString iconPath = reader.attributes().value("icon").toString();
|
||||
if (!iconPath.isEmpty())
|
||||
ItemLibraryInfo.setIcon(QIcon(iconPath));
|
||||
itemLibraryEntry.setIcon(QIcon(iconPath));
|
||||
|
||||
while (!reader.atEnd() && !(reader.isEndElement() && reader.name() == "itemlibraryrepresentation")) {
|
||||
QString category = reader.attributes().value("category").toString();
|
||||
if (!category.isEmpty())
|
||||
itemLibraryEntry.setCategory(category);
|
||||
|
||||
while (!reader.atEnd() && !(reader.isEndElement() && reader.name() == "itemlibraryentry")) {
|
||||
reader.readNext();
|
||||
handleItemLibraryInfoPropertyElement(reader, ItemLibraryInfo);
|
||||
handleItemLibraryEntryPropertyElement(reader, itemLibraryEntry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MetaInfoParser::handleNodeInheritElement(QXmlStreamReader &reader, const QString & className)
|
||||
void MetaInfoParser::handleNodeInheritElement(QXmlStreamReader &reader, const QString &className)
|
||||
{
|
||||
if (reader.isStartElement() && reader.name() == "inherits")
|
||||
{
|
||||
@@ -233,7 +227,7 @@ void MetaInfoParser::handleNodeInheritElement(QXmlStreamReader &reader, const QS
|
||||
}
|
||||
}
|
||||
|
||||
void MetaInfoParser::handleItemLibraryInfoPropertyElement(QXmlStreamReader &reader, ItemLibraryInfo &ItemLibraryInfo)
|
||||
void MetaInfoParser::handleItemLibraryEntryPropertyElement(QXmlStreamReader &reader, ItemLibraryEntry &itemLibraryEntry)
|
||||
{
|
||||
if (reader.isStartElement() && reader.name() == "property")
|
||||
{
|
||||
@@ -241,7 +235,7 @@ void MetaInfoParser::handleItemLibraryInfoPropertyElement(QXmlStreamReader &read
|
||||
QString name = attributes.value("name").toString();
|
||||
QString type = attributes.value("type").toString();
|
||||
QString value = attributes.value("value").toString();
|
||||
ItemLibraryInfo.addProperty(name, type, value);
|
||||
itemLibraryEntry.addProperty(name, type, value);
|
||||
|
||||
reader.readNext();
|
||||
}
|
||||
|
||||
@@ -62,7 +62,6 @@ public:
|
||||
NodeMetaInfoData(const MetaInfo &metaInfo) :
|
||||
metaInfo(metaInfo),
|
||||
isContainer(false),
|
||||
isVisibleToItemLibrary(false),
|
||||
isFXItem(Unknown),
|
||||
icon(),
|
||||
category("misc")
|
||||
@@ -71,7 +70,6 @@ public:
|
||||
MetaInfo metaInfo;
|
||||
QString typeName;
|
||||
bool isContainer;
|
||||
bool isVisibleToItemLibrary;
|
||||
TristateBoolean isFXItem;
|
||||
QHash<QString, PropertyMetaInfo> propertyMetaInfoHash;
|
||||
QIcon icon;
|
||||
@@ -547,15 +545,6 @@ bool NodeMetaInfo::isContainer() const
|
||||
return m_data->isContainer;
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isVisibleToItemLibrary() const
|
||||
{
|
||||
if (!isValid()) {
|
||||
qWarning() << "NodeMetaInfo is invalid";
|
||||
return false;
|
||||
}
|
||||
return m_data->isVisibleToItemLibrary;
|
||||
}
|
||||
|
||||
void NodeMetaInfo::setIsContainer(bool isContainer)
|
||||
{
|
||||
if (!isValid()) {
|
||||
@@ -565,15 +554,6 @@ void NodeMetaInfo::setIsContainer(bool isContainer)
|
||||
m_data->isContainer = isContainer;
|
||||
}
|
||||
|
||||
void NodeMetaInfo::setIsVisibleToItemLibrary(bool isVisibleToItemLibrary)
|
||||
{
|
||||
if (!isValid()) {
|
||||
qWarning() << "NodeMetaInfo is invalid";
|
||||
return;
|
||||
}
|
||||
m_data->isVisibleToItemLibrary = isVisibleToItemLibrary;
|
||||
}
|
||||
|
||||
QIcon NodeMetaInfo::icon() const
|
||||
{
|
||||
if (!isValid()) {
|
||||
@@ -583,15 +563,6 @@ QIcon NodeMetaInfo::icon() const
|
||||
return m_data->icon;
|
||||
}
|
||||
|
||||
QString NodeMetaInfo::category() const
|
||||
{
|
||||
if (!isValid()) {
|
||||
qWarning() << "NodeMetaInfo is invalid";
|
||||
return QString();
|
||||
}
|
||||
return m_data->category;
|
||||
}
|
||||
|
||||
void NodeMetaInfo::setIcon(const QIcon &icon)
|
||||
{
|
||||
if (!isValid()) {
|
||||
@@ -601,15 +572,6 @@ void NodeMetaInfo::setIcon(const QIcon &icon)
|
||||
m_data->icon = icon;
|
||||
}
|
||||
|
||||
void NodeMetaInfo::setCategory(const QString &category)
|
||||
{
|
||||
if (!isValid()) {
|
||||
qWarning() << "NodeMetaInfo is invalid";
|
||||
return;
|
||||
}
|
||||
m_data->category = category;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Returns whether the type inherits from "QWidget".
|
||||
|
||||
|
||||
@@ -42,17 +42,13 @@ enum { debug = false };
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
// Allow usage of QFileInfo in hash / qSort
|
||||
// Allow usage of QFileInfo in qSort
|
||||
|
||||
static bool operator<(const QFileInfo &file1, const QFileInfo &file2)
|
||||
{
|
||||
return file1.filePath() < file2.filePath();
|
||||
}
|
||||
|
||||
static uint qHash(const QFileInfo &fileInfo)
|
||||
{
|
||||
return qHash(fileInfo.filePath());
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
@@ -73,11 +69,11 @@ public:
|
||||
void parseDirectories();
|
||||
|
||||
public slots:
|
||||
void parseDirectory(const QString &dirPath);
|
||||
void parseFile(const QString &filePath);
|
||||
void parseDirectory(const QString &canonicalDirPath);
|
||||
void parseFile(const QString &canonicalFilePath);
|
||||
|
||||
public:
|
||||
QList<QFileInfo> watchedFiles(const QDir &dirInfo);
|
||||
QList<QFileInfo> watchedFiles(const QString &canonicalDirPath);
|
||||
void unregisterQmlFile(const QFileInfo &fileInfo, const QString &qualifier);
|
||||
void registerQmlFile(const QFileInfo &fileInfo, const QString &qualifier, const QDeclarativeDomDocument &document);
|
||||
|
||||
@@ -88,7 +84,8 @@ public:
|
||||
|
||||
QFileSystemWatcher m_watcher;
|
||||
|
||||
QMultiHash<QFileInfo,QString> m_dirToQualifier;
|
||||
// key: canonical directory path
|
||||
QMultiHash<QString,QString> m_dirToQualifier;
|
||||
|
||||
QUrl m_filePath;
|
||||
|
||||
@@ -111,8 +108,9 @@ void SubComponentManagerPrivate::addImport(int pos, const QDeclarativeDomImport
|
||||
if (import.type() == QDeclarativeDomImport::File) {
|
||||
QFileInfo dirInfo = QFileInfo(m_filePath.resolved(import.uri()).toLocalFile());
|
||||
if (dirInfo.exists() && dirInfo.isDir()) {
|
||||
m_watcher.addPath(dirInfo.filePath());
|
||||
m_dirToQualifier.insertMulti(dirInfo, import.qualifier());
|
||||
const QString canonicalDirPath = dirInfo.canonicalFilePath();
|
||||
m_watcher.addPath(canonicalDirPath);
|
||||
m_dirToQualifier.insertMulti(canonicalDirPath, import.qualifier());
|
||||
}
|
||||
} else {
|
||||
// TODO: QDeclarativeDomImport::Library
|
||||
@@ -126,15 +124,16 @@ void SubComponentManagerPrivate::removeImport(int pos)
|
||||
const QDeclarativeDomImport import = m_imports.takeAt(pos);
|
||||
|
||||
if (import.type() == QDeclarativeDomImport::File) {
|
||||
QFileInfo dirInfo = QFileInfo(m_filePath.resolved(import.uri()).toLocalFile());
|
||||
const QFileInfo dirInfo = QFileInfo(m_filePath.resolved(import.uri()).toLocalFile());
|
||||
const QString canonicalDirPath = dirInfo.canonicalFilePath();
|
||||
|
||||
m_dirToQualifier.remove(dirInfo, import.qualifier());
|
||||
m_dirToQualifier.remove(canonicalDirPath, import.qualifier());
|
||||
|
||||
if (!m_dirToQualifier.contains(dirInfo))
|
||||
m_watcher.removePath(dirInfo.filePath());
|
||||
if (!m_dirToQualifier.contains(canonicalDirPath))
|
||||
m_watcher.removePath(canonicalDirPath);
|
||||
|
||||
foreach (const QFileInfo &monitoredFile, watchedFiles(dirInfo.filePath())) {
|
||||
if (!m_dirToQualifier.contains(dirInfo))
|
||||
foreach (const QFileInfo &monitoredFile, watchedFiles(canonicalDirPath)) {
|
||||
if (!m_dirToQualifier.contains(canonicalDirPath))
|
||||
m_watcher.removePath(monitoredFile.filePath());
|
||||
unregisterQmlFile(monitoredFile, import.qualifier());
|
||||
}
|
||||
@@ -149,30 +148,30 @@ void SubComponentManagerPrivate::parseDirectories()
|
||||
const QString file = m_filePath.toLocalFile();
|
||||
QFileInfo dirInfo = QFileInfo(QFileInfo(file).path());
|
||||
if (dirInfo.exists() && dirInfo.isDir())
|
||||
parseDirectory(dirInfo.filePath());
|
||||
parseDirectory(dirInfo.canonicalFilePath());
|
||||
}
|
||||
|
||||
foreach (const QDeclarativeDomImport &import, m_imports) {
|
||||
if (import.type() == QDeclarativeDomImport::File) {
|
||||
QFileInfo dirInfo = QFileInfo(m_filePath.resolved(import.uri()).toLocalFile());
|
||||
if (dirInfo.exists() && dirInfo.isDir()) {
|
||||
parseDirectory(dirInfo.filePath());
|
||||
parseDirectory(dirInfo.canonicalFilePath());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SubComponentManagerPrivate::parseDirectory(const QString &dirPath)
|
||||
void SubComponentManagerPrivate::parseDirectory(const QString &canonicalDirPath)
|
||||
{
|
||||
if (debug)
|
||||
qDebug() << Q_FUNC_INFO << dirPath;
|
||||
qDebug() << Q_FUNC_INFO << canonicalDirPath;
|
||||
|
||||
QDir dir(dirPath);
|
||||
QDir dir(canonicalDirPath);
|
||||
|
||||
dir.setNameFilters(QStringList(QMLFILEPATTERN));
|
||||
dir.setFilter(QDir::Files | QDir::Readable | QDir::CaseSensitive);
|
||||
|
||||
QList<QFileInfo> monitoredList = watchedFiles(dir);
|
||||
QList<QFileInfo> monitoredList = watchedFiles(canonicalDirPath);
|
||||
QList<QFileInfo> newList;
|
||||
foreach (const QFileInfo &qmlFile, dir.entryInfoList()) {
|
||||
if (QFileInfo(m_filePath.toLocalFile()) == qmlFile) {
|
||||
@@ -203,7 +202,7 @@ void SubComponentManagerPrivate::parseDirectory(const QString &dirPath)
|
||||
continue;
|
||||
}
|
||||
if (oldFileInfo < newFileInfo) {
|
||||
foreach (const QString &qualifier, m_dirToQualifier.value(dirPath))
|
||||
foreach (const QString &qualifier, m_dirToQualifier.value(canonicalDirPath))
|
||||
unregisterQmlFile(oldFileInfo, qualifier);
|
||||
m_watcher.removePath(oldFileInfo.filePath());
|
||||
++oldIter;
|
||||
@@ -216,7 +215,7 @@ void SubComponentManagerPrivate::parseDirectory(const QString &dirPath)
|
||||
}
|
||||
|
||||
while (oldIter != monitoredList.constEnd()) {
|
||||
foreach (const QString &qualifier, m_dirToQualifier.value(dirPath))
|
||||
foreach (const QString &qualifier, m_dirToQualifier.value(canonicalDirPath))
|
||||
unregisterQmlFile(*oldIter, qualifier);
|
||||
m_watcher.removePath(oldIter->filePath());
|
||||
++oldIter;
|
||||
@@ -231,37 +230,37 @@ void SubComponentManagerPrivate::parseDirectory(const QString &dirPath)
|
||||
}
|
||||
}
|
||||
|
||||
void SubComponentManagerPrivate::parseFile(const QString &filePath)
|
||||
void SubComponentManagerPrivate::parseFile(const QString &canonicalFilePath)
|
||||
{
|
||||
if (debug)
|
||||
qDebug() << Q_FUNC_INFO << filePath;
|
||||
qDebug() << Q_FUNC_INFO << canonicalFilePath;
|
||||
|
||||
QFile file(filePath);
|
||||
QFile file(canonicalFilePath);
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
return;
|
||||
}
|
||||
|
||||
QDeclarativeDomDocument document;
|
||||
if (!document.load(&m_engine, file.readAll(), QUrl::fromLocalFile(filePath))) {
|
||||
if (!document.load(&m_engine, file.readAll(), QUrl::fromLocalFile(canonicalFilePath))) {
|
||||
// TODO: Put the errors somewhere?
|
||||
qWarning() << "Could not load qml file " << filePath;
|
||||
qWarning() << "Could not load qml file " << canonicalFilePath;
|
||||
return;
|
||||
}
|
||||
|
||||
QFileInfo dir = QFileInfo(filePath).absolutePath();
|
||||
QString dir = QFileInfo(canonicalFilePath).path();
|
||||
foreach (const QString &qualifier, m_dirToQualifier.values(dir)) {
|
||||
registerQmlFile(filePath, qualifier, document);
|
||||
registerQmlFile(canonicalFilePath, qualifier, document);
|
||||
}
|
||||
}
|
||||
|
||||
QList<QFileInfo> SubComponentManagerPrivate::watchedFiles(const QDir &dirInfo)
|
||||
// dirInfo must already contain a canonical path
|
||||
QList<QFileInfo> SubComponentManagerPrivate::watchedFiles(const QString &canonicalDirPath)
|
||||
{
|
||||
QList<QFileInfo> files;
|
||||
|
||||
const QString dirPath = dirInfo.absolutePath();
|
||||
foreach (const QString &monitoredFile, m_watcher.files()) {
|
||||
QFileInfo fileInfo(monitoredFile);
|
||||
if (fileInfo.dir().absolutePath() == dirPath) {
|
||||
if (fileInfo.dir().absolutePath() == canonicalDirPath) {
|
||||
files.append(fileInfo);
|
||||
}
|
||||
}
|
||||
@@ -304,10 +303,9 @@ void SubComponentManagerPrivate::registerQmlFile(const QFileInfo &fileInfo, cons
|
||||
nodeInfo.setQmlFile(fileInfo.filePath());
|
||||
|
||||
// Add file components to the library
|
||||
nodeInfo.setCategory(tr("QML Components"));
|
||||
nodeInfo.setIsVisibleToItemLibrary(true);
|
||||
ItemLibraryEntry itemLibType = m_metaInfo.itemLibraryInfo().addItemLibraryEntry(nodeInfo, componentName);
|
||||
itemLibType.setCategory(tr("QML Components"));
|
||||
|
||||
m_metaInfo.addItemLibraryInfo(nodeInfo, componentName);
|
||||
m_metaInfo.addNodeInfo(nodeInfo, baseType);
|
||||
|
||||
foreach (const QDeclarativeDomDynamicProperty &dynamicProperty, document.rootObject().dynamicProperties()) {
|
||||
@@ -405,14 +403,14 @@ void SubComponentManager::update(const QUrl &filePath, const QList<QDeclarativeD
|
||||
//
|
||||
if (oldDir != newDir) {
|
||||
if (!oldDir.filePath().isEmpty()) {
|
||||
m_d->m_dirToQualifier.remove(oldDir, QString());
|
||||
if (!m_d->m_dirToQualifier.contains(oldDir))
|
||||
m_d->m_dirToQualifier.remove(oldDir.canonicalFilePath(), QString());
|
||||
if (!m_d->m_dirToQualifier.contains(oldDir.canonicalFilePath()))
|
||||
m_d->m_watcher.removePath(oldDir.filePath());
|
||||
}
|
||||
|
||||
if (!newDir.filePath().isEmpty()) {
|
||||
m_d->m_watcher.addPath(newDir.filePath());
|
||||
m_d->m_dirToQualifier.insertMulti(newDir, QString());
|
||||
m_d->m_dirToQualifier.insertMulti(newDir.canonicalFilePath(), QString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ QmlItemNode QmlModelView::createQmlItemNodeFromImage(const QString &imageName, c
|
||||
return newNode;
|
||||
}
|
||||
|
||||
QmlItemNode QmlModelView::createQmlItemNode(const ItemLibraryInfo &itemLibraryRepresentation, const QPointF &position, QmlItemNode parentNode)
|
||||
QmlItemNode QmlModelView::createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry, const QPointF &position, QmlItemNode parentNode)
|
||||
{
|
||||
if (!parentNode.isValid())
|
||||
parentNode = rootQmlItemNode();
|
||||
@@ -148,17 +148,17 @@ QmlItemNode QmlModelView::createQmlItemNode(const ItemLibraryInfo &itemLibraryRe
|
||||
propertyPairList.append(qMakePair(QString("x"), QVariant(round(position.x(), 4))));
|
||||
propertyPairList.append(qMakePair(QString("y"), QVariant(round(position.y(), 4))));
|
||||
|
||||
foreach (const PropertyContainer &property, itemLibraryRepresentation.properties())
|
||||
foreach (const PropertyContainer &property, itemLibraryEntry.properties())
|
||||
propertyPairList.append(qMakePair(property.name(), property.value()));
|
||||
|
||||
newNode = createQmlItemNode(itemLibraryRepresentation.typeName(), itemLibraryRepresentation.majorVersion(), itemLibraryRepresentation.minorVersion(), propertyPairList);
|
||||
newNode = createQmlItemNode(itemLibraryEntry.typeName(), itemLibraryEntry.majorVersion(), itemLibraryEntry.minorVersion(), propertyPairList);
|
||||
parentNode.nodeAbstractProperty("data").reparentHere(newNode);
|
||||
|
||||
Q_ASSERT(newNode.isValid());
|
||||
|
||||
QString id;
|
||||
int i = 1;
|
||||
QString name(itemLibraryRepresentation.name().toLower());
|
||||
QString name(itemLibraryEntry.name().toLower());
|
||||
name.remove(QLatin1Char(' '));
|
||||
do {
|
||||
id = name + QString::number(i);
|
||||
|
||||
@@ -1,124 +1,124 @@
|
||||
<metainfo>
|
||||
<node name="Qt/Item" showInItemLibrary="true" category="Qt - Basic" isContainer="true" icon=":/fxplugin/images/item-icon16.png">
|
||||
<node name="Qt/Item" isContainer="true" icon=":/fxplugin/images/item-icon16.png">
|
||||
<propertyDefaultValue name="width" type="int" defaultValue="600"/>
|
||||
<propertyDefaultValue name="height" type="int" defaultValue="400"/>
|
||||
<itemlibraryrepresentation name="Item" icon=":/fxplugin/images/item-icon.png">
|
||||
<itemlibraryentry name="Item" category="Qt - Basic" icon=":/fxplugin/images/item-icon.png">
|
||||
<property name="width" type="int" value="200"/>
|
||||
<property name="height" type="int" value="200"/>
|
||||
</itemlibraryrepresentation>
|
||||
</itemlibraryentry>
|
||||
</node>
|
||||
<node name="Qt/Rectangle" showInItemLibrary="true" category="Qt - Basic" isContainer="true" icon=":/fxplugin/images/rect-icon16.png">
|
||||
<itemlibraryrepresentation name="Rectangle" icon=":/fxplugin/images/rect-icon.png">
|
||||
<node name="Qt/Rectangle" category="Qt - Basic" isContainer="true" icon=":/fxplugin/images/rect-icon16.png">
|
||||
<itemlibraryentry name="Rectangle" category="Qt - Basic" icon=":/fxplugin/images/rect-icon.png">
|
||||
<property name="width" type="int" value="100"/>
|
||||
<property name="height" type="int" value="100"/>
|
||||
<property name="color" type="QColor" value="#ffffff"/>
|
||||
</itemlibraryrepresentation>
|
||||
</itemlibraryentry>
|
||||
</node>
|
||||
<node name="Qt/Text" showInItemLibrary="true" category="Qt - Basic" icon=":/fxplugin/images/text-icon16.png">
|
||||
<node name="Qt/Text" icon=":/fxplugin/images/text-icon16.png">
|
||||
<propertyDefaultValue name="width" type="int" defaultValue="80"/>
|
||||
<propertyDefaultValue name="height" type="int" defaultValue="20"/>
|
||||
<itemlibraryrepresentation name="Text" icon=":/fxplugin/images/text-icon.png">
|
||||
<itemlibraryentry name="Text" category="Qt - Basic" icon=":/fxplugin/images/text-icon.png">
|
||||
<property name="width" type="int" value="80"/>
|
||||
<property name="height" type="int" value="20"/>
|
||||
<property name="text" type="QString" value="text"/>
|
||||
</itemlibraryrepresentation>
|
||||
</itemlibraryentry>
|
||||
</node>
|
||||
<node name="Qt/TextEdit" showInItemLibrary="true" category="Qt - Basic" isContainer="false" icon=":/fxplugin/images/text-edit-icon16.png">
|
||||
<node name="Qt/TextEdit" isContainer="false" icon=":/fxplugin/images/text-edit-icon16.png">
|
||||
<propertyDefaultValue name="width" type="int" defaultValue="80"/>
|
||||
<propertyDefaultValue name="height" type="int" defaultValue="20"/>
|
||||
<itemlibraryrepresentation name="Text Edit" icon=":/fxplugin/images/text-edit-icon.png">
|
||||
<itemlibraryentry name="Text Edit" category="Qt - Basic" icon=":/fxplugin/images/text-edit-icon.png">
|
||||
<property name="width" type="int" value="80"/>
|
||||
<property name="height" type="int" value="20"/>
|
||||
<property name="text" type="QString" value="textEdit"/>
|
||||
</itemlibraryrepresentation>
|
||||
</itemlibraryentry>
|
||||
</node>
|
||||
<node name="Qt/TextInput" showInItemLibrary="true" category="Qt - Basic" isContainer="false" icon=":/fxplugin/images/text-input-icon16.png">
|
||||
<node name="Qt/TextInput" isContainer="false" icon=":/fxplugin/images/text-input-icon16.png">
|
||||
<propertyDefaultValue name="width" type="int" defaultValue="80"/>
|
||||
<propertyDefaultValue name="height" type="int" defaultValue="20"/>
|
||||
<itemlibraryrepresentation name="Text Input" icon=":/fxplugin/images/text-input-icon.png">
|
||||
<itemlibraryentry name="Text Input" category="Qt - Basic" icon=":/fxplugin/images/text-input-icon.png">
|
||||
<property name="width" type="int" value="80"/>
|
||||
<property name="height" type="int" value="20"/>
|
||||
<property name="text" type="QString" value="textInput"/>
|
||||
</itemlibraryrepresentation>
|
||||
</itemlibraryentry>
|
||||
</node>
|
||||
<node name="Qt/MouseArea" showInItemLibrary="true" category="Qt - Interaction" icon=":/fxplugin/images/mouse-area-icon16.png">
|
||||
<node name="Qt/MouseArea" icon=":/fxplugin/images/mouse-area-icon16.png">
|
||||
<inherits name="Item" />
|
||||
<itemlibraryrepresentation name="Mouse Area" icon=":/fxplugin/images/mouse-area-icon.png">
|
||||
<itemlibraryentry name="Mouse Area" category="Qt - Interaction" icon=":/fxplugin/images/mouse-area-icon.png">
|
||||
<property name="width" type="int" value="100"/>
|
||||
<property name="height" type="int" value="100"/>
|
||||
</itemlibraryrepresentation>
|
||||
</itemlibraryentry>
|
||||
</node>
|
||||
<node name="Qt/Image" showInItemLibrary="true" category="Qt - Basic" isContainer="true" icon=":/fxplugin/images/image-icon16.png">
|
||||
<node name="Qt/Image" isContainer="true" icon=":/fxplugin/images/image-icon16.png">
|
||||
<propertyDefaultValue name="width" type="int" defaultValue="200"/>
|
||||
<propertyDefaultValue name="height" type="int" defaultValue="200"/>
|
||||
<itemlibraryrepresentation name="Image" icon=":/fxplugin/images/image-icon.png">
|
||||
<itemlibraryentry name="Image" category="Qt - Basic" icon=":/fxplugin/images/image-icon.png">
|
||||
<property name="width" type="int" value="100"/>
|
||||
<property name="height" type="int" value="100"/>
|
||||
<property name="source" type="QUrl" value="qrc:/fxplugin/images/template_image.png"/>
|
||||
</itemlibraryrepresentation>
|
||||
</itemlibraryentry>
|
||||
</node>
|
||||
<node name="Qt/BorderImage" showInItemLibrary="true" category="Qt - Basic" icon=":/fxplugin/images/border-image-icon16.png">
|
||||
<node name="Qt/BorderImage" icon=":/fxplugin/images/border-image-icon16.png">
|
||||
<propertyDefaultValue name="width" type="int" defaultValue="200"/>
|
||||
<propertyDefaultValue name="height" type="int" defaultValue="200"/>
|
||||
<itemlibraryrepresentation name="Border Image" icon=":/fxplugin/images/border-image-icon.png">
|
||||
<itemlibraryentry name="Border Image" category="Qt - Basic" icon=":/fxplugin/images/border-image-icon.png">
|
||||
<property name="width" type="int" value="100"/>
|
||||
<property name="height" type="int" value="100"/>
|
||||
<property name="source" type="QUrl" value="qrc:/fxplugin/images/template_image.png"/>
|
||||
</itemlibraryrepresentation>
|
||||
</itemlibraryentry>
|
||||
</node>
|
||||
<node name="Qt/Flickable" showInItemLibrary="true" category="Qt - Widgets" icon=":/fxplugin/images/flickable-icon16.png">
|
||||
<node name="Qt/Flickable" icon=":/fxplugin/images/flickable-icon16.png">
|
||||
<propertyDefaultValue name="width" type="int" defaultValue="300"/>
|
||||
<propertyDefaultValue name="height" type="int" defaultValue="300"/>
|
||||
<itemlibraryrepresentation name="Flickable" icon=":/fxplugin/images/flickable-icon.png">
|
||||
<itemlibraryentry name="Flickable" category="Qt - Widgets" icon=":/fxplugin/images/flickable-icon.png">
|
||||
<property name="width" type="int" value="300"/>
|
||||
<property name="height" type="int" value="300"/>
|
||||
</itemlibraryrepresentation>
|
||||
</itemlibraryentry>
|
||||
</node>
|
||||
<node name="Qt/Flipable" showInItemLibrary="true" category="Qt - Widgets" icon=":/fxplugin/images/flipable-icon16.png">
|
||||
<node name="Qt/Flipable" icon=":/fxplugin/images/flipable-icon16.png">
|
||||
<propertyDefaultValue name="width" type="int" defaultValue="300"/>
|
||||
<propertyDefaultValue name="height" type="int" defaultValue="300"/>
|
||||
<itemlibraryrepresentation name="Flipable" icon=":/fxplugin/images/flipable-icon.png">
|
||||
<itemlibraryentry name="Flipable" category="Qt - Widgets" icon=":/fxplugin/images/flipable-icon.png">
|
||||
<property name="width" type="int" value="300"/>
|
||||
<property name="height" type="int" value="300"/>
|
||||
</itemlibraryrepresentation>
|
||||
</itemlibraryentry>
|
||||
</node>
|
||||
<node name="Qt/GridView" showInItemLibrary="true" category="Qt - Views" icon=":/fxplugin/images/gridview-icon16.png">
|
||||
<itemlibraryrepresentation name="Grid View" icon=":/fxplugin/images/gridview-icon.png">
|
||||
<node name="Qt/GridView" icon=":/fxplugin/images/gridview-icon16.png">
|
||||
<itemlibraryentry name="Grid View" category="Qt - Views" icon=":/fxplugin/images/gridview-icon.png">
|
||||
<property name="width" type="int" value="300"/>
|
||||
<property name="height" type="int" value="300"/>
|
||||
</itemlibraryrepresentation>
|
||||
</itemlibraryentry>
|
||||
</node>
|
||||
|
||||
<node name="Qt/ListView" showInItemLibrary="true" category="Qt - Views" icon=":/fxplugin/images/listview-icon16.png">
|
||||
<itemlibraryrepresentation name="List View" icon=":/fxplugin/images/listview-icon.png">
|
||||
<node name="Qt/ListView" icon=":/fxplugin/images/listview-icon16.png">
|
||||
<itemlibraryentry name="List View" category="Qt - Views" icon=":/fxplugin/images/listview-icon.png">
|
||||
<property name="width" type="int" value="300"/>
|
||||
<property name="height" type="int" value="300"/>
|
||||
</itemlibraryrepresentation>
|
||||
</itemlibraryentry>
|
||||
</node>
|
||||
|
||||
<node name="Qt/PathView" showInItemLibrary="true" category="Qt - Views" icon=":/fxplugin/images/pathview-icon16.png">
|
||||
<itemlibraryrepresentation name="Path View" icon=":/fxplugin/images/pathview-icon.png">
|
||||
<node name="Qt/PathView" icon=":/fxplugin/images/pathview-icon16.png">
|
||||
<itemlibraryentry name="Path View" category="Qt - Views" icon=":/fxplugin/images/pathview-icon.png">
|
||||
<property name="width" type="int" value="300"/>
|
||||
<property name="height" type="int" value="300"/>
|
||||
</itemlibraryrepresentation>
|
||||
</itemlibraryentry>
|
||||
</node>
|
||||
|
||||
<node name="Qt/FocusScope" showInItemLibrary="true" category="Qt - Interaction" icon=":/fxplugin/images/focusscope-icon16.png">
|
||||
<node name="Qt/FocusScope" icon=":/fxplugin/images/focusscope-icon16.png">
|
||||
<propertyDefaultValue name="width" type="int" defaultValue="100"/>
|
||||
<propertyDefaultValue name="height" type="int" defaultValue="100"/>
|
||||
<itemlibraryrepresentation name="Focus Scope" icon=":/fxplugin/images/focusscope-icon.png">
|
||||
<itemlibraryentry name="Focus Scope" category="Qt - Interaction" icon=":/fxplugin/images/focusscope-icon.png">
|
||||
<property name="width" type="int" value="100"/>
|
||||
<property name="height" type="int" value="100"/>
|
||||
</itemlibraryrepresentation>
|
||||
</itemlibraryentry>
|
||||
</node>
|
||||
|
||||
<node name="Qt/WebView" showInItemLibrary="true" category="Qt - Widgets" icon=":/fxplugin/images/webview-icon16.png">
|
||||
<node name="Qt/WebView" icon=":/fxplugin/images/webview-icon16.png">
|
||||
<propertyDefaultValue name="width" type="int" defaultValue="300"/>
|
||||
<propertyDefaultValue name="height" type="int" defaultValue="300"/>
|
||||
<itemlibraryrepresentation name="Web View" icon=":/fxplugin/images/webview-icon.png">
|
||||
<itemlibraryentry name="Web View" category="Qt - Widgets" icon=":/fxplugin/images/webview-icon.png">
|
||||
<property name="width" type="int" value="300"/>
|
||||
<property name="height" type="int" value="300"/>
|
||||
<property name="url" type="QString" value="http://www.trolltech.com"/>
|
||||
</itemlibraryrepresentation>
|
||||
</itemlibraryentry>
|
||||
</node>
|
||||
</metainfo>
|
||||
|
||||
@@ -124,15 +124,15 @@ void GettingStartedWelcomePageWidget::updateCppExamples(const QString &examplePa
|
||||
while (!reader.atEnd()) {
|
||||
switch (reader.readNext()) {
|
||||
case QXmlStreamReader::StartElement:
|
||||
if (reader.name() == "category") {
|
||||
if (reader.name() == QLatin1String("category")) {
|
||||
QString name = reader.attributes().value(QLatin1String("name")).toString();
|
||||
if (name.contains("tutorial"))
|
||||
if (name.contains(QLatin1String("tutorial")))
|
||||
break;
|
||||
dirName = reader.attributes().value(QLatin1String("dirname")).toString();
|
||||
subMenu = menu->addMenu(name);
|
||||
inExamples = true;
|
||||
}
|
||||
if (inExamples && reader.name() == "example") {
|
||||
if (inExamples && reader.name() == QLatin1String("example")) {
|
||||
const QChar slash = QLatin1Char('/');
|
||||
const QString name = reader.attributes().value(QLatin1String("name")).toString();
|
||||
const QString fn = reader.attributes().value(QLatin1String("filename")).toString();
|
||||
@@ -152,7 +152,7 @@ void GettingStartedWelcomePageWidget::updateCppExamples(const QString &examplePa
|
||||
}
|
||||
break;
|
||||
case QXmlStreamReader::EndElement:
|
||||
if (reader.name() == "category")
|
||||
if (reader.name() == QLatin1String("category"))
|
||||
inExamples = false;
|
||||
break;
|
||||
default:
|
||||
@@ -161,32 +161,43 @@ void GettingStartedWelcomePageWidget::updateCppExamples(const QString &examplePa
|
||||
}
|
||||
}
|
||||
|
||||
void GettingStartedWelcomePageWidget::updateQmlExamples(const QString &examplePath)
|
||||
void GettingStartedWelcomePageWidget::updateQmlExamples(const QString &examplePath,
|
||||
const QString &sourcePath)
|
||||
{
|
||||
QDir declarativeDir(examplePath + "/declarative");
|
||||
|
||||
if (!declarativeDir.exists())
|
||||
return;
|
||||
|
||||
ui->qmlExamplesButton->setEnabled(true);;
|
||||
ui->qmlExamplesButton->setText(tr("Choose an example..."));
|
||||
|
||||
QList<QFileInfo> examples = declarativeDir.entryInfoList(QStringList(), QDir::AllDirs|QDir::NoDotAndDotDot, QDir::Name);
|
||||
|
||||
QMenu *menu = new QMenu(ui->qmlExamplesButton);
|
||||
ui->qmlExamplesButton->setMenu(menu);
|
||||
|
||||
foreach(const QFileInfo &example, examples) {
|
||||
const QString exampleProject = example.absoluteFilePath()+'/'+example.fileName()+QLatin1String(".qmlproject");
|
||||
if (QFile::exists(exampleProject)) {
|
||||
QAction *exampleAction = menu->addAction(example.fileName());
|
||||
connect(exampleAction, SIGNAL(triggered()), SLOT(slotOpenExample()));
|
||||
exampleAction->setProperty(ExamplePathPropertyName, exampleProject);
|
||||
// FIXME once we have help for QML examples
|
||||
// exampleAction->setProperty(HelpPathPropertyName, helpPath);
|
||||
QStringList roots;
|
||||
roots << (examplePath + QLatin1String("/declarative"))
|
||||
<< (sourcePath + QLatin1String("/examples/declarative"));
|
||||
QMap<QString, QString> exampleProjects;
|
||||
|
||||
foreach (const QString &root, roots) {
|
||||
QList<QFileInfo> examples = QDir(root).entryInfoList(QStringList(), QDir::AllDirs|QDir::NoDotAndDotDot, QDir::Name);
|
||||
foreach(const QFileInfo &example, examples) {
|
||||
const QString fileName = example.fileName();
|
||||
if (exampleProjects.contains(fileName))
|
||||
continue;
|
||||
const QString exampleProject = example.absoluteFilePath()
|
||||
+ QLatin1Char('/') + fileName
|
||||
+ QLatin1String(".qmlproject");
|
||||
if (!QFile::exists(exampleProject))
|
||||
continue;
|
||||
exampleProjects.insert(fileName, exampleProject);
|
||||
}
|
||||
}
|
||||
QMapIterator<QString, QString> it(exampleProjects);
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
QAction *exampleAction = menu->addAction(it.key());
|
||||
connect(exampleAction, SIGNAL(triggered()), SLOT(slotOpenExample()));
|
||||
exampleAction->setProperty(ExamplePathPropertyName, it.value());
|
||||
// FIXME once we have help for QML examples
|
||||
// exampleAction->setProperty(HelpPathPropertyName, helpPath);
|
||||
}
|
||||
|
||||
ui->qmlExamplesButton->setEnabled(!exampleProjects.isEmpty());
|
||||
}
|
||||
|
||||
void GettingStartedWelcomePageWidget::updateExamples(const QString &examplePath,
|
||||
@@ -200,7 +211,7 @@ void GettingStartedWelcomePageWidget::updateExamples(const QString &examplePath,
|
||||
return;
|
||||
}
|
||||
updateCppExamples(examplePath, sourcePath, demoxml);
|
||||
updateQmlExamples(examplePath);
|
||||
updateQmlExamples(examplePath, sourcePath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -64,7 +64,8 @@ private:
|
||||
void updateCppExamples(const QString &examplePath,
|
||||
const QString &sourcePath,
|
||||
const QString &demoXml);
|
||||
void updateQmlExamples(const QString &examplePath);
|
||||
void updateQmlExamples(const QString &examplePath,
|
||||
const QString &sourcePath);
|
||||
|
||||
Ui::GettingStartedWelcomePageWidget *ui;
|
||||
int m_currentTip;
|
||||
|
||||
@@ -247,7 +247,7 @@ QString S60DeviceRunConfiguration::packageFileNameWithTargetInfo() const
|
||||
TargetInformation ti = qt4Target()->qt4Project()->rootProjectNode()->targetInformation(m_proFilePath);
|
||||
if (!ti.valid)
|
||||
return QString();
|
||||
QString baseFileName = ti.workingDir + QLatin1Char('/') + ti.target;
|
||||
QString baseFileName = ti.buildDir + QLatin1Char('/') + ti.target;
|
||||
baseFileName += QLatin1Char('_')
|
||||
+ (isDebug() ? QLatin1String("debug") : QLatin1String("release"))
|
||||
+ QLatin1Char('-') + symbianPlatform() + QLatin1String(".sis");
|
||||
@@ -284,7 +284,7 @@ QString S60DeviceRunConfiguration::packageTemplateFileName() const
|
||||
TargetInformation ti = qt4Target()->qt4Project()->rootProjectNode()->targetInformation(m_proFilePath);
|
||||
if (!ti.valid)
|
||||
return QString();
|
||||
return ti.workingDir + QLatin1Char('/') + ti.target + QLatin1String("_template.pkg");
|
||||
return ti.buildDir + QLatin1Char('/') + ti.target + QLatin1String("_template.pkg");
|
||||
}
|
||||
|
||||
/* Grep a package file for the '.exe' file. Curently for use on Linux only
|
||||
@@ -351,7 +351,7 @@ QString S60DeviceRunConfiguration::signedPackage() const
|
||||
TargetInformation ti = qt4Target()->qt4Project()->rootProjectNode()->targetInformation(m_proFilePath);
|
||||
if (!ti.valid)
|
||||
return QString();
|
||||
return ti.workingDir + QLatin1Char('/') + ti.target + QLatin1String(".sis");
|
||||
return ti.buildDir + QLatin1Char('/') + ti.target + QLatin1String(".sis");
|
||||
}
|
||||
|
||||
QStringList S60DeviceRunConfiguration::commandLineArguments() const
|
||||
|
||||
@@ -1428,7 +1428,8 @@ TargetInformation Qt4ProFileNode::targetInformation(ProFileReader *reader) const
|
||||
if (!reader)
|
||||
return result;
|
||||
|
||||
const QString baseDir = buildDir();
|
||||
result.buildDir = buildDir();
|
||||
const QString baseDir = result.buildDir;
|
||||
// qDebug() << "base build dir is:"<<baseDir;
|
||||
|
||||
// Working Directory
|
||||
|
||||
@@ -196,12 +196,14 @@ struct TargetInformation
|
||||
QString workingDir;
|
||||
QString target;
|
||||
QString executable;
|
||||
QString buildDir;
|
||||
bool operator==(const TargetInformation &other) const
|
||||
{
|
||||
return workingDir == other.workingDir
|
||||
&& target == other.target
|
||||
&& executable == other.executable
|
||||
&& valid == valid;
|
||||
&& valid == valid
|
||||
&& buildDir == buildDir;
|
||||
}
|
||||
bool operator!=(const TargetInformation &other) const
|
||||
{
|
||||
@@ -216,7 +218,8 @@ struct TargetInformation
|
||||
: valid(other.valid),
|
||||
workingDir(other.workingDir),
|
||||
target(other.target),
|
||||
executable(other.executable)
|
||||
executable(other.executable),
|
||||
buildDir(other.buildDir)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -739,6 +739,89 @@ void BaseTextEditor::gotoBlockEndWithSelection()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BaseTextEditor::gotoLineStart()
|
||||
{
|
||||
handleHomeKey(false);
|
||||
}
|
||||
|
||||
void BaseTextEditor::gotoLineStartWithSelection()
|
||||
{
|
||||
handleHomeKey(true);
|
||||
}
|
||||
|
||||
void BaseTextEditor::gotoLineEnd()
|
||||
{
|
||||
moveCursor(QTextCursor::EndOfLine);
|
||||
}
|
||||
|
||||
void BaseTextEditor::gotoLineEndWithSelection()
|
||||
{
|
||||
moveCursor(QTextCursor::EndOfLine, QTextCursor::KeepAnchor);
|
||||
}
|
||||
|
||||
void BaseTextEditor::gotoNextLine()
|
||||
{
|
||||
moveCursor(QTextCursor::NextRow);
|
||||
}
|
||||
|
||||
void BaseTextEditor::gotoNextLineWithSelection()
|
||||
{
|
||||
moveCursor(QTextCursor::NextRow, QTextCursor::KeepAnchor);
|
||||
}
|
||||
|
||||
void BaseTextEditor::gotoPreviousLine()
|
||||
{
|
||||
moveCursor(QTextCursor::PreviousRow);
|
||||
}
|
||||
|
||||
void BaseTextEditor::gotoPreviousLineWithSelection()
|
||||
{
|
||||
moveCursor(QTextCursor::PreviousRow, QTextCursor::KeepAnchor);
|
||||
}
|
||||
|
||||
void BaseTextEditor::gotoPreviousCharacter()
|
||||
{
|
||||
moveCursor(QTextCursor::PreviousCharacter);
|
||||
}
|
||||
|
||||
void BaseTextEditor::gotoPreviousCharacterWithSelection()
|
||||
{
|
||||
moveCursor(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor);
|
||||
}
|
||||
|
||||
void BaseTextEditor::gotoNextCharacter()
|
||||
{
|
||||
moveCursor(QTextCursor::NextCharacter);
|
||||
}
|
||||
|
||||
void BaseTextEditor::gotoNextCharacterWithSelection()
|
||||
{
|
||||
moveCursor(QTextCursor::NextCharacter, QTextCursor::KeepAnchor);
|
||||
}
|
||||
|
||||
void BaseTextEditor::gotoPreviousWord()
|
||||
{
|
||||
moveCursor(QTextCursor::PreviousWord);
|
||||
}
|
||||
|
||||
void BaseTextEditor::gotoPreviousWordWithSelection()
|
||||
{
|
||||
moveCursor(QTextCursor::PreviousWord, QTextCursor::KeepAnchor);
|
||||
}
|
||||
|
||||
void BaseTextEditor::gotoNextWord()
|
||||
{
|
||||
moveCursor(QTextCursor::NextWord);
|
||||
}
|
||||
|
||||
void BaseTextEditor::gotoNextWordWithSelection()
|
||||
{
|
||||
moveCursor(QTextCursor::NextWord, QTextCursor::KeepAnchor);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static QTextCursor flippedCursor(const QTextCursor &cursor)
|
||||
{
|
||||
QTextCursor flipped = cursor;
|
||||
@@ -2825,7 +2908,6 @@ static void drawRectBox(QPainter *painter, const QRect &rect, bool start, bool e
|
||||
grad.setColorAt(0, c.lighter(110));
|
||||
grad.setColorAt(1, c.lighter(130));
|
||||
QColor outline = c;
|
||||
QRect r = rect;
|
||||
|
||||
painter->fillRect(rect, grad);
|
||||
painter->setPen(outline);
|
||||
@@ -2977,7 +3059,9 @@ void BaseTextEditor::extraAreaPaintEvent(QPaintEvent *e)
|
||||
|
||||
int boxWidth = collapseBoxWidth(fm);
|
||||
if (hovered) {
|
||||
QRect box = QRect(extraAreaWidth + 1, top, boxWidth - 2, bottom - top);
|
||||
int itop = qRound(top);
|
||||
int ibottom = qRound(bottom);
|
||||
QRect box = QRect(extraAreaWidth + 1, itop, boxWidth - 2, ibottom - itop);
|
||||
drawRectBox(&painter, box, drawStart, drawEnd, pal);
|
||||
}
|
||||
|
||||
|
||||
@@ -231,6 +231,23 @@ public slots:
|
||||
void gotoBlockStartWithSelection();
|
||||
void gotoBlockEndWithSelection();
|
||||
|
||||
void gotoLineStart();
|
||||
void gotoLineStartWithSelection();
|
||||
void gotoLineEnd();
|
||||
void gotoLineEndWithSelection();
|
||||
void gotoNextLine();
|
||||
void gotoNextLineWithSelection();
|
||||
void gotoPreviousLine();
|
||||
void gotoPreviousLineWithSelection();
|
||||
void gotoPreviousCharacter();
|
||||
void gotoPreviousCharacterWithSelection();
|
||||
void gotoNextCharacter();
|
||||
void gotoNextCharacterWithSelection();
|
||||
void gotoPreviousWord();
|
||||
void gotoPreviousWordWithSelection();
|
||||
void gotoNextWord();
|
||||
void gotoNextWordWithSelection();
|
||||
|
||||
void selectBlockUp();
|
||||
void selectBlockDown();
|
||||
|
||||
|
||||
@@ -302,6 +302,58 @@ void TextEditorActionHandler::createActions()
|
||||
command = am->registerAction(m_insertLineBelowAction, Constants::INSERT_LINE_BELOW, m_contextId);
|
||||
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Return")));
|
||||
connect(m_insertLineBelowAction, SIGNAL(triggered()), this, SLOT(insertLineBelow()));
|
||||
|
||||
QAction *a = 0;
|
||||
a = new QAction(tr("Goto Line Start"), this);
|
||||
command = am->registerAction(a, Constants::GOTO_LINE_START, m_contextId);
|
||||
connect(a, SIGNAL(triggered()), this, SLOT(gotoLineStart()));
|
||||
a = new QAction(tr("Goto Line End"), this);
|
||||
command = am->registerAction(a, Constants::GOTO_LINE_END, m_contextId);
|
||||
connect(a, SIGNAL(triggered()), this, SLOT(gotoLineEnd()));
|
||||
a = new QAction(tr("Goto Next Line"), this);
|
||||
command = am->registerAction(a, Constants::GOTO_NEXT_LINE, m_contextId);
|
||||
connect(a, SIGNAL(triggered()), this, SLOT(gotoNextLine()));
|
||||
a = new QAction(tr("Goto Previous Line"), this);
|
||||
command = am->registerAction(a, Constants::GOTO_PREVIOUS_LINE, m_contextId);
|
||||
connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousLine()));
|
||||
a = new QAction(tr("Goto Previous Character"), this);
|
||||
command = am->registerAction(a, Constants::GOTO_PREVIOUS_CHARACTER, m_contextId);
|
||||
connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousCharacter()));
|
||||
a = new QAction(tr("Goto Next Character"), this);
|
||||
command = am->registerAction(a, Constants::GOTO_NEXT_CHARACTER, m_contextId);
|
||||
connect(a, SIGNAL(triggered()), this, SLOT(gotoNextCharacter()));
|
||||
a = new QAction(tr("Goto Previous Word"), this);
|
||||
command = am->registerAction(a, Constants::GOTO_PREVIOUS_WORD, m_contextId);
|
||||
connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousWord()));
|
||||
a = new QAction(tr("Goto Next Word"), this);
|
||||
command = am->registerAction(a, Constants::GOTO_NEXT_WORD, m_contextId);
|
||||
connect(a, SIGNAL(triggered()), this, SLOT(gotoNextWord()));
|
||||
|
||||
a = new QAction(tr("Goto Line Start With Selection"), this);
|
||||
command = am->registerAction(a, Constants::GOTO_LINE_START_WITH_SELECTION, m_contextId);
|
||||
connect(a, SIGNAL(triggered()), this, SLOT(gotoLineStartWithSelection()));
|
||||
a = new QAction(tr("Goto Line End With Selection"), this);
|
||||
command = am->registerAction(a, Constants::GOTO_LINE_END_WITH_SELECTION, m_contextId);
|
||||
connect(a, SIGNAL(triggered()), this, SLOT(gotoLineEndWithSelection()));
|
||||
a = new QAction(tr("Goto Next Line With Selection"), this);
|
||||
command = am->registerAction(a, Constants::GOTO_NEXT_LINE_WITH_SELECTION, m_contextId);
|
||||
connect(a, SIGNAL(triggered()), this, SLOT(gotoNextLineWithSelection()));
|
||||
a = new QAction(tr("Goto Previous Line With Selection"), this);
|
||||
command = am->registerAction(a, Constants::GOTO_PREVIOUS_LINE_WITH_SELECTION, m_contextId);
|
||||
connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousLineWithSelection()));
|
||||
a = new QAction(tr("Goto Previous Character With Selection"), this);
|
||||
command = am->registerAction(a, Constants::GOTO_PREVIOUS_CHARACTER_WITH_SELECTION, m_contextId);
|
||||
connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousCharacterWithSelection()));
|
||||
a = new QAction(tr("Goto Next Character With Selection"), this);
|
||||
command = am->registerAction(a, Constants::GOTO_NEXT_CHARACTER_WITH_SELECTION, m_contextId);
|
||||
connect(a, SIGNAL(triggered()), this, SLOT(gotoNextCharacterWithSelection()));
|
||||
a = new QAction(tr("Goto Previous Word With Selection"), this);
|
||||
command = am->registerAction(a, Constants::GOTO_PREVIOUS_WORD_WITH_SELECTION, m_contextId);
|
||||
connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousWordWithSelection()));
|
||||
a = new QAction(tr("Goto Next Word With Selection"), this);
|
||||
command = am->registerAction(a, Constants::GOTO_NEXT_WORD_WITH_SELECTION, m_contextId);
|
||||
connect(a, SIGNAL(triggered()), this, SLOT(gotoNextWordWithSelection()));
|
||||
|
||||
}
|
||||
|
||||
bool TextEditorActionHandler::supportsAction(const QString & /*id */) const
|
||||
@@ -467,6 +519,24 @@ FUNCTION(joinLines)
|
||||
FUNCTION(insertLineAbove)
|
||||
FUNCTION(insertLineBelow)
|
||||
|
||||
FUNCTION(gotoLineStart)
|
||||
FUNCTION(gotoLineStartWithSelection)
|
||||
FUNCTION(gotoLineEnd)
|
||||
FUNCTION(gotoLineEndWithSelection)
|
||||
FUNCTION(gotoNextLine)
|
||||
FUNCTION(gotoNextLineWithSelection)
|
||||
FUNCTION(gotoPreviousLine)
|
||||
FUNCTION(gotoPreviousLineWithSelection)
|
||||
FUNCTION(gotoPreviousCharacter)
|
||||
FUNCTION(gotoPreviousCharacterWithSelection)
|
||||
FUNCTION(gotoNextCharacter)
|
||||
FUNCTION(gotoNextCharacterWithSelection)
|
||||
FUNCTION(gotoPreviousWord)
|
||||
FUNCTION(gotoPreviousWordWithSelection)
|
||||
FUNCTION(gotoNextWord)
|
||||
FUNCTION(gotoNextWordWithSelection)
|
||||
|
||||
|
||||
void TextEditorActionHandler::updateCurrentEditor(Core::IEditor *editor)
|
||||
{
|
||||
m_currentEditor = 0;
|
||||
|
||||
@@ -120,6 +120,24 @@ private slots:
|
||||
void insertLineBelow();
|
||||
void updateCurrentEditor(Core::IEditor *editor);
|
||||
|
||||
void gotoLineStart();
|
||||
void gotoLineStartWithSelection();
|
||||
void gotoLineEnd();
|
||||
void gotoLineEndWithSelection();
|
||||
void gotoNextLine();
|
||||
void gotoNextLineWithSelection();
|
||||
void gotoPreviousLine();
|
||||
void gotoPreviousLineWithSelection();
|
||||
void gotoPreviousCharacter();
|
||||
void gotoPreviousCharacterWithSelection();
|
||||
void gotoNextCharacter();
|
||||
void gotoNextCharacterWithSelection();
|
||||
void gotoPreviousWord();
|
||||
void gotoPreviousWordWithSelection();
|
||||
void gotoNextWord();
|
||||
void gotoNextWordWithSelection();
|
||||
|
||||
|
||||
private:
|
||||
QAction *m_undoAction;
|
||||
QAction *m_redoAction;
|
||||
|
||||
@@ -70,6 +70,22 @@ const char * const SELECT_ENCODING = "TextEditor.SelectEncoding";
|
||||
const char * const REWRAP_PARAGRAPH = "TextEditor.RewrapParagraph";
|
||||
const char * const GOTO_OPENING_PARENTHESIS = "TextEditor.GotoOpeningParenthesis";
|
||||
const char * const GOTO_CLOSING_PARENTHESIS = "TextEditor.GotoClosingParenthesis";
|
||||
const char * const GOTO_LINE_START = "TextEditor.GotoLineStart";
|
||||
const char * const GOTO_LINE_END = "TextEditor.GotoLineEnd";
|
||||
const char * const GOTO_NEXT_LINE = "TextEditor.GotoNextLine";
|
||||
const char * const GOTO_PREVIOUS_LINE = "TextEditor.GotoPreviousLine";
|
||||
const char * const GOTO_PREVIOUS_CHARACTER = "TextEditor.GotoPreviousCharacter";
|
||||
const char * const GOTO_NEXT_CHARACTER = "TextEditor.GotoNextCharacter";
|
||||
const char * const GOTO_PREVIOUS_WORD = "TextEditor.GotoPreviousWord";
|
||||
const char * const GOTO_NEXT_WORD = "TextEditor.GotoNextWord";
|
||||
const char * const GOTO_LINE_START_WITH_SELECTION = "TextEditor.GotoLineStartWithSelection";
|
||||
const char * const GOTO_LINE_END_WITH_SELECTION = "TextEditor.GotoLineEndWithSelection";
|
||||
const char * const GOTO_NEXT_LINE_WITH_SELECTION = "TextEditor.GotoNextLineWithSelection";
|
||||
const char * const GOTO_PREVIOUS_LINE_WITH_SELECTION = "TextEditor.GotoPreviousLineWithSelection";
|
||||
const char * const GOTO_PREVIOUS_CHARACTER_WITH_SELECTION = "TextEditor.GotoPreviousCharacterWithSelection";
|
||||
const char * const GOTO_NEXT_CHARACTER_WITH_SELECTION = "TextEditor.GotoNextCharacterWithSelection";
|
||||
const char * const GOTO_PREVIOUS_WORD_WITH_SELECTION = "TextEditor.GotoPreviousWordWithSelection";
|
||||
const char * const GOTO_NEXT_WORD_WITH_SELECTION = "TextEditor.GotoNextWordWithSelection";
|
||||
const char * const C_TEXTEDITOR_MIMETYPE_TEXT = "text/plain";
|
||||
const char * const C_TEXTEDITOR_MIMETYPE_XML = "application/xml";
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ QToolButton, QPushButton, QComboBox {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
*{
|
||||
QToolButton, QPushButton, QComboBox, QLabel {
|
||||
color: black;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ QT += testlib \
|
||||
script \
|
||||
declarative
|
||||
|
||||
include($$CREATORDIR/src/plugins/qmldesigner/core/core.pri)
|
||||
include($$CREATORDIR/src/plugins/qmldesigner/designercore/designercore.pri)
|
||||
include($$CREATORDIR/src/libs/qmljs/qmljs-lib.pri)
|
||||
HEADERS+=$$CREATORDIR/src/libs/utils/changeset.h
|
||||
SOURCES+=$$CREATORDIR/src/libs/utils/changeset.cpp
|
||||
@@ -16,7 +16,7 @@ DEFINES+=QTCREATOR_UTILS_STATIC_LIB QML_BUILD_STATIC_LIB QTCREATOR_TEST
|
||||
DEFINES+=QTCREATORDIR=\\\"$$CREATORDIR\\\"
|
||||
|
||||
DEPENDPATH += ..
|
||||
DEPENDPATH += $$CREATORDIR/src/plugins/qmldesigner/core/include
|
||||
DEPENDPATH += $$CREATORDIR/src/plugins/qmldesigner/designercore/include
|
||||
|
||||
TARGET = tst_qmldesigner_core
|
||||
|
||||
|
||||