forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/3.2' into HEAD
Change-Id: I257bb9310bb3bde493aff4cd43091ec63fcb5203
This commit is contained in:
@@ -60,6 +60,15 @@
|
||||
|
||||
\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:
|
||||
|
||||
\table
|
||||
|
@@ -124,11 +124,7 @@
|
||||
For example, running \tt{qtcreator somesession}, launches \QC and
|
||||
loads session somesession.
|
||||
|
||||
\note Make sure \QC is included in the PATH environment variable.
|
||||
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
|
||||
For more information, see \l{Using Command Line Options}.
|
||||
|
||||
\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
|
||||
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 \l{Moving to Symbol Definition or Declaration}.
|
||||
cursor on the symbol and press \key {F2}. For more information, see
|
||||
\l{Moving to Symbol Definition or Declaration}.
|
||||
|
||||
\section1 Displaying Signals and Slots
|
||||
|
||||
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
|
||||
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
|
||||
the slot in the \e slots subitem. The objects connected to this slot are
|
||||
@@ -179,7 +176,7 @@
|
||||
\list 1
|
||||
|
||||
\li Select \gui Tools > \gui Options > \gui Debugger >
|
||||
\gui{Debugging Helper}.
|
||||
\gui{Locals and Expressions}.
|
||||
|
||||
\li Uncheck the \gui{Use Debugging Helper} checkbox.
|
||||
|
||||
@@ -234,7 +231,7 @@
|
||||
\li \c %MONTH%: Month
|
||||
\li \c %DAY%: Day of the month
|
||||
\li \c %DATE%: Date
|
||||
\li \c %USER%: User name
|
||||
\li \c %USER%: Username
|
||||
\li \c %FILENAME%: File name
|
||||
\li \c %CLASS%: Class name (if applicable)
|
||||
\li \c %$VARIABLE%: Contents of environment variable \c{VARIABLE}.
|
||||
|
@@ -78,8 +78,8 @@
|
||||
enter the host name or IP address of the device.
|
||||
This value will be available in the variable \c %{CurrentDevice:HostAddress}.
|
||||
|
||||
\li In the \gui {The user name to log into the device} field,
|
||||
enter the user name to log into the device and run the
|
||||
\li In the \gui {The username to log into the device} field,
|
||||
enter the username to log into the device and run the
|
||||
application as.
|
||||
This value will be available in the variable \c %{CurrentDevice:UserName}.
|
||||
|
||||
|
@@ -145,9 +145,9 @@
|
||||
|
||||
\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
|
||||
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.
|
||||
|
||||
\endlist
|
||||
|
@@ -41,11 +41,8 @@
|
||||
|
||||
\row
|
||||
\li Learn more about Qt
|
||||
\li \l{http://qt.digia.com/product/learning/}{Learning}
|
||||
from Digia
|
||||
|
||||
\l{http://qt-project.org/wiki/developer-guides}
|
||||
{Qt Developer Guides} from Qt Project
|
||||
\li \l{http://qt-project.org/wiki/developer-guides}
|
||||
{Qt Developer Guides}
|
||||
|
||||
\row
|
||||
\li Develop Qt applications for desktop and mobile devices
|
||||
|
@@ -192,7 +192,7 @@ def qdump__std__map(d, value):
|
||||
for i in d.childRange():
|
||||
with SubItem(d, i):
|
||||
pair = (node + 1).cast(pairPointer).dereference()
|
||||
d.putPair(pair)
|
||||
d.putPair(pair, i)
|
||||
if d.isNull(node["_M_right"]):
|
||||
parent = node["_M_parent"]
|
||||
while node == parent["_M_right"]:
|
||||
@@ -267,9 +267,18 @@ def qdump__std____debug__map(d, value):
|
||||
def qdump__std____debug__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):
|
||||
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):
|
||||
node = value["_M_node"].dereference()
|
||||
d.putNumChild(1)
|
||||
|
@@ -112,7 +112,9 @@ QDataStream &operator<<(QDataStream &out, const ValuesChangedCommand &command)
|
||||
QSharedMemory *sharedMemory = createSharedMemory(keyCounter, outDataStreamByteArray.size());
|
||||
|
||||
if (sharedMemory) {
|
||||
sharedMemory->lock();
|
||||
std::memcpy(sharedMemory->data(), outDataStreamByteArray.constData(), sharedMemory->size());
|
||||
sharedMemory->unlock();
|
||||
out << command.keyNumber();
|
||||
return out;
|
||||
}
|
||||
|
@@ -392,8 +392,15 @@ QImage QuickItemNodeInstance::renderPreviewImage(const QSize &previewImageSize)
|
||||
{
|
||||
QRectF previewItemBoundingRect = boundingRect();
|
||||
|
||||
if (previewItemBoundingRect.isValid() && quickItem())
|
||||
if (previewItemBoundingRect.isValid() && quickItem()) {
|
||||
if (quickItem()->isVisible()) {
|
||||
return designerSupport()->renderImageForItem(quickItem(), previewItemBoundingRect, previewImageSize);
|
||||
} else {
|
||||
QImage transparentImage(previewImageSize, QImage::Format_ARGB32_Premultiplied);
|
||||
transparentImage.fill(Qt::transparent);
|
||||
return transparentImage;
|
||||
}
|
||||
}
|
||||
|
||||
return QImage();
|
||||
}
|
||||
|
15
src/libs/3rdparty/cplusplus/Parser.cpp
vendored
15
src/libs/3rdparty/cplusplus/Parser.cpp
vendored
@@ -3050,7 +3050,7 @@ bool Parser::parseExpressionStatement(StatementAST *&node)
|
||||
return parsed;
|
||||
}
|
||||
|
||||
bool Parser::parseStatement(StatementAST *&node)
|
||||
bool Parser::parseStatement(StatementAST *&node, bool blockLabeledStatement)
|
||||
{
|
||||
DEBUG_THIS_RULE();
|
||||
switch (LA()) {
|
||||
@@ -3077,6 +3077,8 @@ bool Parser::parseStatement(StatementAST *&node)
|
||||
|
||||
case T_CASE:
|
||||
case T_DEFAULT:
|
||||
if (blockLabeledStatement)
|
||||
return false;
|
||||
return parseLabeledStatement(node);
|
||||
|
||||
case T_BREAK:
|
||||
@@ -3145,8 +3147,11 @@ bool Parser::parseStatement(StatementAST *&node)
|
||||
}
|
||||
|
||||
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 parseExpressionOrDeclarationStatement(node);
|
||||
} // switch
|
||||
@@ -3617,7 +3622,7 @@ bool Parser::parseLabeledStatement(StatementAST *&node)
|
||||
LabeledStatementAST *ast = new (_pool) LabeledStatementAST;
|
||||
ast->label_token = consumeToken();
|
||||
ast->colon_token = consumeToken();
|
||||
parseStatement(ast->statement);
|
||||
parseStatement(ast->statement, /*blockLabeledStatement =*/ true);
|
||||
node = ast;
|
||||
return true;
|
||||
}
|
||||
@@ -3627,7 +3632,7 @@ bool Parser::parseLabeledStatement(StatementAST *&node)
|
||||
LabeledStatementAST *ast = new (_pool) LabeledStatementAST;
|
||||
ast->label_token = consumeToken();
|
||||
match(T_COLON, &ast->colon_token);
|
||||
parseStatement(ast->statement);
|
||||
parseStatement(ast->statement, /*blockLabeledStatement =*/ true);
|
||||
node = ast;
|
||||
return true;
|
||||
}
|
||||
@@ -3637,7 +3642,7 @@ bool Parser::parseLabeledStatement(StatementAST *&node)
|
||||
ast->case_token = consumeToken();
|
||||
parseConstantExpression(ast->expression);
|
||||
match(T_COLON, &ast->colon_token);
|
||||
parseStatement(ast->statement);
|
||||
parseStatement(ast->statement, /*blockLabeledStatement =*/ true);
|
||||
node = ast;
|
||||
return true;
|
||||
}
|
||||
|
2
src/libs/3rdparty/cplusplus/Parser.h
vendored
2
src/libs/3rdparty/cplusplus/Parser.h
vendored
@@ -142,7 +142,7 @@ public:
|
||||
bool parsePtrOperator(PtrOperatorListAST *&node);
|
||||
bool parseRelationalExpression(ExpressionAST *&node);
|
||||
bool parseShiftExpression(ExpressionAST *&node);
|
||||
bool parseStatement(StatementAST *&node);
|
||||
bool parseStatement(StatementAST *&node, bool blockLabeledStatement = false);
|
||||
bool parseThisExpression(ExpressionAST *&node);
|
||||
bool parseBoolLiteral(ExpressionAST *&node);
|
||||
bool parseNumericLiteral(ExpressionAST *&node);
|
||||
|
@@ -604,7 +604,7 @@ ModelManagerInterface::ProjectInfo ModelManagerInterface::projectInfoForPath(QSt
|
||||
if (res.qtQmlPath.isEmpty())
|
||||
res.qtQmlPath = pInfo.qtQmlPath;
|
||||
foreach (const QString &path, pInfo.importPaths)
|
||||
if (res.importPaths.contains(path))
|
||||
if (!res.importPaths.contains(path))
|
||||
res.importPaths.append(path);
|
||||
}
|
||||
return res;
|
||||
@@ -1105,28 +1105,24 @@ void ModelManagerInterface::updateImportPaths()
|
||||
while (pInfoIter.hasNext()) {
|
||||
pInfoIter.next();
|
||||
QString pathAtt = pInfoIter.value().qtQmlPath;
|
||||
if (!pathAtt.isEmpty() && allImportPaths.size() > 0
|
||||
&& allImportPaths.value(allImportPaths.size()) != pathAtt)
|
||||
if (!pathAtt.isEmpty() && (allImportPaths.isEmpty() || allImportPaths.last() != pathAtt))
|
||||
allImportPaths.append(pathAtt);
|
||||
}
|
||||
{
|
||||
QString pathAtt = defaultProjectInfo().qtQmlPath;
|
||||
if (!pathAtt.isEmpty() && allImportPaths.size() > 0
|
||||
&& allImportPaths.value(allImportPaths.size()) != pathAtt)
|
||||
if (!pathAtt.isEmpty() && (allImportPaths.isEmpty() || allImportPaths.last() != pathAtt))
|
||||
allImportPaths.append(pathAtt);
|
||||
}
|
||||
pInfoIter.toFront();
|
||||
while (pInfoIter.hasNext()) {
|
||||
pInfoIter.next();
|
||||
QString pathAtt = pInfoIter.value().qtImportsPath;
|
||||
if (!pathAtt.isEmpty() && allImportPaths.size() > 0
|
||||
&& allImportPaths.value(allImportPaths.size()) != pathAtt)
|
||||
if (!pathAtt.isEmpty() && (allImportPaths.isEmpty() || allImportPaths.last() != pathAtt))
|
||||
allImportPaths.append(pathAtt);
|
||||
}
|
||||
{
|
||||
QString pathAtt = defaultProjectInfo().qtImportsPath;
|
||||
if (!pathAtt.isEmpty() && allImportPaths.size() > 0
|
||||
&& allImportPaths.value(allImportPaths.size()) != pathAtt)
|
||||
if (!pathAtt.isEmpty() && (allImportPaths.isEmpty() || allImportPaths.last() != pathAtt))
|
||||
allImportPaths.append(pathAtt);
|
||||
}
|
||||
allImportPaths += m_defaultImportPaths;
|
||||
|
@@ -1973,9 +1973,10 @@ void EditorManager::updateMakeWritableWarning()
|
||||
|
||||
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());
|
||||
revertToSavedAction->setEnabled(document != 0 && !document->filePath().isEmpty());
|
||||
revertToSavedAction->setEnabled(hasFile);
|
||||
|
||||
const QString documentName = document ? document->displayName() : QString();
|
||||
QString quotedName;
|
||||
|
@@ -318,12 +318,14 @@ void EditorToolBar::listContextMenu(QPoint pos)
|
||||
d->m_editorList->currentIndex());
|
||||
QString fileName = entry ? entry->fileName() : QString();
|
||||
QString shortFileName = entry ? QFileInfo(fileName).fileName() : QString();
|
||||
if (fileName.isEmpty() || shortFileName.isEmpty())
|
||||
return;
|
||||
QMenu menu;
|
||||
QAction *copyPath = menu.addAction(tr("Copy Full Path to Clipboard"));
|
||||
QAction *copyFileName = menu.addAction(tr("Copy File Name to Clipboard"));
|
||||
menu.addSeparator();
|
||||
if (fileName.isEmpty() || shortFileName.isEmpty()) {
|
||||
copyPath->setEnabled(false);
|
||||
copyFileName->setEnabled(false);
|
||||
}
|
||||
EditorManager::addSaveAndCloseEditorActions(&menu, entry);
|
||||
menu.addSeparator();
|
||||
EditorManager::addNativeDirAndOpenWithActions(&menu, entry);
|
||||
|
@@ -241,6 +241,11 @@ bool MainWindow::isNewItemDialogRunning() const
|
||||
|
||||
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_generalSettings);
|
||||
ExtensionSystem::PluginManager::removeObject(m_toolSettings);
|
||||
@@ -371,11 +376,6 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
||||
m_navigationWidget->closeSubWidgets();
|
||||
|
||||
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)
|
||||
|
@@ -218,6 +218,36 @@ public:
|
||||
PathChooser *overrideStartScriptFileName;
|
||||
|
||||
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)
|
||||
@@ -302,6 +332,18 @@ int AttachCoreDialog::exec()
|
||||
connect(d->buttonBox, SIGNAL(accepted()), SLOT(accept()));
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -335,24 +377,21 @@ void AttachCoreDialog::coreFileChanged(const QString &core)
|
||||
|
||||
void AttachCoreDialog::changed()
|
||||
{
|
||||
bool isValid = d->kitChooser->currentKit() && d->localExecFileName->isValid();
|
||||
bool isKitLocal = isLocalKit();
|
||||
AttachCoreDialogPrivate::State st = d->getDialogState(*this);
|
||||
|
||||
d->forceLocalLabel->setVisible(!isKitLocal);
|
||||
d->forceLocalCheckBox->setVisible(!isKitLocal);
|
||||
if (useLocalCoreFile()) {
|
||||
d->forceLocalLabel->setVisible(!st.localKit);
|
||||
d->forceLocalCheckBox->setVisible(!st.localKit);
|
||||
if (st.localCoreFile) {
|
||||
d->localCoreFileName->setVisible(true);
|
||||
d->remoteCoreFileName->setVisible(false);
|
||||
d->selectRemoteCoreButton->setVisible(false);
|
||||
isValid = isValid && d->localCoreFileName->isValid();
|
||||
} else {
|
||||
d->localCoreFileName->setVisible(false);
|
||||
d->remoteCoreFileName->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()
|
||||
|
@@ -252,12 +252,14 @@ void GenericProject::refresh(RefreshOptions options)
|
||||
|
||||
Kit *k = activeTarget() ? activeTarget()->kit() : KitManager::defaultKit();
|
||||
if (ToolChain *tc = ToolChainKitInformation::toolChain(k)) {
|
||||
QStringList cxxflags; // FIXME: Can we do better?
|
||||
part->evaluateToolchain(tc, cxxflags, cxxflags,
|
||||
QStringList cflags;
|
||||
QStringList cxxflags;
|
||||
cxxflags << QLatin1String("-std=c++11");
|
||||
|
||||
part->evaluateToolchain(tc, cxxflags, cflags,
|
||||
SysRootKitInformation::sysRoot(k));
|
||||
}
|
||||
|
||||
part->cxxVersion = CppTools::ProjectPart::CXX11; // assume C++11
|
||||
part->projectConfigFile = configFileName();
|
||||
|
||||
// ### add _defines.
|
||||
|
@@ -2233,7 +2233,8 @@ GitClient::StashInfo &GitClient::stashInfo(const QString &workingDirectory)
|
||||
void GitClient::endStashScope(const QString &workingDirectory)
|
||||
{
|
||||
const QString repoDirectory = VcsManager::findTopLevelForDirectory(workingDirectory);
|
||||
QTC_ASSERT(m_stashInfo.contains(repoDirectory), return);
|
||||
if (!m_stashInfo.contains(repoDirectory))
|
||||
return;
|
||||
m_stashInfo[repoDirectory].end();
|
||||
}
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="usernameLabel">
|
||||
<property name="text">
|
||||
<string>User name:</string>
|
||||
<string>Username:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@@ -1090,7 +1090,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
||||
[]() { return variableValue(Constants::VAR_CURRENTDEVICE_SSHPORT); });
|
||||
|
||||
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); });
|
||||
|
||||
VariableManager::registerVariable(Constants::VAR_CURRENTDEVICE_PRIVATEKEYFILE,
|
||||
|
@@ -161,7 +161,7 @@ QString Node::path() const
|
||||
|
||||
int Node::line() const
|
||||
{
|
||||
return -1;
|
||||
return m_line;
|
||||
}
|
||||
|
||||
QString Node::displayName() const
|
||||
|
@@ -332,11 +332,16 @@ void RunSettingsWidget::cloneRunConfiguration()
|
||||
if (!factory)
|
||||
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);
|
||||
if (!newRc)
|
||||
return;
|
||||
|
||||
newRc->setDisplayName(activeRunConfiguration->displayName());
|
||||
newRc->setDisplayName(name);
|
||||
m_target->addRunConfiguration(newRc);
|
||||
m_target->setActiveRunConfiguration(newRc);
|
||||
}
|
||||
|
@@ -37,6 +37,8 @@
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <tools/hostosinfo.h>
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
namespace QbsProjectManager {
|
||||
@@ -65,14 +67,33 @@ QVariantMap DefaultPropertyProvider::properties(const ProjectExplorer::Kit *k, c
|
||||
if (tc) {
|
||||
// FIXME/CLARIFY: How to pass the sysroot?
|
||||
ProjectExplorer::Abi targetAbi = tc->targetAbi();
|
||||
if (targetAbi.architecture() != ProjectExplorer::Abi::UnknownArchitecture) {
|
||||
QString architecture = ProjectExplorer::Abi::toString(targetAbi.architecture());
|
||||
if (targetAbi.wordWidth() == 64)
|
||||
architecture.append(QLatin1String("_64"));
|
||||
data.insert(QLatin1String(QBS_ARCHITECTURE), architecture);
|
||||
|
||||
// We have to be conservative tacking on suffixes to arch names because an arch that is
|
||||
// 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)
|
||||
data.insert(QLatin1String(QBS_ENDIANNESS), QLatin1String("big"));
|
||||
else
|
||||
else if (targetAbi.endianness() == ProjectExplorer::Abi::LittleEndian)
|
||||
data.insert(QLatin1String(QBS_ENDIANNESS), QLatin1String("little"));
|
||||
|
||||
if (targetAbi.os() == ProjectExplorer::Abi::WindowsOS) {
|
||||
@@ -83,19 +104,21 @@ QVariantMap DefaultPropertyProvider::properties(const ProjectExplorer::Kit *k, c
|
||||
: QStringList() << QLatin1String("msvc"));
|
||||
} else if (targetAbi.os() == ProjectExplorer::Abi::MacOS) {
|
||||
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);
|
||||
if (qt && qt->type() == QLatin1String(IOSQT)) {
|
||||
QStringList targetOS;
|
||||
if (targetAbi.architecture() == ProjectExplorer::Abi::X86Architecture)
|
||||
targetOS << QLatin1String("ios-simulator");
|
||||
targetOS << QLatin1String("ios") << QLatin1String("darwin")
|
||||
<< QLatin1String("bsd4") << QLatin1String("bsd") << QLatin1String("unix");
|
||||
data.insert(QLatin1String(QBS_TARGETOS), targetOS);
|
||||
targetOS << QLatin1String("darwin") << QLatin1String("bsd4")
|
||||
<< QLatin1String("bsd") << QLatin1String("unix");
|
||||
if (qt && qt->type() == QLatin1String(IOSQT)) {
|
||||
targetOS.insert(0, QLatin1String("ios"));
|
||||
if (ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(k) == IOS_SIMULATOR_TYPE)
|
||||
targetOS.insert(0, QLatin1String("ios-simulator"));
|
||||
} else {
|
||||
data.insert(QLatin1String(QBS_TARGETOS), QStringList() << QLatin1String("osx")
|
||||
<< QLatin1String("darwin") << QLatin1String("bsd4")
|
||||
<< QLatin1String("bsd") << QLatin1String("unix"));
|
||||
targetOS.insert(0, QLatin1String("osx"));
|
||||
}
|
||||
data.insert(QLatin1String(QBS_TARGETOS), targetOS);
|
||||
|
||||
if (tc->type() != QLatin1String("clang")) {
|
||||
data.insert(QLatin1String(QBS_TOOLCHAIN), QLatin1String("gcc"));
|
||||
} else {
|
||||
|
@@ -35,7 +35,6 @@
|
||||
|
||||
#include <coreplugin/fileiconprovider.h>
|
||||
#include <coreplugin/idocument.h>
|
||||
#include <coreplugin/messagemanager.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <qtsupport/qtsupportconstants.h>
|
||||
@@ -116,46 +115,6 @@ static qbs::GroupData findMainQbsGroup(const qbs::ProductData &productData)
|
||||
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 {
|
||||
public:
|
||||
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);
|
||||
}
|
||||
|
||||
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:
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -428,8 +378,8 @@ bool QbsGroupNode::addFiles(const QStringList &filePaths, QStringList *notAdded)
|
||||
return false;
|
||||
}
|
||||
|
||||
return addQbsFiles(this, filePaths, prjNode->qbsProject(), prdNode->qbsProductData(),
|
||||
*m_qbsGroupData, m_productPath, notAdded);
|
||||
return prjNode->project()->addFilesToProduct(this, filePaths, prdNode->qbsProductData(),
|
||||
*m_qbsGroupData, notAdded);
|
||||
}
|
||||
|
||||
bool QbsGroupNode::removeFiles(const QStringList &filePaths, QStringList *notRemoved)
|
||||
@@ -450,8 +400,8 @@ bool QbsGroupNode::removeFiles(const QStringList &filePaths, QStringList *notRem
|
||||
return false;
|
||||
}
|
||||
|
||||
return removeQbsFiles(this, filePaths, prjNode->qbsProject(), prdNode->qbsProductData(),
|
||||
*m_qbsGroupData, m_productPath, notRemoved);
|
||||
return prjNode->project()->removeFilesFromProduct(this, filePaths, prdNode->qbsProductData(),
|
||||
*m_qbsGroupData, notRemoved);
|
||||
}
|
||||
|
||||
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)
|
||||
break;
|
||||
}
|
||||
if (idx->update(grp->location()) || updateExisting)
|
||||
idx->emitNodeUpdated();
|
||||
QTC_ASSERT(idx, return);
|
||||
idx->setPathAndLine(grp->location().fileName(), grp->location().line());
|
||||
|
||||
setupFiles(this, grp->allFilePaths(), productPath, updateExisting);
|
||||
|
||||
@@ -632,8 +582,8 @@ bool QbsProductNode::addFiles(const QStringList &filePaths, QStringList *notAdde
|
||||
|
||||
qbs::GroupData grp = findMainQbsGroup(m_qbsProductData);
|
||||
if (grp.isValid()) {
|
||||
const QString &productPath = QFileInfo(m_qbsProductData.location().fileName()).absolutePath();
|
||||
return addQbsFiles(this, filePaths, prjNode->qbsProject(), m_qbsProductData, grp, productPath, notAdded);
|
||||
return prjNode->project()->addFilesToProduct(this, filePaths, m_qbsProductData, grp,
|
||||
notAdded);
|
||||
}
|
||||
|
||||
QTC_ASSERT(false, return false);
|
||||
@@ -653,8 +603,8 @@ bool QbsProductNode::removeFiles(const QStringList &filePaths, QStringList *notR
|
||||
|
||||
qbs::GroupData grp = findMainQbsGroup(m_qbsProductData);
|
||||
if (grp.isValid()) {
|
||||
const QString &productPath = QFileInfo(m_qbsProductData.location().fileName()).absolutePath();
|
||||
return removeQbsFiles(this, filePaths, prjNode->qbsProject(), m_qbsProductData, grp, productPath, notRemoved);
|
||||
return prjNode->project()->removeFilesFromProduct(this, filePaths, m_qbsProductData, grp,
|
||||
notRemoved);
|
||||
}
|
||||
|
||||
QTC_ASSERT(false, return false);
|
||||
@@ -680,8 +630,8 @@ void QbsProductNode::setQbsProductData(const qbs::ProductData prd)
|
||||
if (idx)
|
||||
break;
|
||||
}
|
||||
if (idx->update(prd.location()) || updateExisting)
|
||||
idx->emitNodeUpdated();
|
||||
QTC_ASSERT(idx, return);
|
||||
idx->setPathAndLine(prd.location().fileName(), prd.location().line());
|
||||
|
||||
QList<ProjectExplorer::ProjectNode *> toAdd;
|
||||
QList<ProjectExplorer::ProjectNode *> toRemove = subProjectNodes();
|
||||
|
@@ -55,8 +55,6 @@ public:
|
||||
int line);
|
||||
|
||||
QString displayName() const;
|
||||
|
||||
bool update(const qbs::CodeLocation &loc);
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
@@ -37,10 +37,9 @@
|
||||
#include "qbsnodes.h"
|
||||
|
||||
#include <coreplugin/documentmanager.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <coreplugin/icontext.h>
|
||||
#include <coreplugin/id.h>
|
||||
#include <coreplugin/messagemanager.h>
|
||||
#include <coreplugin/progressmanager/progressmanager.h>
|
||||
#include <coreplugin/mimedatabase.h>
|
||||
#include <cpptools/cppmodelmanagerinterface.h>
|
||||
@@ -62,12 +61,14 @@
|
||||
#include <qmljstools/qmljsmodelmanager.h>
|
||||
#include <qmljs/qmljsmodelmanagerinterface.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <qbs.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QVariantMap>
|
||||
|
||||
using namespace Core;
|
||||
using namespace ProjectExplorer;
|
||||
@@ -185,6 +186,84 @@ QStringList QbsProject::files(Project::FilesMode fileMode) const
|
||||
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()
|
||||
{
|
||||
prepareForParsing();
|
||||
@@ -259,11 +338,9 @@ qbs::Project QbsProject::qbsProject() const
|
||||
return m_qbsProject;
|
||||
}
|
||||
|
||||
const qbs::ProjectData QbsProject::qbsProjectData() const
|
||||
qbs::ProjectData QbsProject::qbsProjectData() const
|
||||
{
|
||||
if (m_qbsProject.isValid())
|
||||
return m_qbsProject.projectData();
|
||||
return qbs::ProjectData();
|
||||
return m_projectData;
|
||||
}
|
||||
|
||||
bool QbsProject::needsSpecialDeployment() const
|
||||
|
@@ -42,27 +42,13 @@
|
||||
|
||||
#include <QFuture>
|
||||
#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 ProjectExplorer { class BuildConfiguration; }
|
||||
|
||||
namespace QbsProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class QbsBaseProjectNode;
|
||||
class QbsProjectNode;
|
||||
class QbsRootProjectNode;
|
||||
class QbsProjectParser;
|
||||
@@ -84,6 +70,13 @@ public:
|
||||
|
||||
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::CleanJob *clean(const qbs::CleanOptions &opts);
|
||||
qbs::InstallJob *install(const qbs::InstallOptions &opts);
|
||||
@@ -106,7 +99,7 @@ public:
|
||||
const QString &bcName);
|
||||
|
||||
qbs::Project qbsProject() const;
|
||||
const qbs::ProjectData qbsProjectData() const;
|
||||
qbs::ProjectData qbsProjectData() const;
|
||||
|
||||
bool needsSpecialDeployment() const;
|
||||
void generateErrors(const qbs::ErrorInfo &e);
|
||||
|
@@ -202,17 +202,17 @@ QList<FormEditorItem *> AbstractFormEditorTool::filterSelectedModelNodes(const Q
|
||||
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") ||
|
||||
event->mimeData()->hasFormat("application/vnd.bauhaus.libraryresource")) {
|
||||
event->accept();
|
||||
view()->changeToDragTool();
|
||||
view()->currentTool()->dragEnterEvent(event);
|
||||
view()->currentTool()->dragEnterEvent(itemList, event);
|
||||
} else {
|
||||
event->ignore();
|
||||
}
|
||||
@@ -264,6 +264,32 @@ Snapper::Snapping AbstractFormEditorTool::generateUseSnapping(Qt::KeyboardModifi
|
||||
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()
|
||||
{
|
||||
m_itemList.clear();
|
||||
|
@@ -52,23 +52,17 @@ public:
|
||||
|
||||
virtual ~AbstractFormEditorTool();
|
||||
|
||||
virtual void mousePressEvent(const QList<QGraphicsItem*> &itemList,
|
||||
QGraphicsSceneMouseEvent *event);
|
||||
virtual void mouseMoveEvent(const QList<QGraphicsItem*> &itemList,
|
||||
QGraphicsSceneMouseEvent *event) = 0;
|
||||
virtual void mouseReleaseEvent(const QList<QGraphicsItem*> &itemList,
|
||||
QGraphicsSceneMouseEvent *event);
|
||||
virtual void mousePressEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event);
|
||||
virtual void mouseMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) = 0;
|
||||
virtual void mouseReleaseEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event);
|
||||
virtual void mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event);
|
||||
|
||||
virtual void mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList,
|
||||
QGraphicsSceneMouseEvent *event);
|
||||
virtual void hoverMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) = 0;
|
||||
|
||||
virtual void hoverMoveEvent(const QList<QGraphicsItem*> &itemList,
|
||||
QGraphicsSceneMouseEvent *event) = 0;
|
||||
|
||||
virtual void dropEvent(QGraphicsSceneDragDropEvent * event);
|
||||
virtual void dragEnterEvent(QGraphicsSceneDragDropEvent * event);
|
||||
virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent * event) = 0;
|
||||
virtual void dragMoveEvent(QGraphicsSceneDragDropEvent * event) = 0;
|
||||
virtual void dropEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent *event);
|
||||
virtual void dragEnterEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent *event);
|
||||
virtual void dragLeaveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent *event) = 0;
|
||||
virtual void dragMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent *event) = 0;
|
||||
|
||||
virtual void keyPressEvent(QKeyEvent *event) = 0;
|
||||
virtual void keyReleaseEvent(QKeyEvent *keyEvent) = 0;
|
||||
@@ -105,6 +99,7 @@ protected:
|
||||
virtual void selectedItemsChanged(const QList<FormEditorItem*> &itemList) = 0;
|
||||
virtual void showContextMenu(QGraphicsSceneMouseEvent *event);
|
||||
Snapper::Snapping generateUseSnapping(Qt::KeyboardModifiers keyboardModifier) const;
|
||||
FormEditorItem *containerFormEditorItem(const QList<QGraphicsItem*> &itemUnderMouseList, const QList<FormEditorItem*> &selectedItemList) const;
|
||||
|
||||
FormEditorView *view() const;
|
||||
void setView(FormEditorView *view);
|
||||
|
@@ -42,28 +42,19 @@
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
namespace Internal {
|
||||
void TimerHandler::clearMoveDelay()
|
||||
{
|
||||
m_dragTool->clearMoveDelay();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
DragTool::DragTool(FormEditorView *editorView)
|
||||
: AbstractFormEditorTool(editorView),
|
||||
m_moveManipulator(editorView->scene()->manipulatorLayerItem(), editorView),
|
||||
m_selectionIndicator(editorView->scene()->manipulatorLayerItem()),
|
||||
m_timerHandler(new Internal::TimerHandler(this)),
|
||||
m_blockMove(false),
|
||||
m_Aborted(false)
|
||||
m_isAborted(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
DragTool::~DragTool()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DragTool::clear()
|
||||
@@ -73,22 +64,16 @@ void DragTool::clear()
|
||||
m_movingItem.clear();
|
||||
}
|
||||
|
||||
void DragTool::mousePressEvent(const QList<QGraphicsItem*> &,
|
||||
QGraphicsSceneMouseEvent *)
|
||||
void DragTool::mousePressEvent(const QList<QGraphicsItem*> &, QGraphicsSceneMouseEvent *)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DragTool::mouseMoveEvent(const QList<QGraphicsItem*> &,
|
||||
QGraphicsSceneMouseEvent *)
|
||||
void DragTool::mouseMoveEvent(const QList<QGraphicsItem*> &, QGraphicsSceneMouseEvent *)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DragTool::hoverMoveEvent(const QList<QGraphicsItem*> &,
|
||||
QGraphicsSceneMouseEvent * /*event*/)
|
||||
void DragTool::hoverMoveEvent(const QList<QGraphicsItem*> &, QGraphicsSceneMouseEvent * /*event*/)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DragTool::keyPressEvent(QKeyEvent *event)
|
||||
@@ -96,45 +81,36 @@ void DragTool::keyPressEvent(QKeyEvent *event)
|
||||
if (event->key() == Qt::Key_Escape) {
|
||||
abort();
|
||||
event->accept();
|
||||
commitTransaction();
|
||||
m_rewriterTransaction.commit();
|
||||
view()->changeToSelectionTool();
|
||||
}
|
||||
}
|
||||
|
||||
void DragTool::keyReleaseEvent(QKeyEvent *)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void DragTool::mouseReleaseEvent(const QList<QGraphicsItem*> &/*itemList*/,
|
||||
QGraphicsSceneMouseEvent *)
|
||||
void DragTool::mouseReleaseEvent(const QList<QGraphicsItem*> &/*itemList*/, QGraphicsSceneMouseEvent *)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DragTool::mouseDoubleClickEvent(const QList<QGraphicsItem*> & /*itemList*/,
|
||||
QGraphicsSceneMouseEvent * /*event*/)
|
||||
void DragTool::mouseDoubleClickEvent(const QList<QGraphicsItem*> & /*itemList*/, QGraphicsSceneMouseEvent * /*event*/)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DragTool::itemsAboutToRemoved(const QList<FormEditorItem*> & /* removedItemList */)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DragTool::selectedItemsChanged(const QList<FormEditorItem*> &)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void DragTool::updateMoveManipulator()
|
||||
{
|
||||
if (m_moveManipulator.isActive())
|
||||
return;
|
||||
}
|
||||
|
||||
void DragTool::beginWithPoint(const QPointF &beginPoint)
|
||||
@@ -147,16 +123,14 @@ void DragTool::beginWithPoint(const QPointF &beginPoint)
|
||||
|
||||
void DragTool::createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry,
|
||||
const QmlItemNode &parentNode,
|
||||
const QPointF &scenePos)
|
||||
const QPointF &scenePosition)
|
||||
{
|
||||
MetaInfo metaInfo = MetaInfo::global();
|
||||
|
||||
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);
|
||||
|
||||
Q_ASSERT(m_dragNode.modelNode().isValid());
|
||||
m_dragNode = QmlItemNode::createQmlItemNode(view(), itemLibraryEntry, positonInItemSpace, parentNode);
|
||||
|
||||
QList<QmlItemNode> nodeList;
|
||||
nodeList.append(m_dragNode);
|
||||
@@ -165,46 +139,30 @@ void DragTool::createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry,
|
||||
|
||||
void DragTool::createQmlItemNodeFromImage(const QString &imageName,
|
||||
const QmlItemNode &parentNode,
|
||||
const QPointF &scenePos)
|
||||
const QPointF &scenePosition)
|
||||
{
|
||||
if (!parentNode.isValid())
|
||||
return;
|
||||
|
||||
if (parentNode.isValid()) {
|
||||
MetaInfo metaInfo = MetaInfo::global();
|
||||
|
||||
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;
|
||||
nodeList.append(m_dragNode);
|
||||
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())
|
||||
return scene()->rootFormEditorItem();
|
||||
return 0;
|
||||
FormEditorItem* DragTool::targetContainerOrRootItem(const QList<QGraphicsItem*> &itemList, FormEditorItem * currentItem)
|
||||
{
|
||||
FormEditorItem *formEditorItem = containerFormEditorItem(itemList, QList<FormEditorItem*>() << currentItem);
|
||||
|
||||
if (!formEditorItem)
|
||||
formEditorItem = scene()->rootFormEditorItem();
|
||||
|
||||
return formEditorItem;
|
||||
}
|
||||
|
||||
void DragTool::formEditorItemsChanged(const QList<FormEditorItem*> & itemList)
|
||||
@@ -235,54 +193,63 @@ void DragTool::instancePropertyChange(const QList<QPair<ModelNode, PropertyName>
|
||||
|
||||
void DragTool::clearMoveDelay()
|
||||
{
|
||||
if (!m_blockMove)
|
||||
return;
|
||||
if (m_blockMove) {
|
||||
m_blockMove = false;
|
||||
if (m_dragNode.isValid())
|
||||
beginWithPoint(m_startPoint);
|
||||
}
|
||||
}
|
||||
|
||||
void DragTool::abort()
|
||||
{
|
||||
if (m_Aborted)
|
||||
return;
|
||||
|
||||
m_Aborted = true;
|
||||
if (!m_isAborted) {
|
||||
m_isAborted = true;
|
||||
|
||||
if (m_dragNode.isValid())
|
||||
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") ||
|
||||
event->mimeData()->hasFormat("application/vnd.bauhaus.libraryresource")) {
|
||||
return mimeData->hasFormat(QStringLiteral("application/vnd.bauhaus.itemlibraryinfo"))
|
||||
|| 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();
|
||||
end(generateUseSnapping(event->modifiers()));
|
||||
|
||||
commitTransaction();
|
||||
m_rewriterTransaction.commit();
|
||||
|
||||
if (m_dragNode.isValid()) {
|
||||
QList<QmlItemNode> nodeList;
|
||||
nodeList.append(m_dragNode);
|
||||
view()->setSelectedModelNodes(toModelNodeList(nodeList));
|
||||
}
|
||||
m_dragNode = ModelNode();
|
||||
|
||||
m_dragNode = QmlItemNode();
|
||||
|
||||
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);
|
||||
|
||||
ItemLibraryEntry itemLibraryEntry;
|
||||
@@ -291,16 +258,13 @@ static ItemLibraryEntry itemLibraryEntryFromData(const QByteArray &data)
|
||||
return itemLibraryEntry;
|
||||
}
|
||||
|
||||
void DragTool::dragEnterEvent(QGraphicsSceneDragDropEvent * event)
|
||||
void DragTool::dragEnterEvent(const QList<QGraphicsItem*> &/*itemList*/, QGraphicsSceneDragDropEvent *event)
|
||||
{
|
||||
if (event->mimeData()->hasFormat("application/vnd.bauhaus.itemlibraryinfo") ||
|
||||
event->mimeData()->hasFormat("application/vnd.bauhaus.libraryresource")) {
|
||||
QList<Import> importToBeAddedList;
|
||||
if (canHandleMimeData(event->mimeData())) {
|
||||
m_blockMove = false;
|
||||
if (event->mimeData()->hasFormat("application/vnd.bauhaus.itemlibraryinfo")) {
|
||||
if (hasItemLibraryInfo(event->mimeData())) {
|
||||
view()->widgetInfo().widget->setFocus();
|
||||
m_Aborted = false;
|
||||
Q_ASSERT(!event->mimeData()->data("application/vnd.bauhaus.itemlibraryinfo").isEmpty());
|
||||
m_isAborted = false;
|
||||
}
|
||||
|
||||
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") ||
|
||||
event->mimeData()->hasFormat("application/vnd.bauhaus.libraryresource")) {
|
||||
if (canHandleMimeData(event->mimeData())) {
|
||||
event->accept();
|
||||
|
||||
m_moveManipulator.end();
|
||||
@@ -321,66 +284,55 @@ void DragTool::dragLeaveEvent(QGraphicsSceneDragDropEvent * event)
|
||||
if (m_dragNode.isValid())
|
||||
m_dragNode.destroy();
|
||||
|
||||
commitTransaction();
|
||||
m_rewriterTransaction.commit();
|
||||
|
||||
QList<QmlItemNode> nodeList;
|
||||
view()->setSelectedModelNodes(toModelNodeList(nodeList));
|
||||
view()->clearSelectedModelNodes();
|
||||
view()->changeToSelectionTool();
|
||||
}
|
||||
}
|
||||
|
||||
void DragTool::dragMoveEvent(QGraphicsSceneDragDropEvent * event)
|
||||
static QString libraryResourceImageName(const QMimeData *mimeData)
|
||||
{
|
||||
if (m_blockMove)
|
||||
return;
|
||||
return QString::fromUtf8((mimeData->data(QStringLiteral("application/vnd.bauhaus.libraryresource"))));
|
||||
}
|
||||
|
||||
if (m_Aborted) {
|
||||
event->ignore();
|
||||
return;
|
||||
}
|
||||
void DragTool::createDragNode(const QMimeData *mimeData, const QPointF &scenePosition, const QList<QGraphicsItem*> &itemList)
|
||||
{
|
||||
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") ||
|
||||
event->mimeData()->hasFormat("application/vnd.bauhaus.libraryresource")) {
|
||||
event->accept();
|
||||
QPointF scenePos = event->scenePos();
|
||||
if (m_dragNode.isValid()) {
|
||||
if (hasItemLibraryInfo(mimeData))
|
||||
createQmlItemNode(itemLibraryEntryFromMimeData(mimeData), targetContainerQmlItemNode, scenePosition);
|
||||
else if (hasLibraryResources(mimeData))
|
||||
createQmlItemNodeFromImage(libraryResourceImageName(mimeData), targetContainerQmlItemNode, scenePosition);
|
||||
|
||||
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_startPoint = event->scenePos();
|
||||
QTimer::singleShot(10000, m_timerHandler.data(), SLOT(clearMoveDelay()));
|
||||
m_startPoint = scenePosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
void DragTool::move(const QPointF &scenePos)
|
||||
void DragTool::move(const QPointF &scenePosition, const QList<QGraphicsItem*> &itemList)
|
||||
{
|
||||
if (!m_movingItem)
|
||||
return;
|
||||
|
||||
FormEditorItem *containerItem = calculateContainer(scenePos - QPoint(2, 2), m_movingItem.data());
|
||||
if (m_movingItem) {
|
||||
FormEditorItem *containerItem = targetContainerOrRootItem(itemList, m_movingItem.data());
|
||||
if (containerItem && m_movingItem->parentItem() &&
|
||||
containerItem != m_movingItem->parentItem()) {
|
||||
|
||||
m_moveManipulator.reparentTo(containerItem);
|
||||
}
|
||||
|
||||
//MoveManipulator::Snapping useSnapping = MoveManipulator::NoSnapping;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -42,38 +42,23 @@ namespace QmlDesigner {
|
||||
|
||||
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
|
||||
{
|
||||
public:
|
||||
DragTool(FormEditorView* editorView);
|
||||
DragTool(FormEditorView *editorView);
|
||||
virtual ~DragTool();
|
||||
|
||||
void mousePressEvent(const QList<QGraphicsItem*> &itemList,
|
||||
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
|
||||
void mouseMoveEvent(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 mousePressEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
|
||||
void mouseMoveEvent(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 dropEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent *event) QTC_OVERRIDE;
|
||||
void dragEnterEvent(const QList<QGraphicsItem*> &itemList, 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 keyReleaseEvent(QKeyEvent *keyEvent) QTC_OVERRIDE;
|
||||
@@ -88,14 +73,6 @@ public:
|
||||
|
||||
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 formEditorItemsChanged(const QList<FormEditorItem*> &itemList) QTC_OVERRIDE;
|
||||
@@ -106,28 +83,24 @@ public:
|
||||
|
||||
protected:
|
||||
void abort();
|
||||
|
||||
|
||||
private:
|
||||
void commitTransaction();
|
||||
void createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry, 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 end();
|
||||
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;
|
||||
SelectionIndicator m_selectionIndicator;
|
||||
QPointer<FormEditorItem> m_movingItem;
|
||||
RewriterTransaction m_rewriterTransaction;
|
||||
QmlItemNode m_dragNode;
|
||||
QScopedPointer<Internal::TimerHandler> m_timerHandler;
|
||||
bool m_blockMove;
|
||||
QPointF m_startPoint;
|
||||
bool m_Aborted;
|
||||
bool m_isAborted;
|
||||
};
|
||||
|
||||
|
||||
|
@@ -426,7 +426,7 @@ bool FormEditorItem::isContainer() const
|
||||
NodeMetaInfo nodeMetaInfo = qmlItemNode().modelNode().metaInfo();
|
||||
|
||||
if (nodeMetaInfo.isValid())
|
||||
return !nodeMetaInfo.defaultPropertyIsComponent();
|
||||
return !nodeMetaInfo.defaultPropertyIsComponent() && !nodeMetaInfo.isLayoutable();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -225,7 +225,7 @@ FormEditorItem *FormEditorScene::addFormEditorItem(const QmlItemNode &qmlItemNod
|
||||
|
||||
void FormEditorScene::dropEvent(QGraphicsSceneDragDropEvent * event)
|
||||
{
|
||||
currentTool()->dropEvent(event);
|
||||
currentTool()->dropEvent(removeLayerItems(items(event->scenePos())), event);
|
||||
|
||||
if (views().first())
|
||||
views().first()->setFocus();
|
||||
@@ -233,19 +233,19 @@ void FormEditorScene::dropEvent(QGraphicsSceneDragDropEvent * event)
|
||||
|
||||
void FormEditorScene::dragEnterEvent(QGraphicsSceneDragDropEvent * event)
|
||||
{
|
||||
currentTool()->dragEnterEvent(event);
|
||||
currentTool()->dragEnterEvent(removeLayerItems(items(event->scenePos())), event);
|
||||
}
|
||||
|
||||
void FormEditorScene::dragLeaveEvent(QGraphicsSceneDragDropEvent * event)
|
||||
{
|
||||
currentTool()->dragLeaveEvent(event);
|
||||
currentTool()->dragLeaveEvent(removeLayerItems(items(event->scenePos())), event);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void FormEditorScene::dragMoveEvent(QGraphicsSceneDragDropEvent * event)
|
||||
{
|
||||
currentTool()->dragMoveEvent(event);
|
||||
currentTool()->dragMoveEvent(removeLayerItems(items(event->scenePos())), event);
|
||||
}
|
||||
|
||||
QList<QGraphicsItem *> FormEditorScene::removeLayerItems(const QList<QGraphicsItem *> &itemList)
|
||||
|
@@ -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
|
||||
{
|
||||
return m_currentTool;
|
||||
|
@@ -84,6 +84,8 @@ public:
|
||||
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList) 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
|
||||
WidgetInfo widgetInfo() QTC_OVERRIDE;
|
||||
|
||||
|
@@ -103,7 +103,7 @@ void MoveManipulator::synchronizeParent(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());
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@@ -47,21 +47,16 @@ public:
|
||||
MoveTool(FormEditorView* editorView);
|
||||
~MoveTool();
|
||||
|
||||
void mousePressEvent(const QList<QGraphicsItem*> &itemList,
|
||||
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
|
||||
void mouseMoveEvent(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 mousePressEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
|
||||
void mouseMoveEvent(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 keyPressEvent(QKeyEvent *event) QTC_OVERRIDE;
|
||||
void keyReleaseEvent(QKeyEvent *keyEvent) QTC_OVERRIDE;
|
||||
|
||||
void dragLeaveEvent(QGraphicsSceneDragDropEvent * 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 itemsAboutToRemoved(const QList<FormEditorItem*> &itemList) QTC_OVERRIDE;
|
||||
|
||||
@@ -84,8 +79,6 @@ protected:
|
||||
|
||||
static QList<FormEditorItem*> movingItems(const QList<FormEditorItem*> &selectedItemList);
|
||||
|
||||
static FormEditorItem* containerFormEditorItem(const QList<QGraphicsItem*> &itemUnderMouseList,
|
||||
const QList<FormEditorItem*> &selectedItemList);
|
||||
|
||||
static bool isAncestorOfAllItems(FormEditorItem* maybeAncestorItem,
|
||||
const QList<FormEditorItem*> &itemList);
|
||||
|
@@ -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*/)
|
||||
{
|
||||
|
||||
}
|
||||
|
@@ -45,19 +45,15 @@ public:
|
||||
ResizeTool(FormEditorView* editorView);
|
||||
~ResizeTool();
|
||||
|
||||
void mousePressEvent(const QList<QGraphicsItem*> &itemList,
|
||||
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
|
||||
void mouseMoveEvent(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 mousePressEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
|
||||
void mouseMoveEvent(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 dragLeaveEvent(QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE;
|
||||
void dragMoveEvent(QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE;
|
||||
void hoverMoveEvent(const QList<QGraphicsItem*> &itemList, 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 keyReleaseEvent(QKeyEvent *keyEvent) QTC_OVERRIDE;
|
||||
|
@@ -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*/)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -51,21 +51,18 @@ public:
|
||||
SelectionTool(FormEditorView* editorView);
|
||||
~SelectionTool();
|
||||
|
||||
void mousePressEvent(const QList<QGraphicsItem*> &itemList,
|
||||
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
|
||||
void mouseMoveEvent(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 mousePressEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
|
||||
void mouseMoveEvent(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 keyPressEvent(QKeyEvent *event) QTC_OVERRIDE;
|
||||
void keyReleaseEvent(QKeyEvent *keyEvent) QTC_OVERRIDE;
|
||||
|
||||
void dragLeaveEvent(QGraphicsSceneDragDropEvent * 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 itemsAboutToRemoved(const QList<FormEditorItem*> &itemList) QTC_OVERRIDE;
|
||||
// QVariant itemChange(const QList<QGraphicsItem*> &itemList,
|
||||
|
@@ -44,6 +44,7 @@ public:
|
||||
operator ModelNode() const;
|
||||
ModelNode modelNode();
|
||||
const ModelNode modelNode() const;
|
||||
bool hasModelNode() const;
|
||||
static bool isValidQmlModelNodeFacade(const ModelNode &modelNode);
|
||||
virtual bool isValid() const;
|
||||
virtual ~QmlModelNodeFacade();
|
||||
|
@@ -490,6 +490,7 @@ InformationName NodeInstance::setInformationSceneTransform(const QTransform &sce
|
||||
{
|
||||
if (d->sceneTransform != sceneTransform) {
|
||||
d->sceneTransform = sceneTransform;
|
||||
if (!directUpdates())
|
||||
return SceneTransform;
|
||||
}
|
||||
|
||||
@@ -592,7 +593,7 @@ InformationName NodeInstance::setInformation(InformationName name, const QVarian
|
||||
switch (name) {
|
||||
case Size: return setInformationSize(information.toSizeF());
|
||||
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 ContentTransform: return setInformationContentTransform(information.value<QTransform>());
|
||||
case ContentItemTransform: return setInformationContentItemTransform(information.value<QTransform>());
|
||||
|
@@ -188,6 +188,8 @@ void NodeInstanceView::handleChrash()
|
||||
restartProcess();
|
||||
else
|
||||
emit qmlPuppetCrashed();
|
||||
|
||||
emitCustomNotification(QStringLiteral("puppet crashed"));
|
||||
}
|
||||
|
||||
|
||||
@@ -218,6 +220,11 @@ void NodeInstanceView::nodeCreated(const ModelNode &createdNode)
|
||||
if (isSkippedNode(createdNode))
|
||||
return;
|
||||
|
||||
QList<VariantProperty> propertyList;
|
||||
propertyList.append(createdNode.variantProperty("x"));
|
||||
propertyList.append(createdNode.variantProperty("y"));
|
||||
updatePosition(propertyList);
|
||||
|
||||
nodeInstanceServer()->createInstances(createCreateInstancesCommand(QList<NodeInstance>() << instance));
|
||||
nodeInstanceServer()->changePropertyValues(createChangeValueCommand(createdNode.variantProperties()));
|
||||
nodeInstanceServer()->completeComponent(createComponentCompleteCommand(QList<NodeInstance>() << instance));
|
||||
|
@@ -49,7 +49,7 @@
|
||||
<item>
|
||||
<widget class="QPushButton" name="useFallbackPuppetPushButton">
|
||||
<property name="text">
|
||||
<string>Use fallback QML emulation layer</string>
|
||||
<string>Use Fallback QML Emulation Layer</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
|
@@ -75,6 +75,11 @@ const ModelNode QmlModelNodeFacade::modelNode() const
|
||||
return m_modelNode;
|
||||
}
|
||||
|
||||
bool QmlModelNodeFacade::hasModelNode() const
|
||||
{
|
||||
return m_modelNode.isValid();
|
||||
}
|
||||
|
||||
bool QmlModelNodeFacade::isValid() const
|
||||
{
|
||||
return isValidQmlModelNodeFacade(m_modelNode);
|
||||
|
@@ -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_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_BB_KEY_CONFIGURATION_TYPE[] = "BBConfigurationType";
|
||||
|
@@ -58,7 +58,7 @@
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="userNameLabel">
|
||||
<property name="text">
|
||||
<string>The user name to log into the device:</string>
|
||||
<string>The username to log into the device:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@@ -59,9 +59,8 @@ void RefactorOverlay::paint(QPainter *painter, const QRect &clip)
|
||||
|
||||
RefactorMarker RefactorOverlay::markerAt(const QPoint &pos) const
|
||||
{
|
||||
QPointF offset = m_editor->contentOffset();
|
||||
foreach (const RefactorMarker &marker, m_markers) {
|
||||
if (marker.rect.translated(offset.toPoint()).contains(pos))
|
||||
if (marker.rect.contains(pos))
|
||||
return marker;
|
||||
}
|
||||
return RefactorMarker();
|
||||
|
100006
tests/auto/cplusplus/c99/data/limits-caselabels.c
Normal file
100006
tests/auto/cplusplus/c99/data/limits-caselabels.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -133,6 +133,7 @@ void tst_c99::parse_data()
|
||||
|
||||
QTest::newRow("designatedInitializer.1") << "designatedInitializer.1.c" << "";
|
||||
QTest::newRow("designatedInitializer.2") << "designatedInitializer.2.c" << "";
|
||||
QTest::newRow("limits-caselabels (QTCREATORBUG-12673)") << "limits-caselabels.c" << "";
|
||||
}
|
||||
|
||||
void tst_c99::parse()
|
||||
|
@@ -3728,22 +3728,33 @@ void tst_Dumpers::dumper_data()
|
||||
"Map::iterator it4 = it3; ++it4;\n"
|
||||
"Map::iterator it5 = it4; ++it5;\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.11", "[11]", "1", "unsigned int")
|
||||
+ Check("map1.22", "[22]", "2", "unsigned int")
|
||||
+ Check("map1.0", "[0] 11", "1", "unsigned int")
|
||||
+ Check("map1.1", "[1] 22", "2", "unsigned int")
|
||||
|
||||
+ Check("map2", "<2 items>", "std::map<unsigned int, float>")
|
||||
+ Check("map2.11", "[11]", "11", "float")
|
||||
+ Check("map2.22", "[22]", "22", "float")
|
||||
+ Check("map2.0", "[0] 11", "11", "float")
|
||||
+ Check("map2.1", "[1] 22", "22", "float")
|
||||
|
||||
+ 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.second", "11", "float")
|
||||
+ 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")
|
||||
@@ -3911,7 +3922,15 @@ void tst_Dumpers::dumper_data()
|
||||
"Set::iterator it1 = s2.begin();\n"
|
||||
"Set::iterator it2 = it1; ++it2;\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>")
|
||||
|
||||
@@ -3919,7 +3938,11 @@ void tst_Dumpers::dumper_data()
|
||||
|
||||
+ Check("s2", "<3 items>", "Set")
|
||||
+ 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")
|
||||
|
@@ -3262,6 +3262,32 @@ namespace stdmap {
|
||||
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()
|
||||
{
|
||||
testStdMapStringFoo();
|
||||
@@ -3274,6 +3300,8 @@ namespace stdmap {
|
||||
testStdMapStringFloat();
|
||||
testStdMapIntString();
|
||||
testStdMapStringPointer();
|
||||
testStdMultiMapUIntFloat();
|
||||
testStdMultiSetInt();
|
||||
}
|
||||
|
||||
} // namespace stdmap
|
||||
|
@@ -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.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_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.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'}
|
||||
@@ -125,6 +126,7 @@
|
||||
: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'}
|
||||
: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.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'}
|
||||
@@ -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_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.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.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'}
|
||||
@@ -202,6 +206,8 @@
|
||||
: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'}
|
||||
: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'}
|
||||
: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'}
|
||||
|
@@ -7,6 +7,6 @@ HOOK_SUB_PROCESSES=false
|
||||
IMPLICITAUTSTART=0
|
||||
LANGUAGE=Python
|
||||
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
|
||||
WRAPPERS=Qt
|
||||
|
184
tests/system/suite_debugger/tst_qml_js_console/test.py
Normal file
184
tests/system/suite_debugger/tst_qml_js_console/test.py
Normal 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")
|
@@ -215,8 +215,8 @@ def __getExpectedDebuggers__():
|
||||
result = []
|
||||
if platform.system() in ('Microsoft', 'Windows'):
|
||||
result.extend(__getCDB__())
|
||||
debuggers = ["gdb", "lldb"]
|
||||
result.extend(filter(None, map(which, debuggers)))
|
||||
for debugger in ["gdb", "lldb"]:
|
||||
result.extend(findAllFilesInPATH(debugger))
|
||||
if platform.system() == 'Linux':
|
||||
result.extend(findAllFilesInPATH("lldb-*"))
|
||||
if platform.system() == 'Darwin':
|
||||
|
@@ -29,6 +29,10 @@
|
||||
|
||||
source("../../shared/qtcreator.py")
|
||||
|
||||
def canTestQtQuick():
|
||||
return (squishinfo.major * 0x10000 + squishinfo.minor * 0x100
|
||||
+ squishinfo.patch) > 0x050100
|
||||
|
||||
def main():
|
||||
projects = prepareTestExamples()
|
||||
if not projects:
|
||||
@@ -41,6 +45,8 @@ def main():
|
||||
mainWindow = waitForObject(":Qt Creator_Core::Internal::MainWindow")
|
||||
test.verify(waitFor("sessionName in str(mainWindow.windowTitle)", 2000),
|
||||
"Verifying window title contains created session name.")
|
||||
if not isQt4Build and canTestQtQuick():
|
||||
checkWelcomePage(sessionName, True)
|
||||
for project in projects:
|
||||
openQmakeProject(project, Targets.DESKTOP_480_GCC)
|
||||
progressBarWait(20000)
|
||||
@@ -52,6 +58,9 @@ def main():
|
||||
switchSession("default")
|
||||
test.verify(waitFor("'Qt Creator' == str(mainWindow.windowTitle)", 2000),
|
||||
"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.")
|
||||
checkOpenDocuments(0, "Verifying whether all files have been closed.")
|
||||
switchSession(sessionName)
|
||||
@@ -93,7 +102,7 @@ def switchSession(toSession):
|
||||
|
||||
def createAndSwitchToSession(toSession):
|
||||
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)
|
||||
invokeMenuItem("File", "Session Manager...")
|
||||
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}"
|
||||
% sessionInputDialog)
|
||||
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))
|
||||
|
||||
def checkWelcomePage(sessionName, isCurrent=False):
|
||||
switchViewTo(ViewConstants.WELCOME)
|
||||
mouseClick(waitForObject("{clip='false' container=':Qt Creator_QDeclarativeView' enabled='true'"
|
||||
" text='Develop' type='LinkedText' unnamed='1' visible='true'}"),
|
||||
5, 5, 0, Qt.LeftButton)
|
||||
waitForObject("{clip='false' container=':Qt Creator_QDeclarativeView' enabled='true' "
|
||||
mouseClick(waitForObject("{container=':WelcomePage.scrollView_ScrollView' text='Projects' "
|
||||
"type='Button' unnamed='1' visible='true'}"), 5, 5, Qt.LeftButton)
|
||||
waitForObject("{container=':WelcomePage.scrollView_ScrollView' id='sessionsTitle' "
|
||||
"text='Sessions' type='Text' unnamed='1' visible='true'}")
|
||||
if isCurrent:
|
||||
sessions = ["default", "%s (current session)" % sessionName]
|
||||
else:
|
||||
sessions = ["default (current session)", sessionName]
|
||||
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' "
|
||||
"unnamed='1' visible='true' text='%s'}" % sessionName),
|
||||
"Verifying session '%s' exists." % sessionName)
|
||||
|
@@ -99,7 +99,7 @@ def main():
|
||||
replaceEditorContent(waitForObject(":Working Copy_Utils::BaseValidatingLineEdit"),
|
||||
targetDir)
|
||||
cloneDirEdit = waitForObject(":Working Copy.checkoutDirectoryLineEdit_QLineEdit")
|
||||
test.compare(cloneDirEdit.text, "p-qt-labs-jom")
|
||||
test.compare(cloneDirEdit.text, "jom")
|
||||
replaceEditorContent(cloneDirEdit, cloneDir)
|
||||
clickButton(waitForObject(":Next_QPushButton"))
|
||||
cloneLog = waitForObject(":Git Repository Clone.logPlainTextEdit_QPlainTextEdit", 1000)
|
||||
|
Reference in New Issue
Block a user