forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/4.15'
Change-Id: I613b60f7d5cfca19ed611b3777548738d7bd7d67
This commit is contained in:
@@ -388,6 +388,25 @@ void Project::setExtraProjectFiles(const QSet<Utils::FilePath> &projectDocumentP
|
||||
}
|
||||
}
|
||||
|
||||
void Project::updateExtraProjectFiles(const QSet<Utils::FilePath> &projectDocumentPaths,
|
||||
const DocUpdater &docUpdater)
|
||||
{
|
||||
for (const Utils::FilePath &fp : projectDocumentPaths) {
|
||||
for (const auto &doc : d->m_extraProjectDocuments) {
|
||||
if (doc->filePath() == fp) {
|
||||
docUpdater(doc.get());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Project::updateExtraProjectFiles(const DocUpdater &docUpdater)
|
||||
{
|
||||
for (const auto &doc : qAsConst(d->m_extraProjectDocuments))
|
||||
docUpdater(doc.get());
|
||||
}
|
||||
|
||||
Target *Project::target(Utils::Id id) const
|
||||
{
|
||||
return Utils::findOrDefault(d->m_targets, Utils::equal(&Target::id, id));
|
||||
|
||||
@@ -169,6 +169,9 @@ public:
|
||||
void setExtraProjectFiles(const QSet<Utils::FilePath> &projectDocumentPaths,
|
||||
const DocGenerator &docGenerator = {},
|
||||
const DocUpdater &docUpdater = {});
|
||||
void updateExtraProjectFiles(const QSet<Utils::FilePath> &projectDocumentPaths,
|
||||
const DocUpdater &docUpdater);
|
||||
void updateExtraProjectFiles(const DocUpdater &docUpdater);
|
||||
|
||||
void setDisplayName(const QString &name);
|
||||
void setProjectLanguage(Utils::Id id, bool enabled);
|
||||
|
||||
@@ -122,7 +122,8 @@ public:
|
||||
Q_UNUSED(errorString)
|
||||
Q_UNUSED(flag)
|
||||
Q_UNUSED(type)
|
||||
m_priFile->scheduleUpdate();
|
||||
if (m_priFile)
|
||||
m_priFile->scheduleUpdate();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -692,7 +693,26 @@ void QmakeBuildSystem::asyncUpdate()
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure we ignore requests for re-evaluation for files whose QmakePriFile objects
|
||||
// will get deleted during the parse.
|
||||
const auto docUpdater = [](Core::IDocument *doc) {
|
||||
static_cast<QmakePriFileDocument *>(doc)->setPriFile(nullptr);
|
||||
};
|
||||
if (m_asyncUpdateState != AsyncFullUpdatePending) {
|
||||
QSet<FilePath> projectFilePaths;
|
||||
for (QmakeProFile * const file : qAsConst(m_partialEvaluate)) {
|
||||
QVector<QmakePriFile *> priFiles = file->children();
|
||||
for (int i = 0; i < priFiles.count(); ++i) {
|
||||
const QmakePriFile * const priFile = priFiles.at(i);
|
||||
projectFilePaths << priFile->filePath();
|
||||
priFiles << priFile->children();
|
||||
}
|
||||
}
|
||||
project()->updateExtraProjectFiles(projectFilePaths, docUpdater);
|
||||
}
|
||||
|
||||
if (m_asyncUpdateState == AsyncFullUpdatePending) {
|
||||
project()->updateExtraProjectFiles(docUpdater);
|
||||
rootProFile()->asyncUpdate();
|
||||
} else {
|
||||
foreach (QmakeProFile *file, m_partialEvaluate)
|
||||
|
||||
@@ -187,12 +187,46 @@ void CommentValueDelegate::setEditorData(QWidget *editor, const QModelIndex &ind
|
||||
auto *e = qobject_cast<QLineEdit *>(editor);
|
||||
e->setText(data.toString());
|
||||
} else if (data.userType() == QMetaType::QColor) {
|
||||
auto *e = qobject_cast<Utils::QtColorButton *>(editor);
|
||||
auto *e = qobject_cast<AnnotationTableColorButton *>(editor);
|
||||
e->setColor(data.value<QColor>());
|
||||
e->installEventFilter(e);
|
||||
connect(e,
|
||||
&AnnotationTableColorButton::editorFinished,
|
||||
this,
|
||||
&CommentValueDelegate::slotEditorFinished,
|
||||
Qt::UniqueConnection);
|
||||
connect(e,
|
||||
&AnnotationTableColorButton::editorCanceled,
|
||||
this,
|
||||
&CommentValueDelegate::slotEditorCanceled,
|
||||
Qt::UniqueConnection);
|
||||
} else
|
||||
QItemDelegate::setEditorData(editor, index);
|
||||
}
|
||||
|
||||
bool AnnotationTableColorButton::eventFilter(QObject *object, QEvent *event)
|
||||
{
|
||||
AnnotationTableColorButton *editor = qobject_cast<AnnotationTableColorButton*>(object);
|
||||
if (editor && event->type() == QEvent::FocusOut && editor->isDialogOpen())
|
||||
return true;
|
||||
|
||||
return QObject::eventFilter(object, event);
|
||||
}
|
||||
|
||||
void CommentValueDelegate::slotEditorCanceled(QWidget *editor)
|
||||
{
|
||||
emit closeEditor(editor);
|
||||
}
|
||||
|
||||
void CommentValueDelegate::slotEditorFinished(QWidget *editor)
|
||||
{
|
||||
AnnotationTableColorButton* e = qobject_cast<AnnotationTableColorButton *>(editor);
|
||||
if (e) {
|
||||
emit commitData(editor);
|
||||
emit closeEditor(editor, QAbstractItemDelegate::SubmitModelCache);
|
||||
}
|
||||
}
|
||||
|
||||
void CommentValueDelegate::setModelData(QWidget *editor,
|
||||
QAbstractItemModel *model,
|
||||
const QModelIndex &index) const
|
||||
@@ -201,9 +235,11 @@ void CommentValueDelegate::setModelData(QWidget *editor,
|
||||
if (data.userType() == qMetaTypeId<RichTextProxy>())
|
||||
return;
|
||||
else if (data.userType() == QMetaType::QColor)
|
||||
{
|
||||
model->setData(index,
|
||||
qobject_cast<Utils::QtColorButton *>(editor)->color(),
|
||||
qobject_cast<AnnotationTableColorButton *>(editor)->color(),
|
||||
Qt::DisplayRole);
|
||||
}
|
||||
else if (data.userType() == QMetaType::QString)
|
||||
model->setData(index, qobject_cast<QLineEdit *>(editor)->text(), Qt::DisplayRole);
|
||||
else
|
||||
@@ -247,6 +283,16 @@ void RichTextCellEditor::mouseReleaseEvent(QMouseEvent *)
|
||||
emit clicked();
|
||||
}
|
||||
|
||||
AnnotationTableColorButton::AnnotationTableColorButton(QWidget *parent)
|
||||
: Utils::QtColorButton(parent)
|
||||
{
|
||||
connect(this, &Utils::QtColorButton::colorChangeStarted, this, [this](){emit editorStarted(this);});
|
||||
connect(this, &Utils::QtColorButton::colorChanged, this, [this](QColor){emit editorFinished(this);});
|
||||
connect(this, &Utils::QtColorButton::colorUnchanged, this, [this](){emit editorCanceled(this);});
|
||||
}
|
||||
|
||||
AnnotationTableColorButton::~AnnotationTableColorButton() {}
|
||||
|
||||
AnnotationTableView::AnnotationTableView(QWidget *parent)
|
||||
: QTableView(parent)
|
||||
, m_model(std::make_unique<QStandardItemModel>())
|
||||
@@ -283,7 +329,7 @@ AnnotationTableView::AnnotationTableView(QWidget *parent)
|
||||
m_editorFactory->registerEditor(qMetaTypeId<RichTextProxy>(),
|
||||
new QItemEditorCreator<RichTextCellEditor>("richText"));
|
||||
m_editorFactory->registerEditor(QMetaType::QColor,
|
||||
new QItemEditorCreator<Utils::QtColorButton>("color"));
|
||||
new QItemEditorCreator<AnnotationTableColorButton>("color"));
|
||||
|
||||
m_valueDelegate.setItemEditorFactory(m_editorFactory.get());
|
||||
connect(&m_valueDelegate,
|
||||
|
||||
@@ -33,12 +33,15 @@
|
||||
#include "annotation.h"
|
||||
#include "defaultannotations.h"
|
||||
|
||||
#include <utils/qtcolorbutton.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QStandardItemModel;
|
||||
class QCompleter;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
class CommentDelegate : public QItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -98,6 +101,11 @@ public:
|
||||
void setModelData(QWidget *editor,
|
||||
QAbstractItemModel *model,
|
||||
const QModelIndex &index) const override;
|
||||
|
||||
public slots:
|
||||
void slotEditorFinished(QWidget* editor);
|
||||
void slotEditorCanceled(QWidget* editor);
|
||||
|
||||
signals:
|
||||
void richTextEditorRequested(int index, QString const &richText);
|
||||
};
|
||||
@@ -129,6 +137,21 @@ private:
|
||||
QMetaObject::Connection m_connection;
|
||||
};
|
||||
|
||||
class AnnotationTableColorButton : public Utils::QtColorButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AnnotationTableColorButton(QWidget* parent);
|
||||
~AnnotationTableColorButton();
|
||||
|
||||
bool eventFilter(QObject *object, QEvent *event) override;
|
||||
|
||||
signals:
|
||||
void editorStarted(QWidget* editor);
|
||||
void editorFinished(QWidget* editor);
|
||||
void editorCanceled(QWidget* editor);
|
||||
};
|
||||
|
||||
class AnnotationTableView : public QTableView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -292,7 +292,7 @@ void ItemLibraryWidget::handleAddImport(int index)
|
||||
}
|
||||
|
||||
m_model->changeImports({import}, {});
|
||||
QmlDesignerPlugin::instance()->currentDesignDocument()->updateSubcomponentManager();
|
||||
|
||||
m_stackedWidget->setCurrentIndex(0); // switch to the Components view after import is added
|
||||
updateSearch();
|
||||
}
|
||||
|
||||
@@ -3669,7 +3669,7 @@ void TextEditorWidgetPrivate::highlightSearchResults(const QTextBlock &block, co
|
||||
QString text = block.text();
|
||||
text.replace(QChar::Nbsp, QLatin1Char(' '));
|
||||
int idx = -1;
|
||||
int l = 1;
|
||||
int l = 0;
|
||||
|
||||
const int left = data.viewportRect.left() - int(data.offset.x());
|
||||
const int right = data.viewportRect.right() - int(data.offset.x());
|
||||
|
||||
Reference in New Issue
Block a user