-
Notifications
You must be signed in to change notification settings - Fork 2
/
editmacro.cpp
34 lines (24 loc) · 942 Bytes
/
editmacro.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "editmacro.h"
#include "ui_editmacro.h"
#include <QGraphicsPixmapItem>
EditMacro::EditMacro(GameMacro *macro, QWidget *parent) :
QDialog(parent),
ui(new Ui::EditMacro), macro(macro) {
ui->setupUi(this);
scene = new QGraphicsScene();
scene->addItem(new QGraphicsPixmapItem(QPixmap::fromImage(getIconsImage())));
ui->graphicsView->setScene(scene);
ui->graphicsView->setBackgroundBrush(QBrush(QColor(0, 174, 255)));
ui->graphicsView->parseIconMetadata();
ui->graphicsView->setCurrentIcon(macro->getIcon());
ui->lineEdit_name->setText(macro->getName());
QString macroContents = macro->getContents();
macroContents = macroContents.replace(";", ";\n");
ui->plainTextEdit_contents->appendPlainText(macroContents);
}
EditMacro::~EditMacro() {
delete ui;
}
QImage EditMacro::getIconsImage() {
return QImage(":/img/ui_rebel_icons.png");
}