diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyColorCtrl.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyColorCtrl.cpp index 13c5c8bfac..3562c8ff11 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyColorCtrl.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyColorCtrl.cpp @@ -19,8 +19,6 @@ AZ_PUSH_DISABLE_WARNING(4251, "-Wunknown-warning-option") AZ_POP_DISABLE_WARNING #include -#include "../UICore/ColorPickerDelegate.hxx" - namespace AzToolsFramework { PropertyColorCtrl::PropertyColorCtrl(QWidget* pParent) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/UICore/ColorPickerDelegate.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/UICore/ColorPickerDelegate.cpp deleted file mode 100644 index ca5e89f6f1..0000000000 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/UICore/ColorPickerDelegate.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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 -#include "ColorPickerDelegate.hxx" - -#include -#include - -namespace AzToolsFramework -{ - ColorPickerDelegate::ColorPickerDelegate(QObject* pParent) - : QStyledItemDelegate(pParent) - { - } - - QWidget* ColorPickerDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const - { - (void)index; - (void)option; - AzQtComponents::ColorPicker* ptrDialog = new AzQtComponents::ColorPicker(AzQtComponents::ColorPicker::Configuration::RGB, - tr("Select Color"), parent); - ptrDialog->setWindowFlags(Qt::Tool); - return ptrDialog; - } - - void ColorPickerDelegate::setEditorData(QWidget* editor, const QModelIndex& index) const - { - AzQtComponents::ColorPicker* colorEditor = qobject_cast(editor); - - if (!editor) - { - return; - } - - QVariant colorResult = index.data(COLOR_PICKER_ROLE); - if (colorResult == QVariant()) - { - return; - } - - const QColor pickedColor = qvariant_cast(colorResult); - colorEditor->setCurrentColor(AzQtComponents::fromQColor(pickedColor)); - } - - void ColorPickerDelegate::setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const - { - AzQtComponents::ColorPicker* colorEditor = qobject_cast(editor); - - if (!editor) - { - return; - } - - const QVariant colorVariant = AzQtComponents::toQColor(colorEditor->currentColor()); - model->setData(index, colorVariant, COLOR_PICKER_ROLE); - } - - void ColorPickerDelegate::updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index) const - { - (void)index; - QRect pickerpos = option.rect; - - pickerpos.setTopLeft(editor->parentWidget()->mapToGlobal(pickerpos.topLeft())); - pickerpos.adjust(64, 0, 0, 0); - editor->setGeometry(pickerpos); - } - -} // namespace AzToolsFramework - -#include "UI/UICore/moc_ColorPickerDelegate.cpp" diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/UICore/ColorPickerDelegate.hxx b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/UICore/ColorPickerDelegate.hxx deleted file mode 100644 index 7bb5cd25e2..0000000000 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/UICore/ColorPickerDelegate.hxx +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 - * - */ - -#ifndef COLOR_PICKER_DELEGATE_HXX -#define COLOR_PICKER_DELEGATE_HXX - -#if !defined(Q_MOC_RUN) -#include -#include -#endif - -#pragma once - -namespace AzToolsFramework -{ - /** - * A delegate which handles the double clicking to pop open a color picker dialog, as long as the role is COLOR_PICKER_ROLE. - * To use it, just add a setData() and a data() function to your model which returns a QColor (or accepts one) whenever the COLOR_PICKER_ROLE is queried. - **/ - class ColorPickerDelegate - : public QStyledItemDelegate - { - Q_OBJECT; - public: - static const int COLOR_PICKER_ROLE = Qt::UserRole + 1; - - AZ_CLASS_ALLOCATOR(ColorPickerDelegate, AZ::SystemAllocator, 0); - ColorPickerDelegate(QObject* pParent); - virtual QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const; - virtual void setEditorData(QWidget* editor, const QModelIndex& index) const; - virtual void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const; - virtual void updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index) const; - }; -} // namespace AzToolsFramework - -#endif //COLOR_PICKER_DELEGATE_HXX diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/aztoolsframework_files.cmake b/Code/Framework/AzToolsFramework/AzToolsFramework/aztoolsframework_files.cmake index 24963d24c0..a21885f058 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/aztoolsframework_files.cmake +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/aztoolsframework_files.cmake @@ -444,8 +444,6 @@ set(FILES UI/Slice/SliceRelationshipWidget.hxx UI/UICore/AspectRatioAwarePixmapWidget.hxx UI/UICore/AspectRatioAwarePixmapWidget.cpp - UI/UICore/ColorPickerDelegate.hxx - UI/UICore/ColorPickerDelegate.cpp UI/UICore/ClickableLabel.hxx UI/UICore/ClickableLabel.cpp UI/UICore/IconButton.hxx