Merge remote-tracking branch 'origin/3.2' into HEAD

Change-Id: I257bb9310bb3bde493aff4cd43091ec63fcb5203
This commit is contained in:
Eike Ziller
2014-07-22 16:11:13 +02:00
59 changed files with 100786 additions and 497 deletions

View File

@@ -60,6 +60,15 @@
\c {qtcreator .} \c {qtcreator .}
\note To run a self-built \QC from the command line on Windows, make sure
that the Qt installation directory is included in the PATH environment
variable. You can enter the following command on the command line to add Qt
to the path:
\code
set PATH=<Qt_installation_directory>\mingw\bin;c:<Qt_installation_directory>\bin;%PATH%
\endcode
The following table summarizes the available options: The following table summarizes the available options:
\table \table

View File

@@ -124,11 +124,7 @@
For example, running \tt{qtcreator somesession}, launches \QC and For example, running \tt{qtcreator somesession}, launches \QC and
loads session somesession. loads session somesession.
\note Make sure \QC is included in the PATH environment variable. For more information, see \l{Using Command Line Options}.
This can be done by typing the following in the command line:
\code
set PATH=c:\qtsdk\mingw\bin;c:\qtsdk\qt\bin;%PATH%
\endcode
\section1 Showing and Hiding the Sidebar \section1 Showing and Hiding the Sidebar
@@ -152,15 +148,16 @@
Press \key Ctrl (\key Cmd on OS X) and click a symbol to move directly to Press \key Ctrl (\key Cmd on OS X) and click a symbol to move directly to
the definition or the declaration of the symbol. You can also move the the definition or the declaration of the symbol. You can also move the
on the symbol and press \key {F2}. For more information, see cursor on the symbol and press \key {F2}. For more information, see
cursor \l{Moving to Symbol Definition or Declaration}. \l{Moving to Symbol Definition or Declaration}.
\section1 Displaying Signals and Slots \section1 Displaying Signals and Slots
If an instance of a class is derived from QObject, and you would like to If an instance of a class is derived from QObject, and you would like to
find all other objects connected to one of your object's slots using find all other objects connected to one of your object's slots using
Qt's signals and slots mechanism, select \gui Tools > \gui Options Qt's signals and slots mechanism, select \gui Tools > \gui Options
> \gui{Debugger} > \gui{Debugging Helper} > \gui{Use Debugging Helper}. > \gui{Debugger} > \gui{Locals and Expressions} >
\gui{Use Debugging Helper}.
In the \gui{Locals and Expressions} view, expand the object's entry and open In the \gui{Locals and Expressions} view, expand the object's entry and open
the slot in the \e slots subitem. The objects connected to this slot are the slot in the \e slots subitem. The objects connected to this slot are
@@ -179,7 +176,7 @@
\list 1 \list 1
\li Select \gui Tools > \gui Options > \gui Debugger > \li Select \gui Tools > \gui Options > \gui Debugger >
\gui{Debugging Helper}. \gui{Locals and Expressions}.
\li Uncheck the \gui{Use Debugging Helper} checkbox. \li Uncheck the \gui{Use Debugging Helper} checkbox.
@@ -234,7 +231,7 @@
\li \c %MONTH%: Month \li \c %MONTH%: Month
\li \c %DAY%: Day of the month \li \c %DAY%: Day of the month
\li \c %DATE%: Date \li \c %DATE%: Date
\li \c %USER%: User name \li \c %USER%: Username
\li \c %FILENAME%: File name \li \c %FILENAME%: File name
\li \c %CLASS%: Class name (if applicable) \li \c %CLASS%: Class name (if applicable)
\li \c %$VARIABLE%: Contents of environment variable \c{VARIABLE}. \li \c %$VARIABLE%: Contents of environment variable \c{VARIABLE}.

View File

@@ -78,8 +78,8 @@
enter the host name or IP address of the device. enter the host name or IP address of the device.
This value will be available in the variable \c %{CurrentDevice:HostAddress}. This value will be available in the variable \c %{CurrentDevice:HostAddress}.
\li In the \gui {The user name to log into the device} field, \li In the \gui {The username to log into the device} field,
enter the user name to log into the device and run the enter the username to log into the device and run the
application as. application as.
This value will be available in the variable \c %{CurrentDevice:UserName}. This value will be available in the variable \c %{CurrentDevice:UserName}.

View File

@@ -145,9 +145,9 @@
\list \list
\li \QMLD uses external processes (QML Puppet) to render and preview \li \QMLD uses a QML emulation layer (QML Puppet) to render and preview
images and to collect data. Executing C++ code might cause the QML images and to collect data. Executing C++ code might cause the QML
Puppet to crash. If it crashes, an error message is displayed and emulation layer to crash. If it crashes, an error message is displayed and
you can continue editing the QML file in the code editor. you can continue editing the QML file in the code editor.
\endlist \endlist

View File

@@ -41,11 +41,8 @@
\row \row
\li Learn more about Qt \li Learn more about Qt
\li \l{http://qt.digia.com/product/learning/}{Learning} \li \l{http://qt-project.org/wiki/developer-guides}
from Digia {Qt Developer Guides}
\l{http://qt-project.org/wiki/developer-guides}
{Qt Developer Guides} from Qt Project
\row \row
\li Develop Qt applications for desktop and mobile devices \li Develop Qt applications for desktop and mobile devices

View File

@@ -192,7 +192,7 @@ def qdump__std__map(d, value):
for i in d.childRange(): for i in d.childRange():
with SubItem(d, i): with SubItem(d, i):
pair = (node + 1).cast(pairPointer).dereference() pair = (node + 1).cast(pairPointer).dereference()
d.putPair(pair) d.putPair(pair, i)
if d.isNull(node["_M_right"]): if d.isNull(node["_M_right"]):
parent = node["_M_parent"] parent = node["_M_parent"]
while node == parent["_M_right"]: while node == parent["_M_right"]:
@@ -267,9 +267,18 @@ def qdump__std____debug__map(d, value):
def qdump__std____debug__set(d, value): def qdump__std____debug__set(d, value):
qdump__std__set(d, value) qdump__std__set(d, value)
def qdump__std__multiset(d, value):
qdump__std__set(d, value)
def qdump__std____cxx1998__map(d, value): def qdump__std____cxx1998__map(d, value):
qdump__std__map(d, value) qdump__std__map(d, value)
def qform__std__multimap():
return mapForms()
def qdump__std__multimap(d, value):
return qdump__std__map(d, value)
def stdTreeIteratorHelper(d, value): def stdTreeIteratorHelper(d, value):
node = value["_M_node"].dereference() node = value["_M_node"].dereference()
d.putNumChild(1) d.putNumChild(1)

View File

@@ -112,7 +112,9 @@ QDataStream &operator<<(QDataStream &out, const ValuesChangedCommand &command)
QSharedMemory *sharedMemory = createSharedMemory(keyCounter, outDataStreamByteArray.size()); QSharedMemory *sharedMemory = createSharedMemory(keyCounter, outDataStreamByteArray.size());
if (sharedMemory) { if (sharedMemory) {
sharedMemory->lock();
std::memcpy(sharedMemory->data(), outDataStreamByteArray.constData(), sharedMemory->size()); std::memcpy(sharedMemory->data(), outDataStreamByteArray.constData(), sharedMemory->size());
sharedMemory->unlock();
out << command.keyNumber(); out << command.keyNumber();
return out; return out;
} }

View File

@@ -392,8 +392,15 @@ QImage QuickItemNodeInstance::renderPreviewImage(const QSize &previewImageSize)
{ {
QRectF previewItemBoundingRect = boundingRect(); QRectF previewItemBoundingRect = boundingRect();
if (previewItemBoundingRect.isValid() && quickItem()) if (previewItemBoundingRect.isValid() && quickItem()) {
if (quickItem()->isVisible()) {
return designerSupport()->renderImageForItem(quickItem(), previewItemBoundingRect, previewImageSize); return designerSupport()->renderImageForItem(quickItem(), previewItemBoundingRect, previewImageSize);
} else {
QImage transparentImage(previewImageSize, QImage::Format_ARGB32_Premultiplied);
transparentImage.fill(Qt::transparent);
return transparentImage;
}
}
return QImage(); return QImage();
} }

View File

@@ -3050,7 +3050,7 @@ bool Parser::parseExpressionStatement(StatementAST *&node)
return parsed; return parsed;
} }
bool Parser::parseStatement(StatementAST *&node) bool Parser::parseStatement(StatementAST *&node, bool blockLabeledStatement)
{ {
DEBUG_THIS_RULE(); DEBUG_THIS_RULE();
switch (LA()) { switch (LA()) {
@@ -3077,6 +3077,8 @@ bool Parser::parseStatement(StatementAST *&node)
case T_CASE: case T_CASE:
case T_DEFAULT: case T_DEFAULT:
if (blockLabeledStatement)
return false;
return parseLabeledStatement(node); return parseLabeledStatement(node);
case T_BREAK: case T_BREAK:
@@ -3145,8 +3147,11 @@ bool Parser::parseStatement(StatementAST *&node)
} }
default: default:
if (LA() == T_IDENTIFIER && LA(2) == T_COLON) if (LA() == T_IDENTIFIER && LA(2) == T_COLON) {
if (blockLabeledStatement)
return false;
return parseLabeledStatement(node); return parseLabeledStatement(node);
}
return parseExpressionOrDeclarationStatement(node); return parseExpressionOrDeclarationStatement(node);
} // switch } // switch
@@ -3617,7 +3622,7 @@ bool Parser::parseLabeledStatement(StatementAST *&node)
LabeledStatementAST *ast = new (_pool) LabeledStatementAST; LabeledStatementAST *ast = new (_pool) LabeledStatementAST;
ast->label_token = consumeToken(); ast->label_token = consumeToken();
ast->colon_token = consumeToken(); ast->colon_token = consumeToken();
parseStatement(ast->statement); parseStatement(ast->statement, /*blockLabeledStatement =*/ true);
node = ast; node = ast;
return true; return true;
} }
@@ -3627,7 +3632,7 @@ bool Parser::parseLabeledStatement(StatementAST *&node)
LabeledStatementAST *ast = new (_pool) LabeledStatementAST; LabeledStatementAST *ast = new (_pool) LabeledStatementAST;
ast->label_token = consumeToken(); ast->label_token = consumeToken();
match(T_COLON, &ast->colon_token); match(T_COLON, &ast->colon_token);
parseStatement(ast->statement); parseStatement(ast->statement, /*blockLabeledStatement =*/ true);
node = ast; node = ast;
return true; return true;
} }
@@ -3637,7 +3642,7 @@ bool Parser::parseLabeledStatement(StatementAST *&node)
ast->case_token = consumeToken(); ast->case_token = consumeToken();
parseConstantExpression(ast->expression); parseConstantExpression(ast->expression);
match(T_COLON, &ast->colon_token); match(T_COLON, &ast->colon_token);
parseStatement(ast->statement); parseStatement(ast->statement, /*blockLabeledStatement =*/ true);
node = ast; node = ast;
return true; return true;
} }

View File

@@ -142,7 +142,7 @@ public:
bool parsePtrOperator(PtrOperatorListAST *&node); bool parsePtrOperator(PtrOperatorListAST *&node);
bool parseRelationalExpression(ExpressionAST *&node); bool parseRelationalExpression(ExpressionAST *&node);
bool parseShiftExpression(ExpressionAST *&node); bool parseShiftExpression(ExpressionAST *&node);
bool parseStatement(StatementAST *&node); bool parseStatement(StatementAST *&node, bool blockLabeledStatement = false);
bool parseThisExpression(ExpressionAST *&node); bool parseThisExpression(ExpressionAST *&node);
bool parseBoolLiteral(ExpressionAST *&node); bool parseBoolLiteral(ExpressionAST *&node);
bool parseNumericLiteral(ExpressionAST *&node); bool parseNumericLiteral(ExpressionAST *&node);

View File

@@ -604,7 +604,7 @@ ModelManagerInterface::ProjectInfo ModelManagerInterface::projectInfoForPath(QSt
if (res.qtQmlPath.isEmpty()) if (res.qtQmlPath.isEmpty())
res.qtQmlPath = pInfo.qtQmlPath; res.qtQmlPath = pInfo.qtQmlPath;
foreach (const QString &path, pInfo.importPaths) foreach (const QString &path, pInfo.importPaths)
if (res.importPaths.contains(path)) if (!res.importPaths.contains(path))
res.importPaths.append(path); res.importPaths.append(path);
} }
return res; return res;
@@ -1105,28 +1105,24 @@ void ModelManagerInterface::updateImportPaths()
while (pInfoIter.hasNext()) { while (pInfoIter.hasNext()) {
pInfoIter.next(); pInfoIter.next();
QString pathAtt = pInfoIter.value().qtQmlPath; QString pathAtt = pInfoIter.value().qtQmlPath;
if (!pathAtt.isEmpty() && allImportPaths.size() > 0 if (!pathAtt.isEmpty() && (allImportPaths.isEmpty() || allImportPaths.last() != pathAtt))
&& allImportPaths.value(allImportPaths.size()) != pathAtt)
allImportPaths.append(pathAtt); allImportPaths.append(pathAtt);
} }
{ {
QString pathAtt = defaultProjectInfo().qtQmlPath; QString pathAtt = defaultProjectInfo().qtQmlPath;
if (!pathAtt.isEmpty() && allImportPaths.size() > 0 if (!pathAtt.isEmpty() && (allImportPaths.isEmpty() || allImportPaths.last() != pathAtt))
&& allImportPaths.value(allImportPaths.size()) != pathAtt)
allImportPaths.append(pathAtt); allImportPaths.append(pathAtt);
} }
pInfoIter.toFront(); pInfoIter.toFront();
while (pInfoIter.hasNext()) { while (pInfoIter.hasNext()) {
pInfoIter.next(); pInfoIter.next();
QString pathAtt = pInfoIter.value().qtImportsPath; QString pathAtt = pInfoIter.value().qtImportsPath;
if (!pathAtt.isEmpty() && allImportPaths.size() > 0 if (!pathAtt.isEmpty() && (allImportPaths.isEmpty() || allImportPaths.last() != pathAtt))
&& allImportPaths.value(allImportPaths.size()) != pathAtt)
allImportPaths.append(pathAtt); allImportPaths.append(pathAtt);
} }
{ {
QString pathAtt = defaultProjectInfo().qtImportsPath; QString pathAtt = defaultProjectInfo().qtImportsPath;
if (!pathAtt.isEmpty() && allImportPaths.size() > 0 if (!pathAtt.isEmpty() && (allImportPaths.isEmpty() || allImportPaths.last() != pathAtt))
&& allImportPaths.value(allImportPaths.size()) != pathAtt)
allImportPaths.append(pathAtt); allImportPaths.append(pathAtt);
} }
allImportPaths += m_defaultImportPaths; allImportPaths += m_defaultImportPaths;

View File

