Merge branch 'development' into Prefab/SaveAllPrefabs
Signed-off-by: srikappa-amzn <srikappa@amazon.com>
This commit is contained in:
@@ -141,7 +141,6 @@ namespace AzQtComponents
|
||||
}
|
||||
|
||||
QRect buttonRect = style->subControlRect(QStyle::CC_ToolButton, option, QStyle::SC_ToolButton, widget);
|
||||
QRect menuRect = style->subControlRect(QStyle::CC_ToolButton, option, QStyle::SC_ToolButtonMenu, widget);
|
||||
|
||||
painter->save();
|
||||
|
||||
|
||||
@@ -31,8 +31,6 @@ static const int g_closeButtonOffset = g_closeButtonWidth + AzQtComponents::Dock
|
||||
static const QColor g_tabIndicatorUnderlayColor(Qt::black);
|
||||
// Constant for the opacity of our tab indicator underlay
|
||||
static const qreal g_tabIndicatorUnderlayOpacity = 0.75;
|
||||
// Constant for the duration of our tab animations (in milliseconds)
|
||||
static const int g_tabAnimationDurationMS = 250;
|
||||
|
||||
|
||||
namespace AzQtComponents
|
||||
@@ -149,7 +147,7 @@ namespace AzQtComponents
|
||||
TabBar::tabLayoutChange();
|
||||
|
||||
// Only the active tab's close button should be shown
|
||||
const ButtonPosition closeSide = (ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, this);
|
||||
const ButtonPosition closeSide = (ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, nullptr, this);
|
||||
const int numTabs = count();
|
||||
const int activeTabIndex = currentIndex();
|
||||
for (int i = 0; i < numTabs; ++i)
|
||||
@@ -192,7 +190,7 @@ namespace AzQtComponents
|
||||
}
|
||||
});
|
||||
|
||||
const ButtonPosition closeSide = (ButtonPosition) style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, this);
|
||||
const ButtonPosition closeSide = (ButtonPosition) style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, nullptr, this);
|
||||
setTabButton(index, closeSide, closeButton);
|
||||
}
|
||||
|
||||
|
||||
@@ -852,7 +852,7 @@ namespace AzQtComponents
|
||||
{
|
||||
FilterCriteriaButton* button = createCriteriaButton(filter, index);
|
||||
connect(button, &FilterCriteriaButton::RequestClose, this, [this, index]() { SetFilterStateByIndex(index, false); });
|
||||
connect(button, &FilterCriteriaButton::ExtraButtonClicked, this, [this, index](FilterCriteriaButton::ExtraButtonType type)
|
||||
connect(button, &FilterCriteriaButton::ExtraButtonClicked, this, [](FilterCriteriaButton::ExtraButtonType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
|
||||
@@ -112,7 +112,7 @@ QLayoutItem* FlowLayout::takeAt(int index)
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ int FlowLayout::smartSpacing(QStyle::PixelMetric pm) const
|
||||
else if (parent->isWidgetType())
|
||||
{
|
||||
QWidget* pw = static_cast<QWidget*>(parent);
|
||||
return pw->style()->pixelMetric(pm, 0, pw);
|
||||
return pw->style()->pixelMetric(pm, nullptr, pw);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -75,11 +75,11 @@ namespace AzQtComponents
|
||||
connect(slider, &QSlider::sliderReleased, this, [this] { m_dragging = false; });
|
||||
}
|
||||
}
|
||||
~ClickEventFilterPrivate() {}
|
||||
~ClickEventFilterPrivate() override {}
|
||||
signals:
|
||||
void clickOnApplication(const QPoint& pos);
|
||||
protected:
|
||||
bool eventFilter(QObject* obj, QEvent* event)
|
||||
bool eventFilter(QObject* obj, QEvent* event) override
|
||||
{
|
||||
if (event->type() == QEvent::MouseButtonRelease && !m_dragging)
|
||||
{
|
||||
|
||||
@@ -25,11 +25,6 @@
|
||||
|
||||
namespace AzQtComponents
|
||||
{
|
||||
namespace CardConstants
|
||||
{
|
||||
static const char* kPropertySelected = "selected";
|
||||
}
|
||||
|
||||
static QPixmap ApplyAlphaToPixmap(const QPixmap& pixmap, float alpha)
|
||||
{
|
||||
QImage image = pixmap.toImage().convertToFormat(QImage::Format_ARGB32);
|
||||
|
||||
+1
-1
@@ -208,7 +208,7 @@ namespace AzQtComponents
|
||||
|
||||
QString PaletteCardCollection::uniquePaletteName(QSharedPointer<PaletteCard> card, const QString& name) const
|
||||
{
|
||||
const auto paletteNameExists = [this, card](const QString& name)
|
||||
const auto paletteNameExists = [this](const QString& name)
|
||||
{
|
||||
auto it = std::find_if(m_paletteCards.begin(), m_paletteCards.end(),
|
||||
[&name](QSharedPointer<const PaletteCard> card)
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace AzQtComponents
|
||||
|
||||
void release(bool selected);
|
||||
|
||||
QToolButton* m_button;
|
||||
[[maybe_unused]] QToolButton* m_button;
|
||||
|
||||
int m_contextSize;
|
||||
int m_sampleSize;
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzQtComponents/Components/Widgets/FileDialog.h>
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QRegExp>
|
||||
|
||||
namespace AzQtComponents
|
||||
{
|
||||
QString FileDialog::GetSaveFileName(QWidget* parent, const QString& caption, const QString& dir,
|
||||
const QString& filter, QString* selectedFilter, QFileDialog::Options options)
|
||||
{
|
||||
bool shouldPromptAgain = false;
|
||||
QString filePath;
|
||||
|
||||
do
|
||||
{
|
||||
// Trigger Qt's save filename dialog
|
||||
// If filePath isn't empty, it means we are prompting again because the filename was invalid,
|
||||
// so pass it instead of the directory so the filename is pre-filled in for the user
|
||||
filePath = QFileDialog::getSaveFileName(parent, caption, (filePath.isEmpty()) ? dir : filePath, filter, selectedFilter, options);
|
||||
|
||||
if (!filePath.isEmpty())
|
||||
{
|
||||
QFileInfo fileInfo(filePath);
|
||||
QString fileName = fileInfo.fileName();
|
||||
|
||||
// Check if the filename has any invalid characters
|
||||
QRegExp validFileNameRegex("^[a-zA-Z0-9_\\-./]*$");
|
||||
shouldPromptAgain = !validFileNameRegex.exactMatch(fileName);
|
||||
|
||||
// If the filename had invalid characters, then show a warning message and then we will re-prompt the save filename dialog
|
||||
if (shouldPromptAgain)
|
||||
{
|
||||
QMessageBox::warning(parent, QObject::tr("Invalid filename"),
|
||||
QObject::tr("O3DE assets are restricted to alphanumeric characters, hyphens (-), underscores (_), and dots (.)\n\n%1").arg(fileName));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the filePath is empty, then the user cancelled the dialog so we don't need to prompt again
|
||||
shouldPromptAgain = false;
|
||||
}
|
||||
} while (shouldPromptAgain);
|
||||
|
||||
return filePath;
|
||||
}
|
||||
} // namespace AzQtComponents
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzQtComponents/AzQtComponentsAPI.h>
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <QFileDialog>
|
||||
#endif
|
||||
|
||||
namespace AzQtComponents
|
||||
{
|
||||
class AZ_QT_COMPONENTS_API FileDialog
|
||||
{
|
||||
public:
|
||||
//! Helper method that extends QFileDialog::getSaveFileName to prevent the user from
|
||||
//! saving a filename with invalid characters (e.g. AP doesn't allow @ characters because they are used for aliases)
|
||||
static QString GetSaveFileName(QWidget* parent = nullptr, const QString& caption = QString(),
|
||||
const QString& dir = QString(), const QString& filter = QString(),
|
||||
QString* selectedFilter = nullptr, QFileDialog::Options options = QFileDialog::Options());
|
||||
};
|
||||
|
||||
} // namespace AzQtComponents
|
||||
@@ -30,7 +30,7 @@ GradientSlider::GradientSlider(Qt::Orientation orientation, QWidget* parent)
|
||||
|
||||
setMouseTracking(true);
|
||||
|
||||
m_colorFunction = [this](qreal value) {
|
||||
m_colorFunction = [](qreal value) {
|
||||
return QColor::fromRgbF(value, value, value);
|
||||
};
|
||||
|
||||
@@ -115,7 +115,6 @@ void GradientSlider::mouseMoveEvent(QMouseEvent* event)
|
||||
int intValue = Slider::valueFromPosition(this, event->pos(), width(), height(), rect().bottom());
|
||||
|
||||
qreal value = (aznumeric_cast<qreal, int>(intValue - minimum()) / aznumeric_cast<qreal, int>(maximum() - minimum()));
|
||||
QColor rgb = m_colorFunction(value);
|
||||
|
||||
const QString toolTipText = m_toolTipFunction(value);
|
||||
|
||||
|
||||
@@ -773,7 +773,7 @@ namespace AzQtComponents
|
||||
if (numButtons > 0)
|
||||
{
|
||||
// and finally add the right margins QLineEdit removes to make the buttons fit (it thinks)
|
||||
const int iconSize = style->pixelMetric(QStyle::PM_SmallIconSize, 0, widget);
|
||||
const int iconSize = style->pixelMetric(QStyle::PM_SmallIconSize, nullptr, widget);
|
||||
const int delta = iconSize / 4 + iconSize + 6;
|
||||
r.setRight(r.right() + delta * numButtons);
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ namespace AzQtComponents
|
||||
};
|
||||
QMap<QObject*, ScrollAreaData> m_widgets;
|
||||
|
||||
void perScrollBar(QObject* scrollArea, void (QScrollBar::*callback)(void))
|
||||
void perScrollBar(QObject* scrollArea, void (QScrollBar::*callback)())
|
||||
{
|
||||
auto iterator = m_widgets.find(scrollArea);
|
||||
if (iterator != m_widgets.end())
|
||||
|
||||
@@ -490,11 +490,11 @@ QRect Slider::sliderGrooveRect(const Style* style, const QStyleOptionSlider* opt
|
||||
return {};
|
||||
}
|
||||
|
||||
bool Slider::polish(Style* style, QWidget* widget, const Slider::Config& config)
|
||||
bool Slider::polish([[maybe_unused]] Style* style, QWidget* widget, const Slider::Config& config)
|
||||
{
|
||||
Q_UNUSED(config);
|
||||
|
||||
auto polishSlider = [style](auto slider)
|
||||
auto polishSlider = [](auto slider)
|
||||
{
|
||||
// Qt's stylesheet parsing doesn't set custom properties on things specified via
|
||||
// pseudo-states, such as horizontal/vertical, so we implement our own
|
||||
|
||||
@@ -632,7 +632,7 @@ namespace AzQtComponents
|
||||
return;
|
||||
}
|
||||
|
||||
ButtonPosition closeSide = (ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, this);
|
||||
ButtonPosition closeSide = (ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, nullptr, this);
|
||||
for (int i = 0; i < count(); i++)
|
||||
{
|
||||
QWidget* tabBtn = tabButton(i, closeSide);
|
||||
|
||||
@@ -65,7 +65,6 @@ namespace AzQtComponents
|
||||
return false;
|
||||
}
|
||||
|
||||
const quint16 currentMajorVersion = 2;
|
||||
quint16 majorVersion = 0;
|
||||
quint16 minorVersion = 0;
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ AzQtComponents::SpinBox::setHasError(doubleSpinBox, true);
|
||||
{
|
||||
QAction* action = new QAction("Up", this);
|
||||
action->setShortcut(QKeySequence(Qt::Key_Up));
|
||||
connect(action, &QAction::triggered, [this]()
|
||||
connect(action, &QAction::triggered, []()
|
||||
{
|
||||
qDebug() << "Up pressed";
|
||||
});
|
||||
@@ -155,7 +155,7 @@ AzQtComponents::SpinBox::setHasError(doubleSpinBox, true);
|
||||
{
|
||||
QAction* action = new QAction("Down", this);
|
||||
action->setShortcut(QKeySequence(Qt::Key_Down));
|
||||
connect(action, &QAction::triggered, [this]()
|
||||
connect(action, &QAction::triggered, []()
|
||||
{
|
||||
qDebug() << "Down pressed";
|
||||
});
|
||||
@@ -171,7 +171,7 @@ template <typename SpinBoxType, typename ValueType>
|
||||
void SpinBoxPage::track(SpinBoxType* spinBox)
|
||||
{
|
||||
// connect to changes in the spinboxes and listen for the undo state
|
||||
QObject::connect(spinBox, &SpinBoxType::valueChangeBegan, this, [this, spinBox]() {
|
||||
QObject::connect(spinBox, &SpinBoxType::valueChangeBegan, this, [spinBox]() {
|
||||
ValueType oldValue = spinBox->value();
|
||||
spinBox->setProperty("OldValue", oldValue);
|
||||
});
|
||||
|
||||
@@ -36,17 +36,17 @@ TabWidgetPage::TabWidgetPage(QWidget* parent)
|
||||
menu->addAction("Action 4 (No-op)");
|
||||
actionMenu->setMenu(menu);
|
||||
|
||||
connect(action1, &QAction::triggered, this, [this]() {
|
||||
connect(action1, &QAction::triggered, this, []() {
|
||||
QMessageBox messageBox({}, "Action 1 triggered", "Action 1 has been triggered", QMessageBox::Ok);
|
||||
messageBox.exec();
|
||||
});
|
||||
|
||||
connect(action2, &QAction::triggered, this, [this]() {
|
||||
connect(action2, &QAction::triggered, this, []() {
|
||||
QMessageBox messageBox({}, "Action 2 triggered", "Action 2 has been triggered", QMessageBox::Ok);
|
||||
messageBox.exec();
|
||||
});
|
||||
|
||||
connect(action3, &QAction::triggered, this, [this]() {
|
||||
connect(action3, &QAction::triggered, this, []() {
|
||||
QMessageBox messageBox({}, "Action 3 triggered", "Action 3 has been triggered", QMessageBox::Ok);
|
||||
messageBox.exec();
|
||||
});
|
||||
|
||||
@@ -135,7 +135,7 @@ public:
|
||||
if (auto editContext = serializeContext->GetEditContext())
|
||||
{
|
||||
editContext->Class<SimpleKeyedContainer>("SimpleKeyContainer", "")
|
||||
->DataElement(0, &SimpleKeyedContainer::m_map, "map", "")
|
||||
->DataElement(nullptr, &SimpleKeyedContainer::m_map, "map", "")
|
||||
->ElementAttribute(AZ::Edit::Attributes::ShowAsKeyValuePairs, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
AzQtComponents::registerMetaTypes();
|
||||
}
|
||||
|
||||
virtual ~AzQtComponentsTestEnvironment() {}
|
||||
~AzQtComponentsTestEnvironment() override {}
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace AzQtComponents
|
||||
|
||||
private:
|
||||
QSize m_size;
|
||||
Eyedropper* m_owner;
|
||||
[[maybe_unused]] Eyedropper* m_owner;
|
||||
QScopedPointer<Internal> m_internal;
|
||||
};
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@ namespace AzQtComponents
|
||||
}
|
||||
|
||||
ScreenGrabber::ScreenGrabber(const QSize size, Eyedropper* parent /* = nullptr */)
|
||||
: QObject(static_cast<QObject*>(parent))
|
||||
: QObject(parent)
|
||||
, m_size(size)
|
||||
, m_owner(parent)
|
||||
{
|
||||
|
||||
@@ -146,6 +146,8 @@ set(FILES
|
||||
Components/Widgets/Eyedropper.h
|
||||
Components/Widgets/Eyedropper.cpp
|
||||
Components/Widgets/EyedropperConfig.ini
|
||||
Components/Widgets/FileDialog.cpp
|
||||
Components/Widgets/FileDialog.h
|
||||
Components/Widgets/FilteredSearchWidget.qss
|
||||
Components/Widgets/FilteredSearchWidgetConfig.ini
|
||||
Components/Widgets/GradientSlider.cpp
|
||||
|
||||
Reference in New Issue
Block a user