forked from qt-creator/qt-creator
Fix image border for examples browser
It was made smaller for the tutorials to fit the new aspect ratio for
their images, but we may not do that for the examples.
Fixup for 7d83472906
Task-number: QTCREATORBUG-20078
Change-Id: I556536a7e299e8f675332cd7450ece5fca6fab0a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -440,7 +440,8 @@ public:
|
|||||||
QRect pixmapRect = inner;
|
QRect pixmapRect = inner;
|
||||||
if (!pm.isNull()) {
|
if (!pm.isNull()) {
|
||||||
painter->setPen(foregroundColor2);
|
painter->setPen(foregroundColor2);
|
||||||
pixmapRect = inner.adjusted(6, 20, -6, -15);
|
if (!m_showExamples)
|
||||||
|
pixmapRect = inner.adjusted(6, 20, -6, -15);
|
||||||
QPoint pixmapPos = pixmapRect.center();
|
QPoint pixmapPos = pixmapRect.center();
|
||||||
pixmapPos.rx() -= pm.width() / pm.devicePixelRatio() / 2;
|
pixmapPos.rx() -= pm.width() / pm.devicePixelRatio() / 2;
|
||||||
pixmapPos.ry() -= pm.height() / pm.devicePixelRatio() / 2;
|
pixmapPos.ry() -= pm.height() / pm.devicePixelRatio() / 2;
|
||||||
@@ -560,6 +561,8 @@ public:
|
|||||||
return QAbstractItemDelegate::editorEvent(ev, model, option, idx);
|
return QAbstractItemDelegate::editorEvent(ev, model, option, idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setShowExamples(bool showExamples) { m_showExamples = showExamples; goon(); }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void tagClicked(const QString &tag);
|
void tagClicked(const QString &tag);
|
||||||
|
|
||||||
@@ -575,6 +578,7 @@ private:
|
|||||||
mutable QPointer<QAbstractItemView> m_currentWidget;
|
mutable QPointer<QAbstractItemView> m_currentWidget;
|
||||||
mutable QVector<QPair<QString, QRect>> m_currentTagRects;
|
mutable QVector<QPair<QString, QRect>> m_currentTagRects;
|
||||||
mutable QPixmapCache m_pixmapCache;
|
mutable QPixmapCache m_pixmapCache;
|
||||||
|
bool m_showExamples = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ExamplesPageWidget : public QWidget
|
class ExamplesPageWidget : public QWidget
|
||||||
@@ -583,6 +587,7 @@ public:
|
|||||||
ExamplesPageWidget(bool isExamples)
|
ExamplesPageWidget(bool isExamples)
|
||||||
: m_isExamples(isExamples)
|
: m_isExamples(isExamples)
|
||||||
{
|
{
|
||||||
|
m_exampleDelegate.setShowExamples(isExamples);
|
||||||
const int sideMargin = 27;
|
const int sideMargin = 27;
|
||||||
static ExamplesListModel *s_examplesModel = new ExamplesListModel(this);
|
static ExamplesListModel *s_examplesModel = new ExamplesListModel(this);
|
||||||
m_examplesModel = s_examplesModel;
|
m_examplesModel = s_examplesModel;
|
||||||
|
Reference in New Issue
Block a user