@@ -1973,9 +1973,10 @@ void EditorManager::updateMakeWritableWarning()
void EditorManager::setupSaveActions(IDocument *document, QAction *saveAction, QAction *saveAsAction, QAction *revertToSavedAction) void EditorManager::setupSaveActions(IDocument *document, QAction *saveAction, QAction *saveAsAction, QAction *revertToSavedAction)
{ {
saveAction->setEnabled(document != 0 && document->isModified()); const bool hasFile = document != 0 && !document->filePath().isEmpty();
saveAction->setEnabled(hasFile && document->isModified());
saveAsAction->setEnabled(document != 0 && document->isSaveAsAllowed()); saveAsAction->setEnabled(document != 0 && document->isSaveAsAllowed());
revertToSavedAction->setEnabled(document != 0 && !document->filePath().isEmpty()); revertToSavedAction->setEnabled(hasFile);
const QString documentName = document ? document->displayName() : QString(); const QString documentName = document ? document->displayName() : QString();
QString quotedName; QString quotedName;

View File

@@ -318,12 +318,14 @@ void EditorToolBar::listContextMenu(QPoint pos)
d->m_editorList->currentIndex()); d->m_editorList->currentIndex());
QString fileName = entry ? entry->fileName() : QString(); QString fileName = entry ? entry->fileName() : QString();
QString shortFileName = entry ? QFileInfo(fileName).fileName() : QString(); QString shortFileName = entry ? QFileInfo(fileName).fileName() : QString();
if (fileName.isEmpty() || shortFileName.isEmpty())
return;
QMenu menu; QMenu menu;
QAction *copyPath = menu.addAction(tr("Copy Full Path to Clipboard")); QAction *copyPath = menu.addAction(tr("Copy Full Path to Clipboard"));
QAction *copyFileName = menu.addAction(tr("Copy File Name to Clipboard")); QAction *copyFileName = menu.addAction(tr("Copy File Name to Clipboard"));
menu.addSeparator(); menu.addSeparator();
if (fileName.isEmpty() || shortFileName.isEmpty()) {
copyPath->setEnabled(false);
copyFileName->setEnabled(false);
}
EditorManager::addSaveAndCloseEditorActions(&menu, entry); EditorManager::addSaveAndCloseEditorActions(&menu, entry);
menu.addSeparator(); menu.addSeparator();
EditorManager::addNativeDirAndOpenWithActions(&menu, entry); EditorManager::addNativeDirAndOpenWithActions(&menu, entry);

View File

@@ -241,6 +241,11 @@ bool MainWindow::isNewItemDialogRunning() const
MainWindow::~MainWindow() MainWindow::~MainWindow()
{ {
// explicitly delete window support, because that calls methods from ICore that call methods
// from mainwindow, so mainwindow still needs to be alive
delete m_windowSupport;
m_windowSupport = 0;
ExtensionSystem::PluginManager::removeObject(m_shortcutSettings); ExtensionSystem::PluginManager::removeObject(m_shortcutSettings);
ExtensionSystem::PluginManager::removeObject(m_generalSettings); ExtensionSystem::PluginManager::removeObject(m_generalSettings);
ExtensionSystem::PluginManager::removeObject(m_toolSettings); ExtensionSystem::PluginManager::removeObject(m_toolSettings);
@@ -371,11 +376,6 @@ void MainWindow::closeEvent(QCloseEvent *event)
m_navigationWidget->closeSubWidgets(); m_navigationWidget->closeSubWidgets();
event->accept(); event->accept();
// explicitly delete window support, because that calls methods from ICore that call methods
// from mainwindow, so mainwindow still needs to be alive
delete m_windowSupport;
m_windowSupport = 0;
} }
void MainWindow::openDroppedFiles(const QStringList &files) void MainWindow::openDroppedFiles(const QStringList &files)

View File

@@ -218,6 +218,36 @@ public:
PathChooser *overrideStartScriptFileName; PathChooser *overrideStartScriptFileName;
QDialogButtonBox *buttonBox; QDialogButtonBox *buttonBox;
struct State
{
bool isValid() const
{
return validKit && validLocalExecFilename && validCoreFilename;
}
bool validKit;
bool validLocalExecFilename;
bool validCoreFilename;
bool localCoreFile;
bool localKit;
};
State getDialogState(const AttachCoreDialog &p) const
{
State st;
st.localCoreFile = p.useLocalCoreFile();
st.validKit = (kitChooser->currentKit() != 0);
st.validLocalExecFilename = localExecFileName->isValid();
if (st.localCoreFile)
st.validCoreFilename = localCoreFileName->isValid();
else
st.validCoreFilename = !p.remoteCoreFile().isEmpty();
st.localKit = p.isLocalKit();
return st;
}
}; };
AttachCoreDialog::AttachCoreDialog(QWidget *parent) AttachCoreDialog::AttachCoreDialog(QWidget *parent)
@@ -302,6 +332,18 @@ int AttachCoreDialog::exec()
connect(d->buttonBox, SIGNAL(accepted()), SLOT(accept())); connect(d->buttonBox, SIGNAL(accepted()), SLOT(accept()));
changed(); changed();
AttachCoreDialogPrivate::State st = d->getDialogState(*this);
if (!st.validKit) {
d->kitChooser->setFocus();
} else if (!st.validCoreFilename) {
if (st.localCoreFile)
d->localCoreFileName->setFocus();
else
d->remoteCoreFileName->setFocus();
} else if (!st.validLocalExecFilename) {
d->localExecFileName->setFocus();
}
return QDialog::exec(); return QDialog::exec();
} }
@@ -335,24 +377,21 @@ void AttachCoreDialog::coreFileChanged(const QString &core)
void AttachCoreDialog::changed() void AttachCoreDialog::changed()
{ {
bool isValid = d->kitChooser->currentKit() && d->localExecFileName->isValid(); AttachCoreDialogPrivate::State st = d->getDialogState(*this);
bool isKitLocal = isLocalKit();
d->forceLocalLabel->setVisible(!isKitLocal); d->forceLocalLabel->setVisible(!st.localKit);
d->forceLocalCheckBox->setVisible(!isKitLocal); d->forceLocalCheckBox->setVisible(!st.localKit);
if (useLocalCoreFile()) { if (st.localCoreFile) {
d->localCoreFileName->setVisible(true); d->localCoreFileName->setVisible(true);
d->remoteCoreFileName->setVisible(false); d->remoteCoreFileName->setVisible(false);
d->selectRemoteCoreButton->setVisible(false); d->selectRemoteCoreButton->setVisible(false);
isValid = isValid && d->localCoreFileName->isValid();
} else { } else {
d->localCoreFileName->setVisible(false); d->localCoreFileName->setVisible(false);
d->remoteCoreFileName->setVisible(true); d->remoteCoreFileName->setVisible(true);
d->selectRemoteCoreButton->setVisible(true); d->selectRemoteCoreButton->setVisible(true);
isValid = isValid && !remoteCoreFile().isEmpty();
} }
d->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(isValid); d->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(st.isValid());
} }
void AttachCoreDialog::selectRemoteCoreFile() void AttachCoreDialog::selectRemoteCoreFile()

View File

@@ -252,12 +252,14 @@ void GenericProject::refresh(RefreshOptions options)
Kit *k = activeTarget() ? activeTarget()->kit() : KitManager::defaultKit(); Kit *k = activeTarget() ? activeTarget()->kit() : KitManager::defaultKit();
if (ToolChain *tc = ToolChainKitInformation::toolChain(k)) { if (ToolChain *tc = ToolChainKitInformation::toolChain(k)) {
QStringList cxxflags; // FIXME: Can we do better? QStringList cflags;
part->evaluateToolchain(tc, cxxflags, cxxflags, QStringList cxxflags;
cxxflags << QLatin1String("-std=c++11");
part->evaluateToolchain(tc, cxxflags, cflags,
SysRootKitInformation::sysRoot(k)); SysRootKitInformation::sysRoot(k));
} }
part->cxxVersion = CppTools::ProjectPart::CXX11; // assume C++11
part->projectConfigFile = configFileName(); part->projectConfigFile = configFileName();
// ### add _defines. // ### add _defines.

View File

@@ -2233,7 +2233,8 @@ GitClient::StashInfo &GitClient::stashInfo(const QString &workingDirectory)
void GitClient::endStashScope(const QString &workingDirectory) void GitClient::endStashScope(const QString &workingDirectory)
{ {
const QString repoDirectory = VcsManager::findTopLevelForDirectory(workingDirectory); const QString repoDirectory = VcsManager::findTopLevelForDirectory(workingDirectory);
QTC_ASSERT(m_stashInfo.contains(repoDirectory), return); if (!m_stashInfo.contains(repoDirectory))
return;
m_stashInfo[repoDirectory].end(); m_stashInfo[repoDirectory].end();
} }

View File

@@ -19,7 +19,7 @@
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="usernameLabel"> <widget class="QLabel" name="usernameLabel">
<property name="text"> <property name="text">
<string>User name:</string> <string>Username:</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@@ -1090,7 +1090,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
[]() { return variableValue(Constants::VAR_CURRENTDEVICE_SSHPORT); }); []() { return variableValue(Constants::VAR_CURRENTDEVICE_SSHPORT); });
VariableManager::registerVariable(Constants::VAR_CURRENTDEVICE_USERNAME, VariableManager::registerVariable(Constants::VAR_CURRENTDEVICE_USERNAME,
tr("The user name with which to log into the device in the currently active kit."), tr("The username with which to log into the device in the currently active kit."),
[]() { return variableValue(Constants::VAR_CURRENTDEVICE_USERNAME); }); []() { return variableValue(Constants::VAR_CURRENTDEVICE_USERNAME); });
VariableManager::registerVariable(Constants::VAR_CURRENTDEVICE_PRIVATEKEYFILE, VariableManager::registerVariable(Constants::VAR_CURRENTDEVICE_PRIVATEKEYFILE,

View File

@@ -161,7 +161,7 @@ QString Node::path() const
int Node::line() const int Node::line() const
{ {
return -1; return m_line;
} }
QString Node::displayName() const QString Node::displayName() const

View File

@@ -332,11 +332,16 @@ void RunSettingsWidget::cloneRunConfiguration()
if (!factory) if (!factory)
return; return;
//: Title of a the cloned RunConfiguration window, text of the window
QString name = uniqueRCName(QInputDialog::getText(this, tr("Clone Configuration"), tr("New configuration name:")));
if (name.isEmpty())
return;
RunConfiguration *newRc = factory->clone(m_target, activeRunConfiguration); RunConfiguration *newRc = factory->clone(m_target, activeRunConfiguration);
if (!newRc) if (!newRc)
return; return;
newRc->setDisplayName(activeRunConfiguration->displayName()); newRc->setDisplayName(name);
m_target->addRunConfiguration(newRc); m_target->addRunConfiguration(newRc);
m_target->setActiveRunConfiguration(newRc); m_target->setActiveRunConfiguration(newRc);
} }

View File

