Project Template details and preview changes
parent
74f474aae2
commit
9b17754278
@ -0,0 +1,3 @@
|
|||||||
|
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.02554 10L9 15.0362V18L0 9L9 0V2.98885L4 8H18V10H4.02554Z" fill="#1e70eb"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 230 B |
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:8358f4dad9878c662b9819b2b346622af691eb45f8eddc28fff79a50650ae6cf
|
||||||
|
size 2503
|
||||||
@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||||
|
* its licensors.
|
||||||
|
*
|
||||||
|
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||||
|
* distribution (the "License"). All use of this software is governed by the License,
|
||||||
|
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||||
|
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <TemplateButtonWidget.h>
|
||||||
|
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QPixmap>
|
||||||
|
#include <QAbstractButton>
|
||||||
|
#include <QStyle>
|
||||||
|
#include <QVariant>
|
||||||
|
|
||||||
|
namespace O3DE::ProjectManager
|
||||||
|
{
|
||||||
|
|
||||||
|
TemplateButton::TemplateButton(const QString& imagePath, const QString& labelText, QWidget* parent)
|
||||||
|
: QPushButton(parent)
|
||||||
|
{
|
||||||
|
setAutoExclusive(true);
|
||||||
|
|
||||||
|
setObjectName("templateButton");
|
||||||
|
|
||||||
|
QVBoxLayout* vLayout = new QVBoxLayout();
|
||||||
|
vLayout->setSpacing(0);
|
||||||
|
vLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
setLayout(vLayout);
|
||||||
|
|
||||||
|
QLabel* image = new QLabel(this);
|
||||||
|
image->setObjectName("templateImage");
|
||||||
|
image->setPixmap(
|
||||||
|
QPixmap(imagePath).scaled(QSize(s_templateImageWidth,s_templateImageHeight) , Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||||
|
vLayout->addWidget(image);
|
||||||
|
|
||||||
|
QLabel* label = new QLabel(labelText, this);
|
||||||
|
label->setObjectName("templateLabel");
|
||||||
|
vLayout->addWidget(label);
|
||||||
|
|
||||||
|
connect(this, &QAbstractButton::toggled, this, &TemplateButton::onToggled);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TemplateButton::onToggled()
|
||||||
|
{
|
||||||
|
setProperty("Checked", isChecked());
|
||||||
|
|
||||||
|
// we must unpolish/polish every child after changing a property
|
||||||
|
// or else they won't use the correct stylesheet selector
|
||||||
|
for (auto child : findChildren<QWidget*>())
|
||||||
|
{
|
||||||
|
child->style()->unpolish(child);
|
||||||
|
child->style()->polish(child);
|
||||||
|
}
|
||||||
|
|
||||||
|
style()->unpolish(this);
|
||||||
|
style()->polish(this);
|
||||||
|
}
|
||||||
|
} // namespace O3DE::ProjectManager
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||||
|
* its licensors.
|
||||||
|
*
|
||||||
|
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||||
|
* distribution (the "License"). All use of this software is governed by the License,
|
||||||
|
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||||
|
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#if !defined(Q_MOC_RUN)
|
||||||
|
#include <QPushButton>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace O3DE::ProjectManager
|
||||||
|
{
|
||||||
|
class TemplateButton
|
||||||
|
: public QPushButton
|
||||||
|
{
|
||||||
|
Q_OBJECT // AUTOMOC
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit TemplateButton(const QString& imagePath, const QString& labelText, QWidget* parent = nullptr);
|
||||||
|
~TemplateButton() = default;
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
void onToggled();
|
||||||
|
|
||||||
|
private:
|
||||||
|
inline constexpr static int s_templateImageWidth = 92;
|
||||||
|
inline constexpr static int s_templateImageHeight = 122;
|
||||||
|
};
|
||||||
|
} // namespace O3DE::ProjectManager
|
||||||
Loading…
Reference in New Issue