Source

Target

Commits (6)
Showing with 76 additions and 31 deletions
......@@ -198,6 +198,7 @@ ActionEditor::ActionEditor(QDesignerFormEditorInterface *core, QWidget *parent,
// filter
m_filterWidget = new QWidget(toolbar);
QHBoxLayout *filterLayout = new QHBoxLayout(m_filterWidget);
filterLayout->setContentsMargins(0, 0, 0, 0);
QLineEdit *filterLineEdit = new QLineEdit(m_filterWidget);
connect(filterLineEdit, &QLineEdit::textChanged, this, &ActionEditor::setFilter);
filterLineEdit->setPlaceholderText(tr("Filter"));
......
......@@ -53,6 +53,8 @@
#include <QtCore/QDir>
#include <QtCore/QTextStream>
#include <QtWidgets/QApplication>
#include <QtWidgets/QDesktopWidget>
#include <QtWidgets/QHeaderView>
#include <QtWidgets/QTreeWidgetItem>
#include <QtGui/QPainter>
......@@ -320,18 +322,23 @@ QImage NewFormWidget::grabForm(QDesignerFormEditorInterface *core,
QPixmap NewFormWidget::formPreviewPixmap(QIODevice &file, const QString &workingDir) const
{
const int margin = 7;
const int shadow = 7;
const int previewSize = 256;
const QSizeF screenSize(QApplication::desktop()->screenGeometry(this).size());
const int previewSize = qRound(screenSize.width() / 7.5); // 256 on 1920px screens.
const int margin = previewSize / 32 - 1; // 7 on 1920px screens.
const int shadow = margin;
const QImage wimage = grabForm(m_core, file, workingDir, currentDeviceProfile());
if (wimage.isNull())
return QPixmap();
const QImage image = wimage.scaled(previewSize - margin * 2, previewSize - margin * 2,
Qt::KeepAspectRatio,
Qt::SmoothTransformation);
QImage dest(previewSize, previewSize, QImage::Format_ARGB32_Premultiplied);
const qreal devicePixelRatio = wimage.devicePixelRatioF();
const QSize imageSize(previewSize - margin * 2, previewSize - margin * 2);
QImage image = wimage.scaled((QSizeF(imageSize) * devicePixelRatio).toSize(),
Qt::KeepAspectRatio, Qt::SmoothTransformation);
image.setDevicePixelRatio(devicePixelRatio);
QImage dest((QSizeF(previewSize, previewSize) * devicePixelRatio).toSize(),
QImage::Format_ARGB32_Premultiplied);
dest.setDevicePixelRatio(devicePixelRatio);
dest.fill(0);
QPainter p(&dest);
......@@ -339,14 +346,14 @@ QPixmap NewFormWidget::formPreviewPixmap(QIODevice &file, const QString &working
p.setPen(QPen(palette().brush(QPalette::WindowText), 0));
p.drawRect(margin-1, margin-1, image.width() + 1, image.height() + 1);
p.drawRect(QRectF(margin - 1, margin - 1, imageSize.width() + 1.5, imageSize.height() + 1.5));
const QColor dark(Qt::darkGray);
const QColor light(Qt::transparent);
// right shadow
{
const QRect rect(margin + image.width() + 1, margin + shadow, shadow, image.height() - shadow + 1);
const QRect rect(margin + imageSize.width() + 1, margin + shadow, shadow, imageSize.height() - shadow + 1);
QLinearGradient lg(rect.topLeft(), rect.topRight());
lg.setColorAt(0, dark);
lg.setColorAt(1, light);
......@@ -355,7 +362,7 @@ QPixmap NewFormWidget::formPreviewPixmap(QIODevice &file, const QString &working
// bottom shadow
{
const QRect rect(margin + shadow, margin + image.height() + 1, image.width() - shadow + 1, shadow);
const QRect rect(margin + shadow, margin + imageSize.height() + 1, imageSize.width() - shadow + 1, shadow);
QLinearGradient lg(rect.topLeft(), rect.bottomLeft());
lg.setColorAt(0, dark);
lg.setColorAt(1, light);
......@@ -364,8 +371,8 @@ QPixmap NewFormWidget::formPreviewPixmap(QIODevice &file, const QString &working
// bottom/right corner shadow
{
const QRect rect(margin + image.width() + 1, margin + image.height() + 1, shadow, shadow);
QRadialGradient g(rect.topLeft(), shadow);
const QRect rect(margin + imageSize.width() + 1, margin + imageSize.height() + 1, shadow, shadow);
QRadialGradient g(rect.topLeft(), shadow - 1);
g.setColorAt(0, dark);
g.setColorAt(1, light);
p.fillRect(rect, g);
......@@ -373,8 +380,8 @@ QPixmap NewFormWidget::formPreviewPixmap(QIODevice &file, const QString &working
// top/right corner
{
const QRect rect(margin + image.width() + 1, margin, shadow, shadow);
QRadialGradient g(rect.bottomLeft(), shadow);
const QRect rect(margin + imageSize.width() + 1, margin, shadow, shadow);
QRadialGradient g(rect.bottomLeft(), shadow - 1);
g.setColorAt(0, dark);
g.setColorAt(1, light);
p.fillRect(rect, g);
......@@ -382,8 +389,8 @@ QPixmap NewFormWidget::formPreviewPixmap(QIODevice &file, const QString &working
// bottom/left corner
{
const QRect rect(margin, margin + image.height() + 1, shadow, shadow);
QRadialGradient g(rect.topRight(), shadow);
const QRect rect(margin, margin + imageSize.height() + 1, shadow, shadow);
QRadialGradient g(rect.topRight(), shadow - 1);
g.setColorAt(0, dark);
g.setColorAt(1, light);
p.fillRect(rect, g);
......
......@@ -194,6 +194,7 @@ QtResourceViewPrivate::QtResourceViewPrivate(QDesignerFormEditorInterface *core)
m_ignoreGuiSignals(false),
m_resourceEditingEnabled(true)
{
m_toolBar->setIconSize(QSize(22, 22));
}
void QtResourceViewPrivate::restoreSettings()
......@@ -603,6 +604,7 @@ QtResourceView::QtResourceView(QDesignerFormEditorInterface *core, QWidget *pare
d_ptr->m_filterWidget = new QWidget(d_ptr->m_toolBar);
QHBoxLayout *filterLayout = new QHBoxLayout(d_ptr->m_filterWidget);
filterLayout->setContentsMargins(0, 0, 0, 0);
QLineEdit *filterLineEdit = new QLineEdit(d_ptr->m_filterWidget);
connect(filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotFilterChanged(QString)));
filterLineEdit->setPlaceholderText(tr("Filter"));
......
......@@ -1848,16 +1848,16 @@ void CppParser::parseInternal(ConversionData &cd, const QStringList &includeStac
}
}
if (yyTok == Tok_Colon) {
// Skip any token until '{' since we might do things wrong if we find
// a '::' token here.
if (yyTok == Tok_Colon || yyTok == Tok_Other) {
// Skip any token until '{' or ';' since we might do things wrong if we find
// a '::' or ':' token here.
do {
yyTok = getToken();
if (yyTok == Tok_Eof)
goto goteof;
if (yyTok == Tok_Cancel)
goto case_default;
} while (yyTok != Tok_LeftBrace);
} while (yyTok != Tok_LeftBrace && yyTok != Tok_Semicolon);
} else {
if (yyTok != Tok_LeftBrace) {
// Obviously a forward declaration. We skip those, as they
......
......@@ -280,7 +280,7 @@ FrameworkInfo parseOtoolLibraryLine(const QString &line, const QString &appBundl
if (state == QtPath) {
// Check for library name part
if (part < parts.count() && parts.at(part).contains(".dylib ")) {
if (part < parts.count() && parts.at(part).contains(".dylib")) {
info.frameworkDirectory += "/" + (qtPath + currentPart + "/").simplified();
state = DylibName;
continue;
......@@ -289,16 +289,23 @@ FrameworkInfo parseOtoolLibraryLine(const QString &line, const QString &appBundl
state = FrameworkName;
continue;
} else if (trimmed.startsWith("/") == false) { // If the line does not contain a full path, the app is using a binary Qt package.
QStringList partsCopy = parts;
partsCopy.removeLast();
if (currentPart.contains(".framework")) {
info.frameworkDirectory = "/Library/Frameworks/";
info.frameworkDirectory = "/Library/Frameworks/" + partsCopy.join("/");
if (!info.frameworkDirectory.endsWith("/"))
info.frameworkDirectory += "/";
state = FrameworkName;
} else {
info.frameworkDirectory = "/usr/lib/";
--part;
continue;
} else if (currentPart.contains(".dylib")) {
info.frameworkDirectory = "/usr/lib/" + partsCopy.join("/");
if (!info.frameworkDirectory.endsWith("/"))
info.frameworkDirectory += "/";
state = DylibName;
--part;
continue;
}
--part;
continue;
}
qtPath += (currentPart + "/");
......@@ -342,9 +349,12 @@ FrameworkInfo parseOtoolLibraryLine(const QString &line, const QString &appBundl
}
}
info.installName = findDependencyInfo(info.sourceFilePath).installName;
if (info.installName.startsWith("@rpath/"))
info.deployedInstallName = info.installName;
if (!info.sourceFilePath.isEmpty() && QFile::exists(info.sourceFilePath)) {
info.installName = findDependencyInfo(info.sourceFilePath).installName;
if (info.installName.startsWith("@rpath/"))
info.deployedInstallName = info.installName;
}
return info;
}
......
......@@ -627,3 +627,20 @@ TemplateClass::TemplateClass(int) :
tr("[unsupported] TemplateClass(int) out-of-class body");
}
// Related to QTBUG-53644, adapted from qglobal.h.
// Namespace Private must be parsed correctly for TranslatedAfterPrivate to work.
namespace Private {
template <class T> struct Class1 { T t; };
template <class T> struct Class1<T &> : Class1<T> {};
template <class T> struct Class2 { enum { Value = sizeof(T) }; };
} // namespace Private
class TranslatedAfterPrivate
{
Q_OBJECT
TranslatedAfterPrivate()
{
tr("Must be in context TranslatedAfterPrivate");
}
};
......@@ -554,6 +554,14 @@ backslashed \ stuff.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TranslatedAfterPrivate</name>
<message>
<location filename="main.cpp" line="644"/>
<source>Must be in context TranslatedAfterPrivate</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>YetAnotherTest</name>
<message>
......