@@ -37,6 +37,8 @@
#include <qtsupport/qtkitinformation.h> #include <qtsupport/qtkitinformation.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <tools/hostosinfo.h>
#include <QFileInfo> #include <QFileInfo>
namespace QbsProjectManager { namespace QbsProjectManager {
@@ -65,14 +67,33 @@ QVariantMap DefaultPropertyProvider::properties(const ProjectExplorer::Kit *k, c
if (tc) { if (tc) {
// FIXME/CLARIFY: How to pass the sysroot? // FIXME/CLARIFY: How to pass the sysroot?
ProjectExplorer::Abi targetAbi = tc->targetAbi(); ProjectExplorer::Abi targetAbi = tc->targetAbi();
if (targetAbi.architecture() != ProjectExplorer::Abi::UnknownArchitecture) {
QString architecture = ProjectExplorer::Abi::toString(targetAbi.architecture()); QString architecture = ProjectExplorer::Abi::toString(targetAbi.architecture());
if (targetAbi.wordWidth() == 64)
architecture.append(QLatin1String("_64")); // We have to be conservative tacking on suffixes to arch names because an arch that is
data.insert(QLatin1String(QBS_ARCHITECTURE), architecture); // already 64-bit may get an incorrect name as a result (i.e. Itanium)
if (targetAbi.wordWidth() == 64) {
switch (targetAbi.architecture()) {
case ProjectExplorer::Abi::X86Architecture:
architecture.append(QLatin1String("_"));
// fall through
case ProjectExplorer::Abi::ArmArchitecture:
case ProjectExplorer::Abi::MipsArchitecture:
case ProjectExplorer::Abi::PowerPCArchitecture:
architecture.append(QString::number(targetAbi.wordWidth()));
break;
default:
break;
}
}
data.insert(QLatin1String(QBS_ARCHITECTURE),
qbs::Internal::HostOsInfo::canonicalArchitecture(architecture));
}
if (targetAbi.endianness() == ProjectExplorer::Abi::BigEndian) if (targetAbi.endianness() == ProjectExplorer::Abi::BigEndian)
data.insert(QLatin1String(QBS_ENDIANNESS), QLatin1String("big")); data.insert(QLatin1String(QBS_ENDIANNESS), QLatin1String("big"));
else else if (targetAbi.endianness() == ProjectExplorer::Abi::LittleEndian)
data.insert(QLatin1String(QBS_ENDIANNESS), QLatin1String("little")); data.insert(QLatin1String(QBS_ENDIANNESS), QLatin1String("little"));
if (targetAbi.os() == ProjectExplorer::Abi::WindowsOS) { if (targetAbi.os() == ProjectExplorer::Abi::WindowsOS) {
@@ -83,19 +104,21 @@ QVariantMap DefaultPropertyProvider::properties(const ProjectExplorer::Kit *k, c
: QStringList() << QLatin1String("msvc")); : QStringList() << QLatin1String("msvc"));
} else if (targetAbi.os() == ProjectExplorer::Abi::MacOS) { } else if (targetAbi.os() == ProjectExplorer::Abi::MacOS) {
const char IOSQT[] = "Qt4ProjectManager.QtVersion.Ios"; // from Ios::Constants (include header?) const char IOSQT[] = "Qt4ProjectManager.QtVersion.Ios"; // from Ios::Constants (include header?)
const char IOS_SIMULATOR_TYPE[] = "Ios.Simulator.Type";
const QtSupport::BaseQtVersion * const qt = QtSupport::QtKitInformation::qtVersion(k); const QtSupport::BaseQtVersion * const qt = QtSupport::QtKitInformation::qtVersion(k);
if (qt && qt->type() == QLatin1String(IOSQT)) {
QStringList targetOS; QStringList targetOS;
if (targetAbi.architecture() == ProjectExplorer::Abi::X86Architecture) targetOS << QLatin1String("darwin") << QLatin1String("bsd4")
targetOS << QLatin1String("ios-simulator"); << QLatin1String("bsd") << QLatin1String("unix");
targetOS << QLatin1String("ios") << QLatin1String("darwin") if (qt && qt->type() == QLatin1String(IOSQT)) {
<< QLatin1String("bsd4") << QLatin1String("bsd") << QLatin1String("unix"); targetOS.insert(0, QLatin1String("ios"));
data.insert(QLatin1String(QBS_TARGETOS), targetOS); if (ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(k) == IOS_SIMULATOR_TYPE)
targetOS.insert(0, QLatin1String("ios-simulator"));
} else { } else {
data.insert(QLatin1String(QBS_TARGETOS), QStringList() << QLatin1String("osx") targetOS.insert(0, QLatin1String("osx"));
<< QLatin1String("darwin") << QLatin1String("bsd4")
<< QLatin1String("bsd") << QLatin1String("unix"));
} }
data.insert(QLatin1String(QBS_TARGETOS), targetOS);
if (tc->type() != QLatin1String("clang")) { if (tc->type() != QLatin1String("clang")) {
data.insert(QLatin1String(QBS_TOOLCHAIN), QLatin1String("gcc")); data.insert(QLatin1String(QBS_TOOLCHAIN), QLatin1String("gcc"));
} else { } else {

View File

@@ -35,7 +35,6 @@
#include <coreplugin/fileiconprovider.h> #include <coreplugin/fileiconprovider.h>
#include <coreplugin/idocument.h> #include <coreplugin/idocument.h>
#include <coreplugin/messagemanager.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <qtsupport/qtsupportconstants.h> #include <qtsupport/qtsupportconstants.h>
@@ -116,46 +115,6 @@ static qbs::GroupData findMainQbsGroup(const qbs::ProductData &productData)
return qbs::GroupData(); return qbs::GroupData();
} }
static bool addQbsFiles(QbsBaseProjectNode *node, const QStringList &filePaths, qbs::Project prj,
const qbs::ProductData &productData, const qbs::GroupData &groupData,
const QString &productPath, QStringList *notAdded)
{
QStringList allPaths = groupData.allFilePaths();
foreach (const QString &path, filePaths) {
qbs::ErrorInfo err = prj.addFiles(productData, groupData, QStringList() << path);
if (err.hasError()) {
Core::MessageManager::write(err.toString());
*notAdded += path;
} else {
allPaths += path;
}
}
if (notAdded->count() != filePaths.count())
QbsGroupNode::setupFiles(node, allPaths, productPath, true);
return notAdded->isEmpty();
}
static bool removeQbsFiles(QbsBaseProjectNode *node, const QStringList &filePaths, qbs::Project prj,
const qbs::ProductData &productData, const qbs::GroupData &groupData,
const QString &productPath, QStringList *notRemoved)
{
QStringList allPaths = groupData.allFilePaths();
foreach (const QString &path, filePaths) {
qbs::ErrorInfo err = prj.removeFiles(productData, groupData, QStringList() << path);
if (err.hasError()) {
Core::MessageManager::write(err.toString());
*notRemoved += path;
} else {
allPaths.removeOne(path);
}
}
if (notRemoved->count() != filePaths.count())
QbsGroupNode::setupFiles(node, allPaths, productPath, true);
return notRemoved->isEmpty();
}
class FileTreeNode { class FileTreeNode {
public: public:
explicit FileTreeNode(const QString &n = QString(), FileTreeNode *p = 0, bool f = false) : explicit FileTreeNode(const QString &n = QString(), FileTreeNode *p = 0, bool f = false) :
@@ -301,15 +260,6 @@ QString QbsFileNode::displayName() const
return ProjectExplorer::FileNode::displayName() + QLatin1Char(':') + QString::number(l); return ProjectExplorer::FileNode::displayName() + QLatin1Char(':') + QString::number(l);
} }
bool QbsFileNode::update(const qbs::CodeLocation &loc)
{
const QString oldPath = path();
const int oldLine = line();
setPathAndLine(loc.fileName(), loc.line());
return (line() != oldLine || path() != oldPath);
}
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// QbsBaseProjectNode: // QbsBaseProjectNode:
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -428,8 +378,8 @@ bool QbsGroupNode::addFiles(const QStringList &filePaths, QStringList *notAdded)
return false; return false;
} }
return addQbsFiles(this, filePaths, prjNode->qbsProject(), prdNode->qbsProductData(), return prjNode->project()->addFilesToProduct(this, filePaths, prdNode->qbsProductData(),
*m_qbsGroupData, m_productPath, notAdded); *m_qbsGroupData, notAdded);
} }
bool QbsGroupNode::removeFiles(const QStringList &filePaths, QStringList *notRemoved) bool QbsGroupNode::removeFiles(const QStringList &filePaths, QStringList *notRemoved)
@@ -450,8 +400,8 @@ bool QbsGroupNode::removeFiles(const QStringList &filePaths, QStringList *notRem
return false; return false;
} }
return removeQbsFiles(this, filePaths, prjNode->qbsProject(), prdNode->qbsProductData(), return prjNode->project()->removeFilesFromProduct(this, filePaths, prdNode->qbsProductData(),
*m_qbsGroupData, m_productPath, notRemoved); *m_qbsGroupData, notRemoved);
} }
void QbsGroupNode::updateQbsGroupData(const qbs::GroupData *grp, const QString &productPath, void QbsGroupNode::updateQbsGroupData(const qbs::GroupData *grp, const QString &productPath,
@@ -478,8 +428,8 @@ void QbsGroupNode::updateQbsGroupData(const qbs::GroupData *grp, const QString &
if (idx) if (idx)
break; break;
} }
if (idx->update(grp->location()) || updateExisting) QTC_ASSERT(idx, return);
idx->emitNodeUpdated(); idx->setPathAndLine(grp->location().fileName(), grp->location().line());
setupFiles(this, grp->allFilePaths(), productPath, updateExisting); setupFiles(this, grp->allFilePaths(), productPath, updateExisting);
@@ -632,8 +582,8 @@ bool QbsProductNode::addFiles(const QStringList &filePaths, QStringList *notAdde
qbs::GroupData grp = findMainQbsGroup(m_qbsProductData); qbs::GroupData grp = findMainQbsGroup(m_qbsProductData);
if (grp.isValid()) { if (grp.isValid()) {
const QString &productPath = QFileInfo(m_qbsProductData.location().fileName()).absolutePath(); return prjNode->project()->addFilesToProduct(this, filePaths, m_qbsProductData, grp,
return addQbsFiles(this, filePaths, prjNode->qbsProject(), m_qbsProductData, grp, productPath, notAdded); notAdded);
} }
QTC_ASSERT(false, return false); QTC_ASSERT(false, return false);
@@ -653,8 +603,8 @@ bool QbsProductNode::removeFiles(const QStringList &filePaths, QStringList *notR
qbs::GroupData grp = findMainQbsGroup(m_qbsProductData); qbs::GroupData grp = findMainQbsGroup(m_qbsProductData);
if (grp.isValid()) { if (grp.isValid()) {
const QString &productPath = QFileInfo(m_qbsProductData.location().fileName()).absolutePath(); return prjNode->project()->removeFilesFromProduct(this, filePaths, m_qbsProductData, grp,
return removeQbsFiles(this, filePaths, prjNode->qbsProject(), m_qbsProductData, grp, productPath, notRemoved); notRemoved);
} }
QTC_ASSERT(false, return false); QTC_ASSERT(false, return false);
@@ -680,8 +630,8 @@ void QbsProductNode::setQbsProductData(const qbs::ProductData prd)
if (idx) if (idx)
break; break;
} }
if (idx->update(prd.location()) || updateExisting) QTC_ASSERT(idx, return);
idx->emitNodeUpdated(); idx->setPathAndLine(prd.location().fileName(), prd.location().line());
QList<ProjectExplorer::ProjectNode *> toAdd; QList<ProjectExplorer::ProjectNode *> toAdd;
QList<ProjectExplorer::ProjectNode *> toRemove = subProjectNodes(); QList<ProjectExplorer::ProjectNode *> toRemove = subProjectNodes();

View File

@@ -55,8 +55,6 @@ public:
int line); int line);
QString displayName() const; QString displayName() const;
bool update(const qbs::CodeLocation &loc);
}; };
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@@ -37,10 +37,9 @@
#include "qbsnodes.h" #include "qbsnodes.h"
#include <coreplugin/documentmanager.h> #include <coreplugin/documentmanager.h>
#include <utils/qtcassert.h>
#include <coreplugin/icontext.h> #include <coreplugin/icontext.h>
#include <coreplugin/id.h> #include <coreplugin/id.h>
#include <coreplugin/messagemanager.h>
#include <coreplugin/progressmanager/progressmanager.h> #include <coreplugin/progressmanager/progressmanager.h>
#include <coreplugin/mimedatabase.h> #include <coreplugin/mimedatabase.h>
#include <cpptools/cppmodelmanagerinterface.h> #include <cpptools/cppmodelmanagerinterface.h>
@@ -62,12 +61,14 @@
#include <qmljstools/qmljsmodelmanager.h> #include <qmljstools/qmljsmodelmanager.h>
#include <qmljs/qmljsmodelmanagerinterface.h> #include <qmljs/qmljsmodelmanagerinterface.h>
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <qbs.h> #include <qbs.h>
#include <QCoreApplication> #include <QCoreApplication>
#include <QDir> #include <QDir>
#include <QFileInfo> #include <QFileInfo>
#include <QVariantMap>
using namespace Core; using namespace Core;
using namespace ProjectExplorer; using namespace ProjectExplorer;
@@ -185,6 +186,84 @@ QStringList QbsProject::files(Project::FilesMode fileMode) const
return result.toList(); return result.toList();
} }
class ChangeExpector
{
public:
ChangeExpector(const QString &filePath, const QSet<Core::IDocument *> &documents)
: m_document(0)
{
foreach (Core::IDocument * const doc, documents) {
if (doc->filePath() == filePath) {
m_document = doc;
break;
}
}
QTC_ASSERT(m_document, return);
Core::DocumentManager::expectFileChange(filePath);
m_wasInDocumentManager = Core::DocumentManager::removeDocument(m_document);
QTC_CHECK(m_wasInDocumentManager);
}
~ChangeExpector()
{
QTC_ASSERT(m_document, return);
Core::DocumentManager::addDocument(m_document);
Core::DocumentManager::unexpectFileChange(m_document->filePath());
}
private:
Core::IDocument *m_document;
bool m_wasInDocumentManager;
};
bool QbsProject::addFilesToProduct(QbsBaseProjectNode *node, const QStringList &filePaths,
const qbs::ProductData &productData, const qbs::GroupData &groupData, QStringList *notAdded)
{
QTC_ASSERT(m_qbsProject.isValid(), return false);
QStringList allPaths = groupData.allFilePaths();
const QString productFilePath = productData.location().fileName();
ChangeExpector expector(productFilePath, m_qbsDocuments);
foreach (const QString &path, filePaths) {
qbs::ErrorInfo err = m_qbsProject.addFiles(productData, groupData, QStringList() << path);
if (err.hasError()) {
Core::MessageManager::write(err.toString());
*notAdded += path;
} else {
allPaths += path;
}
}
if (notAdded->count() != filePaths.count()) {
m_projectData = m_qbsProject.projectData();
QbsGroupNode::setupFiles(node, allPaths, QFileInfo(productFilePath).absolutePath(), true);
}
return notAdded->isEmpty();
}
bool QbsProject::removeFilesFromProduct(QbsBaseProjectNode *node, const QStringList &filePaths,
const qbs::ProductData &productData, const qbs::GroupData &groupData,
QStringList *notRemoved)
{
QTC_ASSERT(m_qbsProject.isValid(), return false);
QStringList allPaths = groupData.allFilePaths();
const QString productFilePath = productData.location().fileName();
ChangeExpector expector(productFilePath, m_qbsDocuments);
foreach (const QString &path, filePaths) {
qbs::ErrorInfo err
= m_qbsProject.removeFiles(productData, groupData, QStringList() << path);
if (err.hasError()) {
Core::MessageManager::write(err.toString());
*notRemoved += path;
} else {
allPaths.removeOne(path);
}
}
if (notRemoved->count() != filePaths.count()) {
m_projectData = m_qbsProject.projectData();
QbsGroupNode::setupFiles(node, allPaths, QFileInfo(productFilePath).absolutePath(), true);
}
return notRemoved->isEmpty();
}
void QbsProject::invalidate() void QbsProject::invalidate()
{ {
prepareForParsing(); prepareForParsing();
@@ -259,11 +338,9 @@ qbs::Project QbsProject::qbsProject() const
return m_qbsProject; return m_qbsProject;
} }
const qbs::ProjectData QbsProject::qbsProjectData() const qbs::ProjectData QbsProject::qbsProjectData() const
{ {
if (m_qbsProject.isValid()) return m_projectData;
return m_qbsProject.projectData();
return qbs::ProjectData();
} }
bool QbsProject::needsSpecialDeployment() const bool QbsProject::needsSpecialDeployment() const

View File

