-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
image panel now shows an image, added mantises for testing
- Loading branch information
Ian Wrzesinski
committed
Jun 23, 2020
1 parent
1952f8e
commit cb17f3e
Showing
15 changed files
with
166 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include "./imagearea.hpp" | ||
|
||
#include <QPainter> | ||
#include <QTextStream> | ||
|
||
namespace editor{ | ||
namespace image { | ||
|
||
QTextStream out3(stdout); | ||
|
||
image_area::image_area(QWidget* parent) : QWidget(parent) { | ||
|
||
} | ||
|
||
void image_area::load_image(QString filename) { | ||
out3 << "loading" << Qt::endl; | ||
if(img.load(filename)) | ||
out3 << "loaded" << Qt::endl; | ||
else | ||
out3 << "failed" << Qt::endl; | ||
|
||
} | ||
|
||
QSize image_area::sizeHint() const { | ||
out3 << "sizehint" << Qt::endl; | ||
return img.size(); | ||
} | ||
|
||
void image_area::paintEvent(QPaintEvent *) { | ||
// out3 << "paitevent" << Qt::endl; | ||
QPainter painter(this); | ||
painter.drawImage(img.rect(), img); | ||
} | ||
|
||
|
||
|
||
} // image | ||
} // editor | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#pragma once | ||
|
||
#include <QWidget> | ||
#include <QPaintEvent> | ||
#include <QImage> | ||
|
||
namespace editor{ | ||
namespace image { | ||
|
||
class image_area : public QWidget { | ||
Q_OBJECT | ||
|
||
public: | ||
image_area(QWidget* parent); | ||
|
||
void load_image(QString filename); | ||
|
||
QSize sizeHint() const override; | ||
|
||
protected: | ||
void paintEvent(QPaintEvent *) override; | ||
|
||
private: | ||
QImage img; | ||
|
||
}; // image_panel | ||
|
||
} // image | ||
} // editor | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,25 @@ | ||
#include "./imagepanel.hpp" | ||
|
||
#include <QVBoxLayout> | ||
#include <QLabel> | ||
#include <QPixmap> | ||
|
||
#include <QTextStream> | ||
|
||
namespace editor{ | ||
namespace image { | ||
|
||
QTextStream out2(stdout); | ||
|
||
image_panel::image_panel(QWidget* parent) : QWidget(parent) { | ||
img_area = new image_area(this); | ||
img_area->load_image("../data/mantis300.jpg"); | ||
|
||
QVBoxLayout *vbox = new QVBoxLayout; | ||
vbox->addWidget(img_area); | ||
setLayout(vbox); | ||
} | ||
|
||
|
||
} // image | ||
} // editor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,23 @@ | ||
#pragma once | ||
|
||
#include "./imagearea.hpp" | ||
|
||
#include <QWidget> | ||
#include <QString> | ||
|
||
namespace editor::image { | ||
namespace editor{ | ||
namespace image { | ||
|
||
class image_panel : public QWidget { | ||
Q_OBJECT | ||
|
||
public: | ||
image_panel(QWidget* parent); | ||
|
||
private: | ||
image_area *img_area; | ||
|
||
}; // image_panel | ||
|
||
} // editor::image | ||
|
||
} // image | ||
} // editor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,28 @@ | ||
#include "./mainwindow.hpp" | ||
#include "image/imagepanel.hpp" | ||
#include "tools/toolpanel.hpp" | ||
|
||
#include <QGridLayout> | ||
|
||
#include <QTextStream> | ||
QTextStream out1(stdout); | ||
|
||
editor::main_window::main_window() { | ||
setWindowTitle("color editor"); | ||
|
||
// initialization | ||
image_pan = new editor::image::image_panel(this); | ||
//image_pan->load_image("../data/mantis300.jpg"); | ||
color_pan = new editor::tools::tool_panel(this, editor::tools::color); | ||
select_pan = new editor::tools::tool_panel(this, editor::tools::select); | ||
|
||
// connections | ||
|
||
|
||
// layout stuff | ||
QGridLayout *grid = new QGridLayout; | ||
grid->addWidget(image_pan, 0, 0, 2, 1); | ||
grid->addWidget(color_pan, 1, 0); | ||
grid->addWidget(select_pan, 1, 1); | ||
setLayout(grid); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
#include "./toolpanel.hpp" | ||
|
||
editor::tools::tool_panel::tool_panel(QWidget *parent, tool_type type) | ||
: QWidget(parent) { | ||
if (type == editor::tools::select) | ||
return; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters