Skip to content

Commit

Permalink
Add backdrop picker
Browse files Browse the repository at this point in the history
The backdrop picker has been added now.
  • Loading branch information
rueter37 committed Nov 30, 2021
1 parent a90d338 commit a156eb2
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ set(EDITOR_SOURCES
src/ui/picker/picker_audio_widget.cpp
src/ui/picker/picker_audio_widget.h
src/ui/picker/picker_audio_widget.ui
src/ui/picker/picker_backdrop_widget.cpp
src/ui/picker/picker_backdrop_widget.h
src/ui/picker/picker_child_widget.cpp
src/ui/picker/picker_child_widget.h
src/ui/picker/picker_charset_widget.cpp
Expand Down
29 changes: 29 additions & 0 deletions src/ui/picker/picker_backdrop_widget.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* This file is part of EasyRPG Editor.
*
* EasyRPG Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EasyRPG Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EasyRPG Editor. If not, see <http://www.gnu.org/licenses/>.
*/

#include "picker_backdrop_widget.h"
#include "ui/viewer/rpg_graphics_view.h"
#include <QGraphicsScene>

void PickerBackdropWidget::imageChanged(QPixmap image) {
if (!m_pixmap) {
m_pixmap = new QGraphicsPixmapItem(image);
}

m_pixmap->setPixmap(image);
m_view->setItem(m_pixmap);
}
35 changes: 35 additions & 0 deletions src/ui/picker/picker_backdrop_widget.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* This file is part of EasyRPG Editor.
*
* EasyRPG Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EasyRPG Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EasyRPG Editor. If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#include <QWidget>
#include "picker_child_widget.h"

class QGraphicsScene;
class QGraphicsPixmapItem;

class PickerBackdropWidget : public PickerChildWidget {
Q_OBJECT
public:
PickerBackdropWidget(QWidget* parent = nullptr) : PickerChildWidget(parent) {}

void imageChanged(QPixmap image) override;

private:
QGraphicsPixmapItem* m_pixmap = nullptr;
};

0 comments on commit a156eb2

Please sign in to comment.