@@ -42,27 +42,13 @@
#include <QFuture> #include <QFuture>
#include <QTimer> #include <QTimer>
#include <QVariantMap>
namespace qbs {
class BuildJob;
class CleanJob;
class Error;
class ProjectData;
class CleanOptions;
class InstallJob;
class InstallOptions;
class Project;
class ErrorInfo;
class BuildOptions;
} // namespace qbs
namespace Core { class IDocument; } namespace Core { class IDocument; }
namespace ProjectExplorer { class BuildConfiguration; } namespace ProjectExplorer { class BuildConfiguration; }
namespace QbsProjectManager { namespace QbsProjectManager {
namespace Internal { namespace Internal {
class QbsBaseProjectNode;
class QbsProjectNode; class QbsProjectNode;
class QbsRootProjectNode; class QbsRootProjectNode;
class QbsProjectParser; class QbsProjectParser;
@@ -84,6 +70,13 @@ public:
QStringList files(FilesMode fileMode) const; QStringList files(FilesMode fileMode) const;
bool addFilesToProduct(QbsBaseProjectNode *node, const QStringList &filePaths,
const qbs::ProductData &productData, const qbs::GroupData &groupData,
QStringList *notAdded);
bool removeFilesFromProduct(QbsBaseProjectNode *node, const QStringList &filePaths,
const qbs::ProductData &productData, const qbs::GroupData &groupData,
QStringList *notRemoved);
qbs::BuildJob *build(const qbs::BuildOptions &opts, QStringList products = QStringList()); qbs::BuildJob *build(const qbs::BuildOptions &opts, QStringList products = QStringList());
qbs::CleanJob *clean(const qbs::CleanOptions &opts); qbs::CleanJob *clean(const qbs::CleanOptions &opts);
qbs::InstallJob *install(const qbs::InstallOptions &opts); qbs::InstallJob *install(const qbs::InstallOptions &opts);
@@ -106,7 +99,7 @@ public:
const QString &bcName); const QString &bcName);
qbs::Project qbsProject() const; qbs::Project qbsProject() const;
const qbs::ProjectData qbsProjectData() const; qbs::ProjectData qbsProjectData() const;
bool needsSpecialDeployment() const; bool needsSpecialDeployment() const;
void generateErrors(const qbs::ErrorInfo &e); void generateErrors(const qbs::ErrorInfo &e);

View File

@@ -202,17 +202,17 @@ QList<FormEditorItem *> AbstractFormEditorTool::filterSelectedModelNodes(const Q
return filteredItemList; return filteredItemList;
} }
void AbstractFormEditorTool::dropEvent(QGraphicsSceneDragDropEvent * /* event */) void AbstractFormEditorTool::dropEvent(const QList<QGraphicsItem*> &/*itemList*/, QGraphicsSceneDragDropEvent * /* event */)
{ {
} }
void AbstractFormEditorTool::dragEnterEvent(QGraphicsSceneDragDropEvent * event) void AbstractFormEditorTool::dragEnterEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent *event)
{ {
if (event->mimeData()->hasFormat("application/vnd.bauhaus.itemlibraryinfo") || if (event->mimeData()->hasFormat("application/vnd.bauhaus.itemlibraryinfo") ||
event->mimeData()->hasFormat("application/vnd.bauhaus.libraryresource")) { event->mimeData()->hasFormat("application/vnd.bauhaus.libraryresource")) {
event->accept(); event->accept();
view()->changeToDragTool(); view()->changeToDragTool();
view()->currentTool()->dragEnterEvent(event); view()->currentTool()->dragEnterEvent(itemList, event);
} else { } else {
event->ignore(); event->ignore();
} }
@@ -264,6 +264,32 @@ Snapper::Snapping AbstractFormEditorTool::generateUseSnapping(Qt::KeyboardModifi
return useSnapping; return useSnapping;
} }
static bool isNotAncestorOfItemInList(FormEditorItem *formEditorItem, const QList<FormEditorItem*> &itemList)
{
foreach (FormEditorItem *item, itemList) {
if (item
&& item->qmlItemNode().isValid()
&& item->qmlItemNode().isAncestorOf(formEditorItem->qmlItemNode()))
return false;
}
return true;
}
FormEditorItem *AbstractFormEditorTool::containerFormEditorItem(const QList<QGraphicsItem *> &itemUnderMouseList, const QList<FormEditorItem *> &selectedItemList) const
{
foreach (QGraphicsItem* item, itemUnderMouseList) {
FormEditorItem *formEditorItem = FormEditorItem::fromQGraphicsItem(item);
if (formEditorItem
&& !selectedItemList.contains(formEditorItem)
&& isNotAncestorOfItemInList(formEditorItem, selectedItemList)
&& formEditorItem->isContainer())
return formEditorItem;
}
return 0;
}
void AbstractFormEditorTool::clear() void AbstractFormEditorTool::clear()
{ {
m_itemList.clear(); m_itemList.clear();

View File

@@ -52,23 +52,17 @@ public:
virtual ~AbstractFormEditorTool(); virtual ~AbstractFormEditorTool();
virtual void mousePressEvent(const QList<QGraphicsItem*> &itemList, virtual void mousePressEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event);
QGraphicsSceneMouseEvent *event); virtual void mouseMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) = 0;
virtual void mouseMoveEvent(const QList<QGraphicsItem*> &itemList, virtual void mouseReleaseEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event);
QGraphicsSceneMouseEvent *event) = 0; virtual void mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event);
virtual void mouseReleaseEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event);
virtual void mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList, virtual void hoverMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) = 0;
QGraphicsSceneMouseEvent *event);
virtual void hoverMoveEvent(const QList<QGraphicsItem*> &itemList, virtual void dropEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent *event);
QGraphicsSceneMouseEvent *event) = 0; virtual void dragEnterEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent *event);
virtual void dragLeaveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent *event) = 0;
virtual void dropEvent(QGraphicsSceneDragDropEvent * event); virtual void dragMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent *event) = 0;
virtual void dragEnterEvent(QGraphicsSceneDragDropEvent * event);
virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent * event) = 0;
virtual void dragMoveEvent(QGraphicsSceneDragDropEvent * event) = 0;
virtual void keyPressEvent(QKeyEvent *event) = 0; virtual void keyPressEvent(QKeyEvent *event) = 0;
virtual void keyReleaseEvent(QKeyEvent *keyEvent) = 0; virtual void keyReleaseEvent(QKeyEvent *keyEvent) = 0;
@@ -105,6 +99,7 @@ protected:
virtual void selectedItemsChanged(const QList<FormEditorItem*> &itemList) = 0; virtual void selectedItemsChanged(const QList<FormEditorItem*> &itemList) = 0;
virtual void showContextMenu(QGraphicsSceneMouseEvent *event); virtual void showContextMenu(QGraphicsSceneMouseEvent *event);
Snapper::Snapping generateUseSnapping(Qt::KeyboardModifiers keyboardModifier) const; Snapper::Snapping generateUseSnapping(Qt::KeyboardModifiers keyboardModifier) const;
FormEditorItem *containerFormEditorItem(const QList<QGraphicsItem*> &itemUnderMouseList, const QList<FormEditorItem*> &selectedItemList) const;
FormEditorView *view() const; FormEditorView *view() const;
void setView(FormEditorView *view); void setView(FormEditorView *view);

View File

@@ -42,28 +42,19 @@
namespace QmlDesigner { namespace QmlDesigner {
namespace Internal {
void TimerHandler::clearMoveDelay()
{
m_dragTool->clearMoveDelay();
}
}
DragTool::DragTool(FormEditorView *editorView) DragTool::DragTool(FormEditorView *editorView)
: AbstractFormEditorTool(editorView), : AbstractFormEditorTool(editorView),
m_moveManipulator(editorView->scene()->manipulatorLayerItem(), editorView), m_moveManipulator(editorView->scene()->manipulatorLayerItem(), editorView),
m_selectionIndicator(editorView->scene()->manipulatorLayerItem()), m_selectionIndicator(editorView->scene()->manipulatorLayerItem()),
m_timerHandler(new Internal::TimerHandler(this)),
m_blockMove(false), m_blockMove(false),
m_Aborted(false) m_isAborted(false)
{ {
} }
DragTool::~DragTool() DragTool::~DragTool()
{ {
} }
void DragTool::clear() void DragTool::clear()
@@ -73,22 +64,16 @@ void DragTool::clear()
m_movingItem.clear(); m_movingItem.clear();
} }
void DragTool::mousePressEvent(const QList<QGraphicsItem*> &, void DragTool::mousePressEvent(const QList<QGraphicsItem*> &, QGraphicsSceneMouseEvent *)
QGraphicsSceneMouseEvent *)
{ {
} }
void DragTool::mouseMoveEvent(const QList<QGraphicsItem*> &, void DragTool::mouseMoveEvent(const QList<QGraphicsItem*> &, QGraphicsSceneMouseEvent *)
QGraphicsSceneMouseEvent *)
{ {
} }
void DragTool::hoverMoveEvent(const QList<QGraphicsItem*> &, void DragTool::hoverMoveEvent(const QList<QGraphicsItem*> &, QGraphicsSceneMouseEvent * /*event*/)
QGraphicsSceneMouseEvent * /*event*/)
{ {
} }
void DragTool::keyPressEvent(QKeyEvent *event) void DragTool::keyPressEvent(QKeyEvent *event)
@@ -96,45 +81,36 @@ void DragTool::keyPressEvent(QKeyEvent *event)
if (event->key() == Qt::Key_Escape) { if (event->key() == Qt::Key_Escape) {
abort(); abort();
event->accept(); event->accept();
commitTransaction(); m_rewriterTransaction.commit();
view()->changeToSelectionTool(); view()->changeToSelectionTool();
} }
} }
void DragTool::keyReleaseEvent(QKeyEvent *) void DragTool::keyReleaseEvent(QKeyEvent *)
{ {
} }
void DragTool::mouseReleaseEvent(const QList<QGraphicsItem*> &/*itemList*/, void DragTool::mouseReleaseEvent(const QList<QGraphicsItem*> &/*itemList*/, QGraphicsSceneMouseEvent *)
QGraphicsSceneMouseEvent *)
{ {
} }
void DragTool::mouseDoubleClickEvent(const QList<QGraphicsItem*> & /*itemList*/, void DragTool::mouseDoubleClickEvent(const QList<QGraphicsItem*> & /*itemList*/, QGraphicsSceneMouseEvent * /*event*/)
QGraphicsSceneMouseEvent * /*event*/)
{ {
} }
void DragTool::itemsAboutToRemoved(const QList<FormEditorItem*> & /* removedItemList */) void DragTool::itemsAboutToRemoved(const QList<FormEditorItem*> & /* removedItemList */)
{ {
} }
void DragTool::selectedItemsChanged(const QList<FormEditorItem*> &) void DragTool::selectedItemsChanged(const QList<FormEditorItem*> &)
{ {
} }
void DragTool::updateMoveManipulator() void DragTool::updateMoveManipulator()
{ {
if (m_moveManipulator.isActive())
return;
} }
void DragTool::beginWithPoint(const QPointF &beginPoint) void DragTool::beginWithPoint(const QPointF &beginPoint)
@@ -147,16 +123,14 @@ void DragTool::beginWithPoint(const QPointF &beginPoint)
void DragTool::createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry, void DragTool::createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry,
const QmlItemNode &parentNode, const QmlItemNode &parentNode,
const QPointF &scenePos) const QPointF &scenePosition)
{ {
MetaInfo metaInfo = MetaInfo::global(); MetaInfo metaInfo = MetaInfo::global();
FormEditorItem *parentItem = scene()->itemForQmlItemNode(parentNode); FormEditorItem *parentItem = scene()->itemForQmlItemNode(parentNode);
QPointF pos = parentItem->mapFromScene(scenePos); QPointF positonInItemSpace = parentItem->qmlItemNode().instanceSceneContentItemTransform().inverted().map(scenePosition);
m_dragNode = QmlItemNode::createQmlItemNode(view(), itemLibraryEntry, pos, parentNode); m_dragNode = QmlItemNode::createQmlItemNode(view(), itemLibraryEntry, positonInItemSpace, parentNode);
Q_ASSERT(m_dragNode.modelNode().isValid());
QList<QmlItemNode> nodeList; QList<QmlItemNode> nodeList;
nodeList.append(m_dragNode); nodeList.append(m_dragNode);
@@ -165,46 +139,30 @@ void DragTool::createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry,
void DragTool::createQmlItemNodeFromImage(const QString &imageName, void DragTool::createQmlItemNodeFromImage(const QString &imageName,
const QmlItemNode &parentNode, const QmlItemNode &parentNode,
const QPointF &scenePos) const QPointF &scenePosition)
{ {
if (!parentNode.isValid()) if (parentNode.isValid()) {
return;
MetaInfo metaInfo = MetaInfo::global(); MetaInfo metaInfo = MetaInfo::global();
FormEditorItem *parentItem = scene()->itemForQmlItemNode(parentNode); FormEditorItem *parentItem = scene()->itemForQmlItemNode(parentNode);
QPointF pos = parentItem->mapFromScene(scenePos); QPointF positonInItemSpace = parentItem->qmlItemNode().instanceSceneContentItemTransform().inverted().map(scenePosition);
m_dragNode = QmlItemNode::createQmlItemNodeFromImage(view(), imageName, pos, parentNode); m_dragNode = QmlItemNode::createQmlItemNodeFromImage(view(), imageName, positonInItemSpace, parentNode);
QList<QmlItemNode> nodeList; QList<QmlItemNode> nodeList;
nodeList.append(m_dragNode); nodeList.append(m_dragNode);
m_selectionIndicator.setItems(scene()->itemsForQmlItemNodes(nodeList)); m_selectionIndicator.setItems(scene()->itemsForQmlItemNodes(nodeList));
}
static inline bool isAncestorOf(FormEditorItem *formEditorItem, FormEditorItem *newParentItem)
{
if (formEditorItem && newParentItem)
return formEditorItem->isAncestorOf(newParentItem);
return false;
}
FormEditorItem* DragTool::calculateContainer(const QPointF &point, FormEditorItem * currentItem)
{
QList<QGraphicsItem *> list = scene()->items(point);
foreach (QGraphicsItem *item, list) {
FormEditorItem *formEditorItem = FormEditorItem::fromQGraphicsItem(item);
if (formEditorItem
&& formEditorItem != currentItem
&& formEditorItem->isContainer()
&& !formEditorItem->qmlItemNode().modelNode().metaInfo().isLayoutable()
&& !isAncestorOf(currentItem, formEditorItem))
return formEditorItem;
} }
}
if (scene()->rootFormEditorItem()) FormEditorItem* DragTool::targetContainerOrRootItem(const QList<QGraphicsItem*> &itemList, FormEditorItem * currentItem)
return scene()->rootFormEditorItem(); {
return 0; FormEditorItem *formEditorItem = containerFormEditorItem(itemList, QList<FormEditorItem*>() << currentItem);
if (!formEditorItem)
formEditorItem = scene()->rootFormEditorItem();
return formEditorItem;
} }
void DragTool::formEditorItemsChanged(const QList<FormEditorItem*> & itemList) void DragTool::formEditorItemsChanged(const QList<FormEditorItem*> & itemList)
@@ -235,54 +193,63 @@ void DragTool::instancePropertyChange(const QList<QPair<ModelNode, PropertyName>
void DragTool::clearMoveDelay() void DragTool::clearMoveDelay()
{ {
if (!m_blockMove) if (m_blockMove) {
return;
m_blockMove = false; m_blockMove = false;
if (m_dragNode.isValid()) if (m_dragNode.isValid())
beginWithPoint(m_startPoint); beginWithPoint(m_startPoint);
}
} }
void DragTool::abort() void DragTool::abort()
{ {
if (m_Aborted) if (!m_isAborted) {
return; m_isAborted = true;
m_Aborted = true;
if (m_dragNode.isValid()) if (m_dragNode.isValid())
m_dragNode.destroy(); m_dragNode.destroy();
}
void DragTool::commitTransaction()
{
try {
m_rewriterTransaction.commit();
} catch (RewritingException &e) {
e.showException();
} }
} }
void DragTool::dropEvent(QGraphicsSceneDragDropEvent * event) static bool canHandleMimeData(const QMimeData *mimeData)
{ {
if (event->mimeData()->hasFormat("application/vnd.bauhaus.itemlibraryinfo") || return mimeData->hasFormat(QStringLiteral("application/vnd.bauhaus.itemlibraryinfo"))
event->mimeData()->hasFormat("application/vnd.bauhaus.libraryresource")) { || mimeData->hasFormat(QStringLiteral("application/vnd.bauhaus.libraryresource"));
}
static bool hasItemLibraryInfo(const QMimeData *mimeData)
{
return mimeData->hasFormat(QStringLiteral("application/vnd.bauhaus.itemlibraryinfo"));
}
static bool hasLibraryResources(const QMimeData *mimeData)
{
return mimeData->hasFormat(QStringLiteral("application/vnd.bauhaus.libraryresource"));
}
void DragTool::dropEvent(const QList<QGraphicsItem*> &/*itemList*/, QGraphicsSceneDragDropEvent *event)
{
if (canHandleMimeData(event->mimeData())) {
event->accept(); event->accept();
end(generateUseSnapping(event->modifiers())); end(generateUseSnapping(event->modifiers()));
commitTransaction(); m_rewriterTransaction.commit();
if (m_dragNode.isValid()) { if (m_dragNode.isValid()) {
QList<QmlItemNode> nodeList; QList<QmlItemNode> nodeList;
nodeList.append(m_dragNode); nodeList.append(m_dragNode);
view()->setSelectedModelNodes(toModelNodeList(nodeList)); view()->setSelectedModelNodes(toModelNodeList(nodeList));
} }
m_dragNode = ModelNode();
m_dragNode = QmlItemNode();
view()->changeToSelectionTool(); view()->changeToSelectionTool();
} }
} }
static ItemLibraryEntry itemLibraryEntryFromData(const QByteArray &data) static ItemLibraryEntry itemLibraryEntryFromMimeData(const QMimeData *mimeData)
{ {
QByteArray data = mimeData->data(QStringLiteral("application/vnd.bauhaus.itemlibraryinfo"));
QDataStream stream(data); QDataStream stream(data);
ItemLibraryEntry itemLibraryEntry; ItemLibraryEntry itemLibraryEntry;
@@ -291,16 +258,13 @@ static ItemLibraryEntry itemLibraryEntryFromData(const QByteArray &data)
return itemLibraryEntry; return itemLibraryEntry;
} }
void DragTool::dragEnterEvent(QGraphicsSceneDragDropEvent * event) void DragTool::dragEnterEvent(const QList<QGraphicsItem*> &/*itemList*/, QGraphicsSceneDragDropEvent *event)
{ {
if (event->mimeData()->hasFormat("application/vnd.bauhaus.itemlibraryinfo") || if (canHandleMimeData(event->mimeData())) {
event->mimeData()->hasFormat("application/vnd.bauhaus.libraryresource")) {
QList<Import> importToBeAddedList;
m_blockMove = false; m_blockMove = false;
if (event->mimeData()->hasFormat("application/vnd.bauhaus.itemlibraryinfo")) { if (hasItemLibraryInfo(event->mimeData())) {
view()->widgetInfo().widget->setFocus(); view()->widgetInfo().widget->setFocus();
m_Aborted = false; m_isAborted = false;
Q_ASSERT(!event->mimeData()->data("application/vnd.bauhaus.itemlibraryinfo").isEmpty());
} }
if (!m_rewriterTransaction.isValid()) { if (!m_rewriterTransaction.isValid()) {
@@ -310,10 +274,9 @@ void DragTool::dragEnterEvent(QGraphicsSceneDragDropEvent * event)
} }
} }
void DragTool::dragLeaveEvent(QGraphicsSceneDragDropEvent * event) void DragTool::dragLeaveEvent(const QList<QGraphicsItem*> &/*itemList*/, QGraphicsSceneDragDropEvent *event)
{ {
if (event->mimeData()->hasFormat("application/vnd.bauhaus.itemlibraryinfo") || if (canHandleMimeData(event->mimeData())) {
event->mimeData()->hasFormat("application/vnd.bauhaus.libraryresource")) {
event->accept(); event->accept();
m_moveManipulator.end(); m_moveManipulator.end();
@@ -321,66 +284,55 @@ void DragTool::dragLeaveEvent(QGraphicsSceneDragDropEvent * event)
if (m_dragNode.isValid()) if (m_dragNode.isValid())
m_dragNode.destroy(); m_dragNode.destroy();
commitTransaction(); m_rewriterTransaction.commit();
QList<QmlItemNode> nodeList; view()->clearSelectedModelNodes();
view()->setSelectedModelNodes(toModelNodeList(nodeList));
view()->changeToSelectionTool(); view()->changeToSelectionTool();
} }
} }
void DragTool::dragMoveEvent(QGraphicsSceneDragDropEvent * event) static QString libraryResourceImageName(const QMimeData *mimeData)
{ {
if (m_blockMove) return QString::fromUtf8((mimeData->data(QStringLiteral("application/vnd.bauhaus.libraryresource"))));
return; }
if (m_Aborted) { void DragTool::createDragNode(const QMimeData *mimeData, const QPointF &scenePosition, const QList<QGraphicsItem*> &itemList)
event->ignore(); {
return; if (!m_dragNode.hasModelNode()) {
} FormEditorItem *targetContainerFormEditorItem = targetContainerOrRootItem(itemList);
if (targetContainerFormEditorItem) {
QmlItemNode targetContainerQmlItemNode;
if (targetContainerFormEditorItem)
targetContainerQmlItemNode = targetContainerFormEditorItem->qmlItemNode();
if (event->mimeData()->hasFormat("application/vnd.bauhaus.itemlibraryinfo") || if (hasItemLibraryInfo(mimeData))
event->mimeData()->hasFormat("application/vnd.bauhaus.libraryresource")) { createQmlItemNode(itemLibraryEntryFromMimeData(mimeData), targetContainerQmlItemNode, scenePosition);
event->accept(); else if (hasLibraryResources(mimeData))
QPointF scenePos = event->scenePos(); createQmlItemNodeFromImage(libraryResourceImageName(mimeData), targetContainerQmlItemNode, scenePosition);
if (m_dragNode.isValid()) {
FormEditorItem *parentItem = calculateContainer(event->scenePos() + QPoint(2, 2));
if (!parentItem) { //if there is no parent any more - the use left the scene
end();
m_dragNode.destroy(); //delete the node then
return;
}
//move
move(event->scenePos());
} else {
//create new node if container
if (m_dragNode.modelNode().isValid())
return;
FormEditorItem *parentItem = calculateContainer(scenePos);
if (!parentItem)
return;
QmlItemNode parentNode;
if (parentItem)
parentNode = parentItem->qmlItemNode();
if (event->mimeData()->hasFormat("application/vnd.bauhaus.itemlibraryinfo")) {
Q_ASSERT(!event->mimeData()->data("application/vnd.bauhaus.itemlibraryinfo").isEmpty());
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::fromUtf8((event->mimeData()->data("application/vnd.bauhaus.libraryresource")));
createQmlItemNodeFromImage(imageName, parentNode, event->scenePos());
} else Q_ASSERT(false);
m_blockMove = true; m_blockMove = true;
m_startPoint = event->scenePos(); m_startPoint = scenePosition;
QTimer::singleShot(10000, m_timerHandler.data(), SLOT(clearMoveDelay()));
} }
} }
}
if (event->mimeData()->hasFormat("application/vnd.bauhaus.libraryresource")) { void DragTool::dragMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent *event)
{
if (!m_blockMove && !m_isAborted && canHandleMimeData(event->mimeData())) {
event->accept();
if (m_dragNode.isValid()) {
FormEditorItem *targetContainerItem = targetContainerOrRootItem(itemList);
if (targetContainerItem) {
move(event->scenePos(), itemList);
} else {
end();
m_dragNode.destroy();
}
} else {
createDragNode(event->mimeData(), event->scenePos(), itemList);
}
} else{
event->ignore();
} }
} }
@@ -396,25 +348,20 @@ void DragTool::end(Snapper::Snapping useSnapping)
clear(); clear();
} }
void DragTool::move(const QPointF &scenePos) void DragTool::move(const QPointF &scenePosition, const QList<QGraphicsItem*> &itemList)
{ {
if (!m_movingItem) if (m_movingItem) {
return; FormEditorItem *containerItem = targetContainerOrRootItem(itemList, m_movingItem.data());
FormEditorItem *containerItem = calculateContainer(scenePos - QPoint(2, 2), m_movingItem.data());
if (containerItem && m_movingItem->parentItem() && if (containerItem && m_movingItem->parentItem() &&
containerItem != m_movingItem->parentItem()) { containerItem != m_movingItem->parentItem()) {
m_moveManipulator.reparentTo(containerItem); m_moveManipulator.reparentTo(containerItem);
} }
//MoveManipulator::Snapping useSnapping = MoveManipulator::NoSnapping;
Snapper::Snapping useSnapping = Snapper::UseSnapping; Snapper::Snapping useSnapping = Snapper::UseSnapping;
/* if (event->modifiers().testFlag(Qt::ControlModifier) != view()->isSnapButtonChecked())
useSnapping = MoveManipulator::UseSnapping;*/
m_moveManipulator.update(scenePos, useSnapping, MoveManipulator::UseBaseState); m_moveManipulator.update(scenePosition, useSnapping, MoveManipulator::UseBaseState);
}
} }
} }

View File

@@ -42,38 +42,23 @@ namespace QmlDesigner {
class DragTool; class DragTool;
namespace Internal {
class TimerHandler : public QObject
{
Q_OBJECT
public:
TimerHandler(DragTool *tool) : QObject(), m_dragTool(tool) {}
public slots:
void clearMoveDelay();
private:
DragTool *m_dragTool;
};
}
class DragTool : public AbstractFormEditorTool class DragTool : public AbstractFormEditorTool
{ {
public: public:
DragTool(FormEditorView* editorView); DragTool(FormEditorView *editorView);
virtual ~DragTool(); virtual ~DragTool();
void mousePressEvent(const QList<QGraphicsItem*> &itemList, void mousePressEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE; void mouseMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseMoveEvent(const QList<QGraphicsItem*> &itemList, void mouseReleaseEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE; void mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseReleaseEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE; void hoverMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE; void dropEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent *event) QTC_OVERRIDE;
void hoverMoveEvent(const QList<QGraphicsItem*> &itemList, void dragEnterEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent *event) QTC_OVERRIDE;
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE; void dragLeaveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent *event) QTC_OVERRIDE;
void dragMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent *event) QTC_OVERRIDE;
void keyPressEvent(QKeyEvent *event) QTC_OVERRIDE; void keyPressEvent(QKeyEvent *event) QTC_OVERRIDE;
void keyReleaseEvent(QKeyEvent *keyEvent) QTC_OVERRIDE; void keyReleaseEvent(QKeyEvent *keyEvent) QTC_OVERRIDE;
@@ -88,14 +73,6 @@ public:
void beginWithPoint(const QPointF &beginPoint); void beginWithPoint(const QPointF &beginPoint);
virtual void dropEvent(QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE;
virtual void dragEnterEvent(QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE;
virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE;
virtual void dragMoveEvent(QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE;
//void beginWithPoint(const QPointF &beginPoint);
void clear() QTC_OVERRIDE; void clear() QTC_OVERRIDE;
void formEditorItemsChanged(const QList<FormEditorItem*> &itemList) QTC_OVERRIDE; void formEditorItemsChanged(const QList<FormEditorItem*> &itemList) QTC_OVERRIDE;
@@ -106,28 +83,24 @@ public:
protected: protected:
void abort(); void abort();
private:
void commitTransaction();
void createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry, const QmlItemNode &parentNode, const QPointF &scenePos); void createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry, const QmlItemNode &parentNode, const QPointF &scenePos);
void createQmlItemNodeFromImage(const QString &imageName, const QmlItemNode &parentNode, const QPointF &scenePos); void createQmlItemNodeFromImage(const QString &imageName, const QmlItemNode &parentNode, const QPointF &scenePos);
FormEditorItem* calculateContainer(const QPointF &point, FormEditorItem * currentItem = 0); FormEditorItem *targetContainerOrRootItem(const QList<QGraphicsItem*> &itemList, FormEditorItem *urrentItem = 0);
void begin(QPointF scenePos); void begin(QPointF scenePos);
void end(); void end();
void end(Snapper::Snapping useSnapping); void end(Snapper::Snapping useSnapping);
void move(const QPointF &scenePos); void move(const QPointF &scenePos, const QList<QGraphicsItem *> &itemList);
void createDragNode(const QMimeData *mimeData, const QPointF &scenePosition, const QList<QGraphicsItem *> &itemList);
private:
MoveManipulator m_moveManipulator; MoveManipulator m_moveManipulator;
SelectionIndicator m_selectionIndicator; SelectionIndicator m_selectionIndicator;
QPointer<FormEditorItem> m_movingItem; QPointer<FormEditorItem> m_movingItem;
RewriterTransaction m_rewriterTransaction; RewriterTransaction m_rewriterTransaction;
QmlItemNode m_dragNode; QmlItemNode m_dragNode;
QScopedPointer<Internal::TimerHandler> m_timerHandler;
bool m_blockMove; bool m_blockMove;
QPointF m_startPoint; QPointF m_startPoint;
bool m_Aborted; bool m_isAborted;
}; };

View File

@@ -426,7 +426,7 @@ bool FormEditorItem::isContainer() const
NodeMetaInfo nodeMetaInfo = qmlItemNode().modelNode().metaInfo(); NodeMetaInfo nodeMetaInfo = qmlItemNode().modelNode().metaInfo();
if (nodeMetaInfo.isValid()) if (nodeMetaInfo.isValid())
return !nodeMetaInfo.defaultPropertyIsComponent(); return !nodeMetaInfo.defaultPropertyIsComponent() && !nodeMetaInfo.isLayoutable();
return true; return true;
} }

View File

@@ -225,7 +225,7 @@ FormEditorItem *FormEditorScene::addFormEditorItem(const QmlItemNode &qmlItemNod
void FormEditorScene::dropEvent(QGraphicsSceneDragDropEvent * event) void FormEditorScene::dropEvent(QGraphicsSceneDragDropEvent * event)
{ {
currentTool()->dropEvent(event); currentTool()->dropEvent(removeLayerItems(items(event->scenePos())), event);
if (views().first()) if (views().first())
views().first()->setFocus(); views().first()->setFocus();
@@ -233,19 +233,19 @@ void FormEditorScene::dropEvent(QGraphicsSceneDragDropEvent * event)
void FormEditorScene::dragEnterEvent(QGraphicsSceneDragDropEvent * event) void FormEditorScene::dragEnterEvent(QGraphicsSceneDragDropEvent * event)
{ {
currentTool()->dragEnterEvent(event); currentTool()->dragEnterEvent(removeLayerItems(items(event->scenePos())), event);
} }
void FormEditorScene::dragLeaveEvent(QGraphicsSceneDragDropEvent * event) void FormEditorScene::dragLeaveEvent(QGraphicsSceneDragDropEvent * event)
{ {
currentTool()->dragLeaveEvent(event); currentTool()->dragLeaveEvent(removeLayerItems(items(event->scenePos())), event);
return; return;
} }
void FormEditorScene::dragMoveEvent(QGraphicsSceneDragDropEvent * event) void FormEditorScene::dragMoveEvent(QGraphicsSceneDragDropEvent * event)
{ {
currentTool()->dragMoveEvent(event); currentTool()->dragMoveEvent(removeLayerItems(items(event->scenePos())), event);
} }
QList<QGraphicsItem *> FormEditorScene::removeLayerItems(const QList<QGraphicsItem *> &itemList) QList<QGraphicsItem *> FormEditorScene::removeLayerItems(const QList<QGraphicsItem *> &itemList)

View File

@@ -299,6 +299,12 @@ void FormEditorView::propertiesRemoved(const QList<AbstractProperty> &/*property
{ {
} }
void FormEditorView::customNotification(const AbstractView */*view*/, const QString &identifier, const QList<ModelNode> &/*nodeList*/, const QList<QVariant> &/*data*/)
{
if (identifier == QStringLiteral("puppet crashed"))
m_dragTool->clearMoveDelay();
}
AbstractFormEditorTool* FormEditorView::currentTool() const AbstractFormEditorTool* FormEditorView::currentTool() const
{ {
return m_currentTool; return m_currentTool;

View File

@@ -84,6 +84,8 @@ public:
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList) QTC_OVERRIDE; void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList) QTC_OVERRIDE;
void propertiesRemoved(const QList<AbstractProperty> &propertyList) QTC_OVERRIDE; void propertiesRemoved(const QList<AbstractProperty> &propertyList) QTC_OVERRIDE;
void customNotification(const AbstractView *view, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data) QTC_OVERRIDE;
// FormEditorView // FormEditorView
WidgetInfo widgetInfo() QTC_OVERRIDE; WidgetInfo widgetInfo() QTC_OVERRIDE;

View File

@@ -103,7 +103,7 @@ void MoveManipulator::synchronizeParent(const QList<FormEditorItem*> &itemList,
void MoveManipulator::synchronizeInstanceParent(const QList<FormEditorItem*> &itemList) void MoveManipulator::synchronizeInstanceParent(const QList<FormEditorItem*> &itemList)
{ {
if (m_view->model() && !m_itemList.isEmpty() && m_itemList.first()->qmlItemNode().instanceParent().isValid()) if (m_view->model() && !m_itemList.isEmpty() && m_itemList.first()->qmlItemNode().hasInstanceParent())
synchronizeParent(itemList, m_itemList.first()->qmlItemNode().instanceParent()); synchronizeParent(itemList, m_itemList.first()->qmlItemNode().instanceParent());
} }

View File

@@ -198,12 +198,12 @@ void MoveTool::keyReleaseEvent(QKeyEvent *keyEvent)
} }
} }
void MoveTool::dragLeaveEvent(QGraphicsSceneDragDropEvent * /*event*/) void MoveTool::dragLeaveEvent(const QList<QGraphicsItem*> &/*itemList*/, QGraphicsSceneDragDropEvent * /*event*/)
{ {
} }
void MoveTool::dragMoveEvent(QGraphicsSceneDragDropEvent * /*event*/) void MoveTool::dragMoveEvent(const QList<QGraphicsItem*> &/*itemList*/, QGraphicsSceneDragDropEvent * /*event*/)
{ {
} }
@@ -319,35 +319,7 @@ void MoveTool::beginWithPoint(const QPointF &beginPoint)
m_moveManipulator.begin(beginPoint); m_moveManipulator.begin(beginPoint);
} }
static bool isNotAncestorOfItemInList(FormEditorItem *formEditorItem, const QList<FormEditorItem*> &itemList)
{
foreach (FormEditorItem *item, itemList) {
if (item
&& item->qmlItemNode().isValid()
&& item->qmlItemNode().isAncestorOf(formEditorItem->qmlItemNode()))
return false;
}
return true;
}
FormEditorItem* MoveTool::containerFormEditorItem(const QList<QGraphicsItem*> &itemUnderMouseList,
const QList<FormEditorItem*> &selectedItemList)
{
Q_ASSERT(!selectedItemList.isEmpty());
foreach (QGraphicsItem* item, itemUnderMouseList) {
FormEditorItem *formEditorItem = FormEditorItem::fromQGraphicsItem(item);
if (formEditorItem
&& !selectedItemList.contains(formEditorItem)
&& isNotAncestorOfItemInList(formEditorItem, selectedItemList)
&& formEditorItem->isContainer())
return formEditorItem;
}
return 0;
}
QList<FormEditorItem*> movalbeItems(const QList<FormEditorItem*> &itemList) QList<FormEditorItem*> movalbeItems(const QList<FormEditorItem*> &itemList)
{ {

View File

@@ -47,21 +47,16 @@ public:
MoveTool(FormEditorView* editorView); MoveTool(FormEditorView* editorView);
~MoveTool(); ~MoveTool();
void mousePressEvent(const QList<QGraphicsItem*> &itemList, void mousePressEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE; void mouseMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseMoveEvent(const QList<QGraphicsItem*> &itemList, void mouseReleaseEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE; void mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseReleaseEvent(const QList<QGraphicsItem*> &itemList, void hoverMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void hoverMoveEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void keyPressEvent(QKeyEvent *event) QTC_OVERRIDE; void keyPressEvent(QKeyEvent *event) QTC_OVERRIDE;
void keyReleaseEvent(QKeyEvent *keyEvent) QTC_OVERRIDE; void keyReleaseEvent(QKeyEvent *keyEvent) QTC_OVERRIDE;
void dragLeaveEvent(QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE; void dragLeaveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE;
void dragMoveEvent(QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE; void dragMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE;
void itemsAboutToRemoved(const QList<FormEditorItem*> &itemList) QTC_OVERRIDE; void itemsAboutToRemoved(const QList<FormEditorItem*> &itemList) QTC_OVERRIDE;
@@ -84,8 +79,6 @@ protected:
static QList<FormEditorItem*> movingItems(const QList<FormEditorItem*> &selectedItemList); static QList<FormEditorItem*> movingItems(const QList<FormEditorItem*> &selectedItemList);
static FormEditorItem* containerFormEditorItem(const QList<QGraphicsItem*> &itemUnderMouseList,
const QList<FormEditorItem*> &selectedItemList);
static bool isAncestorOfAllItems(FormEditorItem* maybeAncestorItem, static bool isAncestorOfAllItems(FormEditorItem* maybeAncestorItem,
const QList<FormEditorItem*> &itemList); const QList<FormEditorItem*> &itemList);

View File

@@ -98,12 +98,12 @@ void ResizeTool::hoverMoveEvent(const QList<QGraphicsItem*> &itemList,
} }
} }
void ResizeTool::dragLeaveEvent(QGraphicsSceneDragDropEvent * /*event*/) void ResizeTool::dragLeaveEvent(const QList<QGraphicsItem*> &/*itemList*/, QGraphicsSceneDragDropEvent * /*event*/)
{ {
} }
void ResizeTool::dragMoveEvent(QGraphicsSceneDragDropEvent * /*event*/) void ResizeTool::dragMoveEvent(const QList<QGraphicsItem*> &/*itemList*/, QGraphicsSceneDragDropEvent * /*event*/)
{ {
} }

View File

@@ -45,19 +45,15 @@ public:
ResizeTool(FormEditorView* editorView); ResizeTool(FormEditorView* editorView);
~ResizeTool(); ~ResizeTool();
void mousePressEvent(const QList<QGraphicsItem*> &itemList, void mousePressEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE; void mouseMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseMoveEvent(const QList<QGraphicsItem*> &itemList, void mouseReleaseEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE; void mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseReleaseEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void hoverMoveEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void dragLeaveEvent(QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE; void hoverMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void dragMoveEvent(QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE;
void dragLeaveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent *event) QTC_OVERRIDE;
void dragMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent *event) QTC_OVERRIDE;
void keyPressEvent(QKeyEvent *event) QTC_OVERRIDE; void keyPressEvent(QKeyEvent *event) QTC_OVERRIDE;
void keyReleaseEvent(QKeyEvent *keyEvent) QTC_OVERRIDE; void keyReleaseEvent(QKeyEvent *keyEvent) QTC_OVERRIDE;

View File

@@ -211,11 +211,11 @@ void SelectionTool::keyReleaseEvent(QKeyEvent * /*keyEvent*/)
} }
void SelectionTool::dragLeaveEvent(QGraphicsSceneDragDropEvent * /*event*/) void SelectionTool::dragLeaveEvent(const QList<QGraphicsItem*> &/*itemList*/, QGraphicsSceneDragDropEvent * /*event*/)
{ {
} }
void SelectionTool::dragMoveEvent(QGraphicsSceneDragDropEvent * /*event*/) void SelectionTool::dragMoveEvent(const QList<QGraphicsItem*> &/*itemList*/, QGraphicsSceneDragDropEvent * /*event*/)
{ {
} }

View File

@@ -51,21 +51,18 @@ public:
SelectionTool(FormEditorView* editorView); SelectionTool(FormEditorView* editorView);
~SelectionTool(); ~SelectionTool();
void mousePressEvent(const QList<QGraphicsItem*> &itemList, void mousePressEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE; void mouseMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseMoveEvent(const QList<QGraphicsItem*> &itemList, void mouseReleaseEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE; void mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseReleaseEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE; void hoverMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void hoverMoveEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void keyPressEvent(QKeyEvent *event) QTC_OVERRIDE; void keyPressEvent(QKeyEvent *event) QTC_OVERRIDE;
void keyReleaseEvent(QKeyEvent *keyEvent) QTC_OVERRIDE; void keyReleaseEvent(QKeyEvent *keyEvent) QTC_OVERRIDE;
void dragLeaveEvent(QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE; void dragLeaveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE;
void dragMoveEvent(QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE; void dragMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE;
void itemsAboutToRemoved(const QList<FormEditorItem*> &itemList) QTC_OVERRIDE; void itemsAboutToRemoved(const QList<FormEditorItem*> &itemList) QTC_OVERRIDE;
// QVariant itemChange(const QList<QGraphicsItem*> &itemList, // QVariant itemChange(const QList<QGraphicsItem*> &itemList,

View File

@@ -44,6 +44,7 @@ public:
operator ModelNode() const; operator ModelNode() const;
ModelNode modelNode(); ModelNode modelNode();
const ModelNode modelNode() const; const ModelNode modelNode() const;
bool hasModelNode() const;
static bool isValidQmlModelNodeFacade(const ModelNode &modelNode); static bool isValidQmlModelNodeFacade(const ModelNode &modelNode);
virtual bool isValid() const; virtual bool isValid() const;
virtual ~QmlModelNodeFacade(); virtual ~QmlModelNodeFacade();

View File

@@ -490,6 +490,7 @@ InformationName NodeInstance::setInformationSceneTransform(const QTransform &sce
{ {
if (d->sceneTransform != sceneTransform) { if (d->sceneTransform != sceneTransform) {
d->sceneTransform = sceneTransform; d->sceneTransform = sceneTransform;
if (!directUpdates())
return SceneTransform; return SceneTransform;
} }
@@ -592,7 +593,7 @@ InformationName NodeInstance::setInformation(InformationName name, const QVarian
switch (name) { switch (name) {
case Size: return setInformationSize(information.toSizeF()); case Size: return setInformationSize(information.toSizeF());
case BoundingRect: return setInformationBoundingRect(information.toRectF()); case BoundingRect: return setInformationBoundingRect(information.toRectF());
case ContentItemBoundingRect: setInformationContentItemBoundingRect(information.toRectF()); case ContentItemBoundingRect: return setInformationContentItemBoundingRect(information.toRectF());
case Transform: return setInformationTransform(information.value<QTransform>()); case Transform: return setInformationTransform(information.value<QTransform>());
case ContentTransform: return setInformationContentTransform(information.value<QTransform>()); case ContentTransform: return setInformationContentTransform(information.value<QTransform>());
case ContentItemTransform: return setInformationContentItemTransform(information.value<QTransform>()); case ContentItemTransform: return setInformationContentItemTransform(information.value<QTransform>());

View File

@@ -188,6 +188,8 @@ void NodeInstanceView::handleChrash()
restartProcess(); restartProcess();
else else
emit qmlPuppetCrashed(); emit qmlPuppetCrashed();
emitCustomNotification(QStringLiteral("puppet crashed"));
} }
@@ -218,6 +220,11 @@ void NodeInstanceView::nodeCreated(const ModelNode &createdNode)
if (isSkippedNode(createdNode)) if (isSkippedNode(createdNode))
return; return;
QList<VariantProperty> propertyList;
propertyList.append(createdNode.variantProperty("x"));
propertyList.append(createdNode.variantProperty("y"));
updatePosition(propertyList);
nodeInstanceServer()->createInstances(createCreateInstancesCommand(QList<NodeInstance>() << instance)); nodeInstanceServer()->createInstances(createCreateInstancesCommand(QList<NodeInstance>() << instance));
nodeInstanceServer()->changePropertyValues(createChangeValueCommand(createdNode.variantProperties())); nodeInstanceServer()->changePropertyValues(createChangeValueCommand(createdNode.variantProperties()));
nodeInstanceServer()->completeComponent(createComponentCompleteCommand(QList<NodeInstance>() << instance)); nodeInstanceServer()->completeComponent(createComponentCompleteCommand(QList<NodeInstance>() << instance));

View File

@@ -49,7 +49,7 @@
<item> <item>
<widget class="QPushButton" name="useFallbackPuppetPushButton"> <widget class="QPushButton" name="useFallbackPuppetPushButton">
<property name="text"> <property name="text">
<string>Use fallback QML emulation layer</string> <string>Use Fallback QML Emulation Layer</string>
</property> </property>
<property name="autoDefault"> <property name="autoDefault">
<bool>false</bool> <bool>false</bool>

View File

@@ -75,6 +75,11 @@ const ModelNode QmlModelNodeFacade::modelNode() const
return m_modelNode; return m_modelNode;
} }
bool QmlModelNodeFacade::hasModelNode() const
{
return m_modelNode.isValid();
}
bool QmlModelNodeFacade::isValid() const bool QmlModelNodeFacade::isValid() const
{ {
return isValidQmlModelNodeFacade(m_modelNode); return isValidQmlModelNodeFacade(m_modelNode);

View File

@@ -129,7 +129,7 @@ const char QNX_OK_ICON[] = ":/qnx/images/ok.png";
const char QNX_BLACKBERRY_SETUP_URL[] = "http://qt-project.org/wiki/Qt-Creator-with-BlackBerry-10"; const char QNX_BLACKBERRY_SETUP_URL[] = "http://qt-project.org/wiki/Qt-Creator-with-BlackBerry-10";
const char QNX_LEGACY_KEYS_URL[] = "https://developer.blackberry.com/native/documentation/core" const char QNX_LEGACY_KEYS_URL[] = "https://developer.blackberry.com/native/documentation/core"
"/com.qnx.doc.native_sdk.devguide/topic/bbid_to_sa.html"; "/com.qnx.doc.ide.userguide/topic/signing_and_publishing.html";
const char QNX_REGISTER_KEYS_URL[] = "https://www.blackberry.com/SignedKeys/codesigning.html"; const char QNX_REGISTER_KEYS_URL[] = "https://www.blackberry.com/SignedKeys/codesigning.html";
const char QNX_BB_KEY_CONFIGURATION_TYPE[] = "BBConfigurationType"; const char QNX_BB_KEY_CONFIGURATION_TYPE[] = "BBConfigurationType";

View File

@@ -58,7 +58,7 @@
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="userNameLabel"> <widget class="QLabel" name="userNameLabel">
<property name="text"> <property name="text">
<string>The user name to log into the device:</string> <string>The username to log into the device:</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@@ -59,9 +59,8 @@ void RefactorOverlay::paint(QPainter *painter, const QRect &clip)
RefactorMarker RefactorOverlay::markerAt(const QPoint &pos) const RefactorMarker RefactorOverlay::markerAt(const QPoint &pos) const
{ {
QPointF offset = m_editor->contentOffset();
foreach (const RefactorMarker &marker, m_markers) { foreach (const RefactorMarker &marker, m_markers) {
if (marker.rect.translated(offset.toPoint()).contains(pos)) if (marker.rect.contains(pos))
return marker; return marker;
} }
return RefactorMarker(); return RefactorMarker();

File diff suppressed because it is too large Load Diff

View File

@@ -133,6 +133,7 @@ void tst_c99::parse_data()
QTest::newRow("designatedInitializer.1") << "designatedInitializer.1.c" << ""; QTest::newRow("designatedInitializer.1") << "designatedInitializer.1.c" << "";
QTest::newRow("designatedInitializer.2") << "designatedInitializer.2.c" << ""; QTest::newRow("designatedInitializer.2") << "designatedInitializer.2.c" << "";
QTest::newRow("limits-caselabels (QTCREATORBUG-12673)") << "limits-caselabels.c" << "";
} }
void tst_c99::parse() void tst_c99::parse()

View File

@@ -3728,22 +3728,33 @@ void tst_Dumpers::dumper_data()
"Map::iterator it4 = it3; ++it4;\n" "Map::iterator it4 = it3; ++it4;\n"
"Map::iterator it5 = it4; ++it5;\n" "Map::iterator it5 = it4; ++it5;\n"
"Map::iterator it6 = it5; ++it6;\n" "Map::iterator it6 = it5; ++it6;\n"
"unused(&it6);\n") "unused(&it6);\n"
"std::multimap<unsigned int, float> map4;\n"
"map4.insert(std::pair<unsigned int, float>(11, 11.0));\n"
"map4.insert(std::pair<unsigned int, float>(22, 22.0));\n"
"map4.insert(std::pair<unsigned int, float>(22, 23.0));\n"
"map4.insert(std::pair<unsigned int, float>(22, 24.0));\n"
"map4.insert(std::pair<unsigned int, float>(22, 25.0));\n")
+ Check("map1", "<2 items>", "std::map<unsigned int, unsigned int>") + Check("map1", "<2 items>", "std::map<unsigned int, unsigned int>")
+ Check("map1.11", "[11]", "1", "unsigned int") + Check("map1.0", "[0] 11", "1", "unsigned int")
+ Check("map1.22", "[22]", "2", "unsigned int") + Check("map1.1", "[1] 22", "2", "unsigned int")
+ Check("map2", "<2 items>", "std::map<unsigned int, float>") + Check("map2", "<2 items>", "std::map<unsigned int, float>")
+ Check("map2.11", "[11]", "11", "float") + Check("map2.0", "[0] 11", "11", "float")
+ Check("map2.22", "[22]", "22", "float") + Check("map2.1", "[1] 22", "22", "float")
+ Check("map3", "<6 items>", "Map") + Check("map3", "<6 items>", "Map")
+ Check("map3.11", "[11]", "11", "float") + Check("map3.0", "[0] 11", "11", "float")
+ Check("it1.first", "11", "int") + Check("it1.first", "11", "int")
+ Check("it1.second", "11", "float") + Check("it1.second", "11", "float")
+ Check("it6.first", "66", "int") + Check("it6.first", "66", "int")
+ Check("it6.second", "66", "float"); + Check("it6.second", "66", "float")
+ Check("map4", "<5 items>", "std::multimap<unsigned int, float>")
+ Check("map4.0", "[0] 11", "11", "float")
+ Check("map4.4", "[4] 22", "25", "float");
QTest::newRow("StdMapQt") QTest::newRow("StdMapQt")
@@ -3911,7 +3922,15 @@ void tst_Dumpers::dumper_data()
"Set::iterator it1 = s2.begin();\n" "Set::iterator it1 = s2.begin();\n"
"Set::iterator it2 = it1; ++it2;\n" "Set::iterator it2 = it1; ++it2;\n"
"Set::iterator it3 = it2; ++it3;\n" "Set::iterator it3 = it2; ++it3;\n"
"unused(&it3);\n") "unused(&it3);\n\n"
"std::multiset<int> s3;\n"
"s3.insert(1);\n"
"s3.insert(1);\n"
"s3.insert(2);\n"
"s3.insert(3);\n"
"s3.insert(3);\n"
"s3.insert(3);\n")
+ Check("s0", "<0 items>", "std::set<double>") + Check("s0", "<0 items>", "std::set<double>")
@@ -3919,7 +3938,11 @@ void tst_Dumpers::dumper_data()
+ Check("s2", "<3 items>", "Set") + Check("s2", "<3 items>", "Set")
+ Check("it1.value", "11", "int") + Check("it1.value", "11", "int")
+ Check("it3.value", "33", "int"); + Check("it3.value", "33", "int")
+ Check("s3", "<6 items>", "std::multiset<int>")
+ Check("s3.0", "[0]", "1", "int")
+ Check("s3.5", "[5]", "3", "int");
QTest::newRow("StdSetQt") QTest::newRow("StdSetQt")

View File

@@ -3262,6 +3262,32 @@ namespace stdmap {
dummyStatement(&map); dummyStatement(&map);
} }
void testStdMultiMapUIntFloat()
{
typedef std::pair<uint, float> V;
std::multimap<uint, float> map;
map.insert(V(11, 11.0));
map.insert(V(22, 22.0));
map.insert(V(22, 33.0));
map.insert(V(22, 34.0));
map.insert(V(22, 35.0));
map.insert(V(22, 36.0));
BREAK_HERE;
// Expand map.
// Check map <6 items> std:multimap<unsigned int, float>.
// Check map.0 11 float.
// Check map.5 22 float.
// Continue.
dummyStatement(&map);
}
void testStdMultiSetInt()
{
std::multiset<int> set = {1, 1, 2, 3, 3, 3};
BREAK_HERE;
dummyStatement(&set);
}
void testStdMap() void testStdMap()
{ {
testStdMapStringFoo(); testStdMapStringFoo();
@@ -3274,6 +3300,8 @@ namespace stdmap {
testStdMapStringFloat(); testStdMapStringFloat();
testStdMapIntString(); testStdMapIntString();
testStdMapStringPointer(); testStdMapStringPointer();
testStdMultiMapUIntFloat();
testStdMultiSetInt();
} }
} // namespace stdmap } // namespace stdmap

View File

@@ -62,6 +62,7 @@
:DebugModeWidget.Locals and Expressions_QDockWidget {container=':Qt Creator.DebugModeWidget_QSplitter' name='Debugger.Docks.LocalsAndWatchers' type='QDockWidget' visible='1' windowTitle='Locals and Expressions'} :DebugModeWidget.Locals and Expressions_QDockWidget {container=':Qt Creator.DebugModeWidget_QSplitter' name='Debugger.Docks.LocalsAndWatchers' type='QDockWidget' visible='1' windowTitle='Locals and Expressions'}
:DebugModeWidget.OK_QPushButton {container=':Qt Creator.DebugModeWidget_QSplitter' text='OK' type='QPushButton' unnamed='1' visible='1'} :DebugModeWidget.OK_QPushButton {container=':Qt Creator.DebugModeWidget_QSplitter' text='OK' type='QPushButton' unnamed='1' visible='1'}
:DebugModeWidget_QComboBox {container=':Qt Creator.DebugModeWidget_QSplitter' occurrence='2' type='QComboBox' unnamed='1' visible='1'} :DebugModeWidget_QComboBox {container=':Qt Creator.DebugModeWidget_QSplitter' occurrence='2' type='QComboBox' unnamed='1' visible='1'}
:DebugModeWidget_QmlJSTools::Internal::QmlConsoleView {container=':Qt Creator.DebugModeWidget_QSplitter' type='QmlJSTools::Internal::QmlConsoleView' unnamed='1' visible='1'}
:Debugger Toolbar.Continue_QToolButton {container=':DebugModeWidget.Debugger Toolbar_QDockWidget' text='Continue' type='QToolButton' unnamed='1' visible='1'} :Debugger Toolbar.Continue_QToolButton {container=':DebugModeWidget.Debugger Toolbar_QDockWidget' text='Continue' type='QToolButton' unnamed='1' visible='1'}
:Debugger Toolbar.Exit Debugger_QToolButton {container=':DebugModeWidget.Debugger Toolbar_QDockWidget' text='Stop Debugger' type='QToolButton' unnamed='1' visible='1'} :Debugger Toolbar.Exit Debugger_QToolButton {container=':DebugModeWidget.Debugger Toolbar_QDockWidget' text='Stop Debugger' type='QToolButton' unnamed='1' visible='1'}
:Debugger Toolbar.StatusText_Utils::StatusLabel {container=':DebugModeWidget.Debugger Toolbar_QDockWidget' type='Utils::StatusLabel' unnamed='1'} :Debugger Toolbar.StatusText_Utils::StatusLabel {container=':DebugModeWidget.Debugger Toolbar_QDockWidget' type='Utils::StatusLabel' unnamed='1'}
@@ -125,6 +126,7 @@
:QML Debugging.No_QPushButton {text='No' type='QPushButton' unnamed='1' visible='1' window=':QML Debugging_QMessageBox'} :QML Debugging.No_QPushButton {text='No' type='QPushButton' unnamed='1' visible='1' window=':QML Debugging_QMessageBox'}
:QML Debugging_QMessageBox {text='The option will only take effect if the project is recompiled. Do you want to recompile now?' type='QMessageBox' unnamed='1' visible='1'} :QML Debugging_QMessageBox {text='The option will only take effect if the project is recompiled. Do you want to recompile now?' type='QMessageBox' unnamed='1' visible='1'}
:QWebPage {type='QWebPage' unnamed='1'} :QWebPage {type='QWebPage' unnamed='1'}
:QmlJSTools::Internal::QmlConsoleEdit {columnIndex='0' container=':DebugModeWidget_QmlJSTools::Internal::QmlConsoleView' rowIndex='0' type='QmlJSTools::Internal::QmlConsoleEdit' unnamed='1' visible='1'}
:Qt Creator.Add Bookmark_QToolButton {text='Add Bookmark' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.Add Bookmark_QToolButton {text='Add Bookmark' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.Analyzer Toolbar_QDockWidget {name='Analyzer Toolbar' type='QDockWidget' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Analyzer Toolbar'} :Qt Creator.Analyzer Toolbar_QDockWidget {name='Analyzer Toolbar' type='QDockWidget' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Analyzer Toolbar'}
:Qt Creator.CloseFind_QToolButton {name='close' type='QToolButton' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.CloseFind_QToolButton {name='close' type='QToolButton' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
@@ -139,6 +141,8 @@
:Qt Creator.Replace All_QToolButton {name='replaceAllButton' text='Replace All' type='QToolButton' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.Replace All_QToolButton {name='replaceAllButton' text='Replace All' type='QToolButton' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.Replace_QToolButton {name='replaceButton' text='Replace' type='QToolButton' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.Replace_QToolButton {name='replaceButton' text='Replace' type='QToolButton' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.Stop_QToolButton {text='Stop' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.Stop_QToolButton {text='Stop' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.WelcomePageStyledBar_QWindowContainer {aboveWidget=':Qt Creator.WelcomePageStyledBar_Utils::StyledBar' type='QWindowContainer' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.WelcomePageStyledBar_Utils::StyledBar {name='WelcomePageStyledBar' type='Utils::StyledBar' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.replaceEdit_Utils::FilterLineEdit {name='replaceEdit' type='Utils::FancyLineEdit' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.replaceEdit_Utils::FilterLineEdit {name='replaceEdit' type='Utils::FancyLineEdit' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.scrollArea_QScrollArea {name='scrollArea' type='QScrollArea' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.scrollArea_QScrollArea {name='scrollArea' type='QScrollArea' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.splitter_QSplitter {name='splitter' type='QSplitter' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.splitter_QSplitter {name='splitter' type='QSplitter' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
@@ -202,6 +206,8 @@
:Session Manager_ProjectExplorer::Internal::SessionDialog {name='ProjectExplorer__Internal__SessionDialog' type='ProjectExplorer::Internal::SessionDialog' visible='1' windowTitle='Session Manager'} :Session Manager_ProjectExplorer::Internal::SessionDialog {name='ProjectExplorer__Internal__SessionDialog' type='ProjectExplorer::Internal::SessionDialog' visible='1' windowTitle='Session Manager'}
:Startup.contextHelpComboBox_QComboBox {container=':Form.Startup_QGroupBox' name='contextHelpComboBox' type='QComboBox' visible='1'} :Startup.contextHelpComboBox_QComboBox {container=':Form.Startup_QGroupBox' name='contextHelpComboBox' type='QComboBox' visible='1'}
:User Interface.languageBox_QComboBox {container=':Core__Internal__GeneralSettings.User Interface_QGroupBox' name='languageBox' type='QComboBox' visible='1'} :User Interface.languageBox_QComboBox {container=':Core__Internal__GeneralSettings.User Interface_QGroupBox' name='languageBox' type='QComboBox' visible='1'}
:WelcomePage.scrollView_ScrollView {container=':WelcomePageStyledBar.WelcomePage_QQuickView' id='scrollView' type='ScrollView' unnamed='1' visible='true'}
:WelcomePageStyledBar.WelcomePage_QQuickView {container=':Qt Creator.WelcomePageStyledBar_QWindowContainer' name='WelcomePage' type='QQuickView' visible='true'}
:Widget Box_qdesigner_internal::WidgetBoxTreeWidget {container=':*Qt Creator.Widget Box_QDockWidget' type='qdesigner_internal::WidgetBoxTreeWidget' unnamed='1' visible='1'} :Widget Box_qdesigner_internal::WidgetBoxTreeWidget {container=':*Qt Creator.Widget Box_QDockWidget' type='qdesigner_internal::WidgetBoxTreeWidget' unnamed='1' visible='1'}
:Working Copy.checkoutDirectoryLineEdit_QLineEdit {container=':Git Repository Clone.Working Copy_QGroupBox' name='checkoutDirectoryLineEdit' type='QLineEdit' visible='1'} :Working Copy.checkoutDirectoryLineEdit_QLineEdit {container=':Git Repository Clone.Working Copy_QGroupBox' name='checkoutDirectoryLineEdit' type='QLineEdit' visible='1'}
:Working Copy_Utils::BaseValidatingLineEdit {container=':Git Repository Clone.Working Copy_QGroupBox' type='Utils::FancyLineEdit' unnamed='1' visible='1'} :Working Copy_Utils::BaseValidatingLineEdit {container=':Git Repository Clone.Working Copy_QGroupBox' type='Utils::FancyLineEdit' unnamed='1' visible='1'}

View File

@@ -7,6 +7,6 @@ HOOK_SUB_PROCESSES=false
IMPLICITAUTSTART=0 IMPLICITAUTSTART=0
LANGUAGE=Python LANGUAGE=Python
OBJECTMAP=../objects.map OBJECTMAP=../objects.map
TEST_CASES=tst_build_new_project tst_cli_output_console tst_debug_empty_main tst_qml_locals tst_simple_analyze tst_simple_debug TEST_CASES=tst_build_new_project tst_cli_output_console tst_debug_empty_main tst_qml_js_console tst_qml_locals tst_simple_analyze tst_simple_debug
VERSION=2 VERSION=2
WRAPPERS=Qt WRAPPERS=Qt

View File

@@ -0,0 +1,184 @@
#############################################################################
##
## Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
## Contact: http://www.qt-project.org/legal
##
## This file is part of Qt Creator.
##
## Commercial License Usage
## Licensees holding valid commercial Qt licenses may use this file in
## accordance with the commercial license agreement provided with the
## Software or, alternatively, in accordance with the terms contained in
## a written agreement between you and Digia. For licensing terms and
## conditions see http://qt.digia.com/licensing. For further information
## use the contact form at http://qt.digia.com/contact-us.
##
## GNU Lesser General Public License Usage
## Alternatively, this file may be used under the terms of the GNU Lesser
## General Public License version 2.1 as published by the Free Software
## Foundation and appearing in the file LICENSE.LGPL included in the
## packaging of this file. Please review the following information to
## ensure the GNU Lesser General Public License version 2.1 requirements
## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
##
## In addition, as a special exception, Digia gives you certain additional
## rights. These rights are described in the Digia Qt LGPL Exception
## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
##
#############################################################################
source("../../shared/qtcreator.py")
def typeToQmlConsole(expression):
editableIndex = getQModelIndexStr("text=''",
":DebugModeWidget_QmlJSTools::Internal::QmlConsoleView")
mouseClick(editableIndex, 5, 5, 0, Qt.LeftButton)
type(waitForObject(":QmlJSTools::Internal::QmlConsoleEdit"), expression)
type(waitForObject(":QmlJSTools::Internal::QmlConsoleEdit"), "<Return>")
def useQmlJSConsole(expression, expectedOutput, check=None, checkOutp=None):
typeToQmlConsole(expression)
if expectedOutput == None:
result = getQmlJSConsoleOutput()[-1]
clickButton(":*Qt Creator.Clear_QToolButton")
return result
expected = getQModelIndexStr("text='%s'" % expectedOutput,
":DebugModeWidget_QmlJSTools::Internal::QmlConsoleView")
try:
obj = waitForObject(expected, 3000)
test.compare(obj.text, expectedOutput, "Verifying whether expected output appeared.")
except:
test.fail("Expected output (%s) missing - got '%s'."
% (expectedOutput, getQmlJSConsoleOutput()[-1]))
clickButton(":*Qt Creator.Clear_QToolButton")
if check:
if checkOutp == None:
checkOutp = expectedOutput
useQmlJSConsole(check, checkOutp)
def debuggerHasStopped():
stopDebugger = findObject(":Debugger Toolbar.Exit Debugger_QToolButton")
fancyDebugButton = findObject(":*Qt Creator.Start Debugging_Core::Internal::FancyToolButton")
result = test.verify(not stopDebugger.enabled and fancyDebugButton.enabled,
"Verifying whether debugger buttons are in correct state.")
ensureChecked(":Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton")
output = waitForObject("{type='Core::OutputWindow' visible='1' "
"windowTitle='Application Output Window'}")
result &= test.verify(waitFor("'Debugging has finished' in str(output.plainText)", 2000),
"Verifying whether Application output contains 'Debugging has finished'.")
return result
def getQmlJSConsoleOutput():
try:
result = []
consoleView = waitForObject(":DebugModeWidget_QmlJSTools::Internal::QmlConsoleView")
model = consoleView.model()
return dumpItems(model)[:-1]
except:
return [""]
def runChecks(elementProps, parent, checks):
mouseClick(getQModelIndexStr(elementProps, parent), 5, 5, 0, Qt.LeftButton)
for check in checks:
useQmlJSConsole(*check)
def testLoggingFeatures():
expressions = ("console.log('info message'); console.info('info message2'); console.debug()",
'console.warn("warning message")',
"console.error('error message')")
expected = (["info message", "info message2", "", "<undefined>"],
["warning message", "<undefined>"],
["error message", "<undefined>"])
filterToolTips = ("Show debug, log, and info messages.",
"Show debug, log, and info messages.' occurrence='2", #"Show warning messages.",
"Show debug, log, and info messages.' occurrence='3", #"Show error messages."
)
for expression, expect, tooltip in zip(expressions, expected, filterToolTips):
typeToQmlConsole(expression)
output = getQmlJSConsoleOutput()[1:]
test.compare(output, expect, "Verifying expected output.")
filterButton = waitForObject("{container=':Qt Creator.DebugModeWidget_QSplitter' "
"toolTip='%s' type='QToolButton' unnamed='1' visible='1'}"
% tooltip)
ensureChecked(filterButton, False)
output = getQmlJSConsoleOutput()[1:]
test.compare(output, ["<undefined>"], "Verifying expected filtered output.")
ensureChecked(filterButton, True)
output = getQmlJSConsoleOutput()[1:]
test.compare(output, expect, "Verifying unfiltered output is displayed again.")
clickButton(":*Qt Creator.Clear_QToolButton")
def main():
projName = "simpleQuickUI2.qmlproject"
projFolder = os.path.dirname(findFile("testdata", "simpleQuickUI2/%s" % projName))
if not neededFilePresent(os.path.join(projFolder, projName)):
return
qmlProjDir = prepareTemplate(projFolder)
if qmlProjDir == None:
test.fatal("Could not prepare test files - leaving test")
return
qmlProjFile = os.path.join(qmlProjDir, projName)
# start Creator by passing a .qmlproject file
startApplication('qtcreator' + SettingsPath + ' "%s"' % qmlProjFile)
if not startedWithoutPluginError():
return
# if Debug is enabled - 1 valid kit is assigned - real check for this is done in tst_qml_locals
fancyDebugButton = findObject(":*Qt Creator.Start Debugging_Core::Internal::FancyToolButton")
if test.verify(waitFor('fancyDebugButton.enabled', 5000), "Start Debugging is enabled."):
# make sure QML Debugging is enabled
switchViewTo(ViewConstants.PROJECTS)
switchToBuildOrRunSettingsFor(1, 0, ProjectSettings.RUN, True)
ensureChecked("{container=':Qt Creator.scrollArea_QScrollArea' text='Enable QML' "
"type='QCheckBox' unnamed='1' visible='1'}")
switchViewTo(ViewConstants.EDIT)
# start debugging
clickButton(fancyDebugButton)
locAndExprTV = waitForObject(":Locals and Expressions_Debugger::Internal::WatchTreeView")
rootIndex = getQModelIndexStr("text='Rectangle'",
":Locals and Expressions_Debugger::Internal::WatchTreeView")
# make sure the items inside the root item are visible
doubleClick(waitForObject(rootIndex))
if not object.exists(":DebugModeWidget_QmlJSTools::Internal::QmlConsoleView"):
invokeMenuItem("Window", "Output Panes", "QML/JS Console")
progressBarWait()
# color and float values have additional ZERO WIDTH SPACE (\u200b), different usage of
# whitespaces inside expressions is part of the test
checks = [("color", u"#\u200b008000"), ("width", "50"),
("color ='silver'", "silver", "color", u"#\u200bc0c0c0"),
("width=66", "66", "width"), ("anchors.centerIn", "<unnamed object>"),
("opacity", "1"), ("opacity = .2", u"0.\u200b2", "opacity")]
# check green inner Rectangle
runChecks("text='Rectangle'", rootIndex, checks)
checks = [("color", u"#\u200bff0000"), ("width", "100"), ("height", "100"),
("radius = Math.min(width, height) / 2", "50", "radius"),
("parent.objectName= 'mainRect'", "mainRect")]
# check red inner Rectangle
runChecks("text='Rectangle' occurrence='2'", rootIndex, checks)
checks = [("color", u"#\u200b000000"), ("font.pointSize=14", "14", "font.pointSize"),
("font.bold", "false"), ("font.weight=Font.Bold", "75", "font.bold", "true"),
("rotation", "0"), ("rotation = 180", "180", "rotation")]
# check Text element
runChecks("text='Text'", rootIndex, checks)
# extended check must be done separately
originalVal = useQmlJSConsole("x", None)
if originalVal:
# Text element uses anchors.centerIn, so modification of x should not do anything
useQmlJSConsole("x=0", "0", "x", originalVal)
useQmlJSConsole("anchors.centerIn", "mainRect")
# ignore output as it has none
useQmlJSConsole("anchors.centerIn = null", None)
useQmlJSConsole("x = 0", "0", "x")
testLoggingFeatures()
test.log("Calling Qt.quit() from inside Qml/JS Console - inferior should quit.")
useQmlJSConsole("Qt.quit()", "<undefined>")
if not debuggerHasStopped():
__stopDebugger__()
invokeMenuItem("File", "Exit")

View File

@@ -215,8 +215,8 @@ def __getExpectedDebuggers__():
result = [] result = []
if platform.system() in ('Microsoft', 'Windows'): if platform.system() in ('Microsoft', 'Windows'):
result.extend(__getCDB__()) result.extend(__getCDB__())
debuggers = ["gdb", "lldb"] for debugger in ["gdb", "lldb"]:
result.extend(filter(None, map(which, debuggers))) result.extend(findAllFilesInPATH(debugger))
if platform.system() == 'Linux': if platform.system() == 'Linux':
result.extend(findAllFilesInPATH("lldb-*")) result.extend(findAllFilesInPATH("lldb-*"))
if platform.system() == 'Darwin': if platform.system() == 'Darwin':

View File

@@ -29,6 +29,10 @@
source("../../shared/qtcreator.py") source("../../shared/qtcreator.py")
def canTestQtQuick():
return (squishinfo.major * 0x10000 + squishinfo.minor * 0x100
+ squishinfo.patch) > 0x050100
def main(): def main():
projects = prepareTestExamples() projects = prepareTestExamples()
if not projects: if not projects:
@@ -41,6 +45,8 @@ def main():
mainWindow = waitForObject(":Qt Creator_Core::Internal::MainWindow") mainWindow = waitForObject(":Qt Creator_Core::Internal::MainWindow")
test.verify(waitFor("sessionName in str(mainWindow.windowTitle)", 2000), test.verify(waitFor("sessionName in str(mainWindow.windowTitle)", 2000),
"Verifying window title contains created session name.") "Verifying window title contains created session name.")
if not isQt4Build and canTestQtQuick():
checkWelcomePage(sessionName, True)
for project in projects: for project in projects:
openQmakeProject(project, Targets.DESKTOP_480_GCC) openQmakeProject(project, Targets.DESKTOP_480_GCC)
progressBarWait(20000) progressBarWait(20000)
@@ -52,6 +58,9 @@ def main():
switchSession("default") switchSession("default")
test.verify(waitFor("'Qt Creator' == str(mainWindow.windowTitle)", 2000), test.verify(waitFor("'Qt Creator' == str(mainWindow.windowTitle)", 2000),
"Verifying window title is set to default.") "Verifying window title is set to default.")
if not isQt4Build and canTestQtQuick():
checkWelcomePage(sessionName, False)
switchViewTo(ViewConstants.EDIT)
checkNavigator(1, "Verifying that no more project is opened.") checkNavigator(1, "Verifying that no more project is opened.")
checkOpenDocuments(0, "Verifying whether all files have been closed.") checkOpenDocuments(0, "Verifying whether all files have been closed.")
switchSession(sessionName) switchSession(sessionName)
@@ -93,7 +102,7 @@ def switchSession(toSession):
def createAndSwitchToSession(toSession): def createAndSwitchToSession(toSession):
sessionInputDialog = ("{type='ProjectExplorer::Internal::SessionNameInputDialog' unnamed='1' " sessionInputDialog = ("{type='ProjectExplorer::Internal::SessionNameInputDialog' unnamed='1' "
"visible='1' windowTitle='New session name'}") "visible='1' windowTitle='New Session Name'}")
test.log("Switching to session '%s' after creating it." % toSession) test.log("Switching to session '%s' after creating it." % toSession)
invokeMenuItem("File", "Session Manager...") invokeMenuItem("File", "Session Manager...")
clickButton(waitForObject("{name='btCreateNew' text='New' type='QPushButton' visible='1' " clickButton(waitForObject("{name='btCreateNew' text='New' type='QPushButton' visible='1' "
@@ -101,22 +110,21 @@ def createAndSwitchToSession(toSession):
lineEdit = waitForObject("{type='QLineEdit' unnamed='1' visible='1' window=%s}" lineEdit = waitForObject("{type='QLineEdit' unnamed='1' visible='1' window=%s}"
% sessionInputDialog) % sessionInputDialog)
replaceEditorContent(lineEdit, toSession) replaceEditorContent(lineEdit, toSession)
clickButton(waitForObject("{text='Switch to' type='QPushButton' unnamed='1' visible='1' " clickButton(waitForObject("{text='Switch To' type='QPushButton' unnamed='1' visible='1' "
"window=%s}" % sessionInputDialog)) "window=%s}" % sessionInputDialog))
def checkWelcomePage(sessionName, isCurrent=False): def checkWelcomePage(sessionName, isCurrent=False):
switchViewTo(ViewConstants.WELCOME) switchViewTo(ViewConstants.WELCOME)
mouseClick(waitForObject("{clip='false' container=':Qt Creator_QDeclarativeView' enabled='true'" mouseClick(waitForObject("{container=':WelcomePage.scrollView_ScrollView' text='Projects' "
" text='Develop' type='LinkedText' unnamed='1' visible='true'}"), "type='Button' unnamed='1' visible='true'}"), 5, 5, Qt.LeftButton)
5, 5, 0, Qt.LeftButton) waitForObject("{container=':WelcomePage.scrollView_ScrollView' id='sessionsTitle' "
waitForObject("{clip='false' container=':Qt Creator_QDeclarativeView' enabled='true' "
"text='Sessions' type='Text' unnamed='1' visible='true'}") "text='Sessions' type='Text' unnamed='1' visible='true'}")
if isCurrent: if isCurrent:
sessions = ["default", "%s (current session)" % sessionName] sessions = ["default", "%s (current session)" % sessionName]
else: else:
sessions = ["default (current session)", sessionName] sessions = ["default (current session)", sessionName]
for sessionName in sessions: for sessionName in sessions:
test.verify(object.exists("{clip='false' container=':Qt Creator_QDeclarativeView' " test.verify(object.exists("{container=':WelcomePage.scrollView_ScrollView' "
"enabled='true' type='LinkedText' " "enabled='true' type='LinkedText' "
"unnamed='1' visible='true' text='%s'}" % sessionName), "unnamed='1' visible='true' text='%s'}" % sessionName),
"Verifying session '%s' exists." % sessionName) "Verifying session '%s' exists." % sessionName)

View File

@@ -99,7 +99,7 @@ def main():
replaceEditorContent(waitForObject(":Working Copy_Utils::BaseValidatingLineEdit"), replaceEditorContent(waitForObject(":Working Copy_Utils::BaseValidatingLineEdit"),
targetDir) targetDir)
cloneDirEdit = waitForObject(":Working Copy.checkoutDirectoryLineEdit_QLineEdit") cloneDirEdit = waitForObject(":Working Copy.checkoutDirectoryLineEdit_QLineEdit")
test.compare(cloneDirEdit.text, "p-qt-labs-jom") test.compare(cloneDirEdit.text, "jom")
replaceEditorContent(cloneDirEdit, cloneDir) replaceEditorContent(cloneDirEdit, cloneDir)
clickButton(waitForObject(":Next_QPushButton")) clickButton(waitForObject(":Next_QPushButton"))
cloneLog = waitForObject(":Git Repository Clone.logPlainTextEdit_QPlainTextEdit", 1000) cloneLog = waitForObject(":Git Repository Clone.logPlainTextEdit_QPlainTextEdit", 1000)