mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-16 13:20:33 +02:00
naming changes
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
// ---------- mainwindow.cpp ----------
|
// ---------- IntelliPhotoGui.cpp ----------
|
||||||
|
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
|
|
||||||
#include "mainwindow.h"
|
#include "IntelliPhotoGui.h"
|
||||||
#include "scribblearea.h"
|
#include "PaintingArea.h"
|
||||||
|
|
||||||
// MainWindow constructor
|
// IntelliPhotoGui constructor
|
||||||
MainWindow::MainWindow()
|
IntelliPhotoGui::IntelliPhotoGui()
|
||||||
{
|
{
|
||||||
//create Gui elemnts and lay them out
|
//create Gui elemnts and lay them out
|
||||||
createGui();
|
createGui();
|
||||||
@@ -23,7 +23,7 @@ MainWindow::MainWindow()
|
|||||||
|
|
||||||
|
|
||||||
// User tried to close the app
|
// User tried to close the app
|
||||||
void MainWindow::closeEvent(QCloseEvent *event)
|
void IntelliPhotoGui::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
// If they try to close maybeSave() returns true
|
// If they try to close maybeSave() returns true
|
||||||
// if no changes have been made and the app closes
|
// if no changes have been made and the app closes
|
||||||
@@ -38,7 +38,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
|||||||
|
|
||||||
// Check if the current image has been changed and then
|
// Check if the current image has been changed and then
|
||||||
// open a dialog to open a file
|
// open a dialog to open a file
|
||||||
void MainWindow::open()
|
void IntelliPhotoGui::open()
|
||||||
{
|
{
|
||||||
// Check if changes have been made since last save
|
// Check if changes have been made since last save
|
||||||
// maybeSave() returns true if no changes have been made
|
// maybeSave() returns true if no changes have been made
|
||||||
@@ -53,12 +53,12 @@ void MainWindow::open()
|
|||||||
// If we have a file name load the image and place
|
// If we have a file name load the image and place
|
||||||
// it in the scribbleArea
|
// it in the scribbleArea
|
||||||
if (!fileName.isEmpty())
|
if (!fileName.isEmpty())
|
||||||
scribbleArea->openImage(fileName);
|
paintingArea->openImage(fileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the user clicks Save As in the menu
|
// Called when the user clicks Save As in the menu
|
||||||
void MainWindow::save()
|
void IntelliPhotoGui::save()
|
||||||
{
|
{
|
||||||
// A QAction represents the action of the user clicking
|
// A QAction represents the action of the user clicking
|
||||||
QAction *action = qobject_cast<QAction *>(sender());
|
QAction *action = qobject_cast<QAction *>(sender());
|
||||||
@@ -71,18 +71,18 @@ void MainWindow::save()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Opens a dialog to change the pen color
|
// Opens a dialog to change the pen color
|
||||||
void MainWindow::penColor()
|
void IntelliPhotoGui::penColor()
|
||||||
{
|
{
|
||||||
// Store the chosen color from the dialog
|
// Store the chosen color from the dialog
|
||||||
QColor newColor = QColorDialog::getColor(scribbleArea->penColor());
|
QColor newColor = QColorDialog::getColor(paintingArea->penColor());
|
||||||
|
|
||||||
// If a valid color set it
|
// If a valid color set it
|
||||||
if (newColor.isValid())
|
if (newColor.isValid())
|
||||||
scribbleArea->setPenColor(newColor);
|
paintingArea->setPenColor(newColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Opens a dialog that allows the user to change the pen width
|
// Opens a dialog that allows the user to change the pen width
|
||||||
void MainWindow::penWidth()
|
void IntelliPhotoGui::penWidth()
|
||||||
{
|
{
|
||||||
// Stores button value
|
// Stores button value
|
||||||
bool ok;
|
bool ok;
|
||||||
@@ -91,28 +91,28 @@ void MainWindow::penWidth()
|
|||||||
// the next tr is the text to display
|
// the next tr is the text to display
|
||||||
// Get the current pen width
|
// Get the current pen width
|
||||||
// Define the min, max, step and ok button
|
// Define the min, max, step and ok button
|
||||||
int newWidth = QInputDialog::getInt(this, tr("Scribble"),
|
int newWidth = QInputDialog::getInt(this, tr("Painting"),
|
||||||
tr("Select pen width:"),
|
tr("Select pen width:"),
|
||||||
scribbleArea->penWidth(),
|
paintingArea->penWidth(),
|
||||||
1, 500, 1, &ok);
|
1, 500, 1, &ok);
|
||||||
// Change the pen width
|
// Change the pen width
|
||||||
if (ok)
|
if (ok)
|
||||||
scribbleArea->setPenWidth(newWidth);
|
paintingArea->setPenWidth(newWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open an about dialog
|
// Open an about dialog
|
||||||
void MainWindow::about()
|
void IntelliPhotoGui::about()
|
||||||
{
|
{
|
||||||
// Window title and text to display
|
// Window title and text to display
|
||||||
QMessageBox::about(this, tr("About Scribble"),
|
QMessageBox::about(this, tr("About Painting"),
|
||||||
tr("<p>The <b>Scribble</b> example is awesome</p>"));
|
tr("<p>The <b>Painting</b> example is awesome</p>"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define menu actions that call functions
|
// Define menu actions that call functions
|
||||||
void MainWindow::createActions()
|
void IntelliPhotoGui::createActions()
|
||||||
{
|
{
|
||||||
//connect signal and slots of gui element
|
//connect signal and slots of gui element
|
||||||
connect(this->clearButton, SIGNAL(clicked()), scribbleArea, SLOT(clearImage()));
|
connect(this->clearButton, SIGNAL(clicked()), paintingArea, SLOT(clearImage()));
|
||||||
|
|
||||||
// Create the action tied to the menu
|
// Create the action tied to the menu
|
||||||
openAct = new QAction(tr("&Open..."), this);
|
openAct = new QAction(tr("&Open..."), this);
|
||||||
@@ -120,7 +120,7 @@ void MainWindow::createActions()
|
|||||||
// Define the associated shortcut key
|
// Define the associated shortcut key
|
||||||
openAct->setShortcuts(QKeySequence::Open);
|
openAct->setShortcuts(QKeySequence::Open);
|
||||||
|
|
||||||
// Tie the action to MainWindow::open()
|
// Tie the action to IntelliPhotoGui::open()
|
||||||
connect(openAct, SIGNAL(triggered()), this, SLOT(open()));
|
connect(openAct, SIGNAL(triggered()), this, SLOT(open()));
|
||||||
|
|
||||||
// Get a list of the supported file formats
|
// Get a list of the supported file formats
|
||||||
@@ -134,7 +134,7 @@ void MainWindow::createActions()
|
|||||||
// Set an action for each file format
|
// Set an action for each file format
|
||||||
action->setData(format);
|
action->setData(format);
|
||||||
|
|
||||||
// When clicked call MainWindow::save()
|
// When clicked call IntelliPhotoGui::save()
|
||||||
connect(action, SIGNAL(triggered()), this, SLOT(save()));
|
connect(action, SIGNAL(triggered()), this, SLOT(save()));
|
||||||
|
|
||||||
// Attach each file format option menu item to Save As
|
// Attach each file format option menu item to Save As
|
||||||
@@ -142,36 +142,36 @@ void MainWindow::createActions()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Create exit action and tie to MainWindow::close()
|
// Create exit action and tie to IntelliPhotoGui::close()
|
||||||
exitAct = new QAction(tr("E&xit"), this);
|
exitAct = new QAction(tr("E&xit"), this);
|
||||||
exitAct->setShortcuts(QKeySequence::Quit);
|
exitAct->setShortcuts(QKeySequence::Quit);
|
||||||
connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
|
connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
|
||||||
|
|
||||||
// Create pen color action and tie to MainWindow::penColor()
|
// Create pen color action and tie to IntelliPhotoGui::penColor()
|
||||||
penColorAct = new QAction(tr("&Pen Color..."), this);
|
penColorAct = new QAction(tr("&Pen Color..."), this);
|
||||||
connect(penColorAct, SIGNAL(triggered()), this, SLOT(penColor()));
|
connect(penColorAct, SIGNAL(triggered()), this, SLOT(penColor()));
|
||||||
|
|
||||||
// Create pen width action and tie to MainWindow::penWidth()
|
// Create pen width action and tie to IntelliPhotoGui::penWidth()
|
||||||
penWidthAct = new QAction(tr("Pen &Width..."), this);
|
penWidthAct = new QAction(tr("Pen &Width..."), this);
|
||||||
connect(penWidthAct, SIGNAL(triggered()), this, SLOT(penWidth()));
|
connect(penWidthAct, SIGNAL(triggered()), this, SLOT(penWidth()));
|
||||||
|
|
||||||
// Create clear screen action and tie to MainWindow::clearImage()
|
// Create clear screen action and tie to IntelliPhotoGui::clearImage()
|
||||||
clearScreenAct = new QAction(tr("&Clear Screen"), this);
|
clearScreenAct = new QAction(tr("&Clear Screen"), this);
|
||||||
clearScreenAct->setShortcut(tr("Ctrl+L"));
|
clearScreenAct->setShortcut(tr("Ctrl+L"));
|
||||||
connect(clearScreenAct, SIGNAL(triggered()),
|
connect(clearScreenAct, SIGNAL(triggered()),
|
||||||
scribbleArea, SLOT(clearImage()));
|
paintingArea, SLOT(clearImage()));
|
||||||
|
|
||||||
// Create about action and tie to MainWindow::about()
|
// Create about action and tie to IntelliPhotoGui::about()
|
||||||
aboutAct = new QAction(tr("&About"), this);
|
aboutAct = new QAction(tr("&About"), this);
|
||||||
connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
|
connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
|
||||||
|
|
||||||
// Create about Qt action and tie to MainWindow::aboutQt()
|
// Create about Qt action and tie to IntelliPhotoGui::aboutQt()
|
||||||
aboutQtAct = new QAction(tr("About &Qt"), this);
|
aboutQtAct = new QAction(tr("About &Qt"), this);
|
||||||
connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
|
connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the menubar
|
// Create the menubar
|
||||||
void MainWindow::createMenus()
|
void IntelliPhotoGui::createMenus()
|
||||||
{
|
{
|
||||||
// Create Save As option and the list of file types
|
// Create Save As option and the list of file types
|
||||||
saveAsMenu = new QMenu(tr("&Save As"), this);
|
saveAsMenu = new QMenu(tr("&Save As"), this);
|
||||||
@@ -203,7 +203,7 @@ void MainWindow::createMenus()
|
|||||||
menuBar()->addMenu(helpMenu);
|
menuBar()->addMenu(helpMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::createGui(){
|
void IntelliPhotoGui::createGui(){
|
||||||
//create a central widget to work on
|
//create a central widget to work on
|
||||||
centralGuiWidget = new QWidget(this);
|
centralGuiWidget = new QWidget(this);
|
||||||
setCentralWidget(centralGuiWidget);
|
setCentralWidget(centralGuiWidget);
|
||||||
@@ -214,14 +214,14 @@ void MainWindow::createGui(){
|
|||||||
|
|
||||||
//create Gui elements
|
//create Gui elements
|
||||||
clearButton = new QPushButton("Clear");
|
clearButton = new QPushButton("Clear");
|
||||||
scribbleArea = new ScribbleArea();
|
paintingArea = new PaintingArea();
|
||||||
|
|
||||||
//set gui elemtns position
|
//set gui elemtns position
|
||||||
mainLayout->addWidget(scribbleArea,0,0,10,10);
|
mainLayout->addWidget(paintingArea,0,0,10,10);
|
||||||
mainLayout->addWidget(clearButton,0,10,1,1);
|
mainLayout->addWidget(clearButton,0,10,1,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::setIntelliStyle(){
|
void IntelliPhotoGui::setIntelliStyle(){
|
||||||
// Set the title
|
// Set the title
|
||||||
setWindowTitle("IntelliPhoto Prototype");
|
setWindowTitle("IntelliPhoto Prototype");
|
||||||
//set style sheet
|
//set style sheet
|
||||||
@@ -230,15 +230,15 @@ void MainWindow::setIntelliStyle(){
|
|||||||
this->menuBar()->setStyleSheet("color:rgb(255,255,255)");
|
this->menuBar()->setStyleSheet("color:rgb(255,255,255)");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::maybeSave()
|
bool IntelliPhotoGui::maybeSave()
|
||||||
{
|
{
|
||||||
// Check for changes since last save
|
// Check for changes since last save
|
||||||
if (scribbleArea->isModified()) {
|
if (paintingArea->isModified()) {
|
||||||
QMessageBox::StandardButton ret;
|
QMessageBox::StandardButton ret;
|
||||||
|
|
||||||
// Scribble is the title
|
// Scribble is the title
|
||||||
// Add text and the buttons
|
// Add text and the buttons
|
||||||
ret = QMessageBox::warning(this, tr("Scribble"),
|
ret = QMessageBox::warning(this, tr("Painting"),
|
||||||
tr("The image has been modified.\n"
|
tr("The image has been modified.\n"
|
||||||
"Do you want to save your changes?"),
|
"Do you want to save your changes?"),
|
||||||
QMessageBox::Save | QMessageBox::Discard
|
QMessageBox::Save | QMessageBox::Discard
|
||||||
@@ -256,7 +256,7 @@ bool MainWindow::maybeSave()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::saveFile(const QByteArray &fileFormat)
|
bool IntelliPhotoGui::saveFile(const QByteArray &fileFormat)
|
||||||
{
|
{
|
||||||
// Define path, name and default file type
|
// Define path, name and default file type
|
||||||
QString initialPath = QDir::currentPath() + "/untitled." + fileFormat;
|
QString initialPath = QDir::currentPath() + "/untitled." + fileFormat;
|
||||||
@@ -275,7 +275,7 @@ bool MainWindow::saveFile(const QByteArray &fileFormat)
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Call for the file to be saved
|
// Call for the file to be saved
|
||||||
return scribbleArea->saveImage(fileName, fileFormat.constData());
|
return paintingArea->saveImage(fileName, fileFormat.constData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef MAINWINDOW_H
|
#ifndef IntelliPhotoGui_H
|
||||||
#define MAINWINDOW_H
|
#define IntelliPhotoGui_H
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
@@ -7,9 +7,9 @@
|
|||||||
#include<QPushButton>
|
#include<QPushButton>
|
||||||
|
|
||||||
// ScribbleArea used to paint the image
|
// ScribbleArea used to paint the image
|
||||||
class ScribbleArea;
|
class PaintingArea;
|
||||||
|
|
||||||
class MainWindow : public QMainWindow
|
class IntelliPhotoGui : public QMainWindow
|
||||||
{
|
{
|
||||||
// Declares our class as a QObject which is the base class
|
// Declares our class as a QObject which is the base class
|
||||||
// for all Qt objects
|
// for all Qt objects
|
||||||
@@ -17,7 +17,7 @@ class MainWindow : public QMainWindow
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MainWindow();
|
IntelliPhotoGui();
|
||||||
protected:
|
protected:
|
||||||
// Function used to close an event
|
// Function used to close an event
|
||||||
void closeEvent(QCloseEvent *event) override;
|
void closeEvent(QCloseEvent *event) override;
|
||||||
@@ -48,7 +48,7 @@ private:
|
|||||||
bool saveFile(const QByteArray &fileFormat);
|
bool saveFile(const QByteArray &fileFormat);
|
||||||
|
|
||||||
// What we'll draw on
|
// What we'll draw on
|
||||||
ScribbleArea *scribbleArea;
|
PaintingArea *paintingArea;
|
||||||
|
|
||||||
// The menu widgets
|
// The menu widgets
|
||||||
QMenu *saveAsMenu;
|
QMenu *saveAsMenu;
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
// ---------- scribblearea.cpp ----------
|
// ---------- PaintingArea.cpp ----------
|
||||||
|
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#include "scribblearea.h"
|
#include "PaintingArea.h"
|
||||||
|
|
||||||
ScribbleArea::ScribbleArea(QWidget *parent)
|
PaintingArea::PaintingArea(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
// Roots the widget to the top left even if resized
|
// Roots the widget to the top left even if resized
|
||||||
@@ -17,7 +17,7 @@ ScribbleArea::ScribbleArea(QWidget *parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Used to load the image and place it in the widget
|
// Used to load the image and place it in the widget
|
||||||
bool ScribbleArea::openImage(const QString &fileName)
|
bool PaintingArea::openImage(const QString &fileName)
|
||||||
{
|
{
|
||||||
// Holds the image
|
// Holds the image
|
||||||
QImage loadedImage;
|
QImage loadedImage;
|
||||||
@@ -35,7 +35,7 @@ bool ScribbleArea::openImage(const QString &fileName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Save the current image
|
// Save the current image
|
||||||
bool ScribbleArea::saveImage(const QString &fileName, const char *fileFormat)
|
bool PaintingArea::saveImage(const QString &fileName, const char *fileFormat)
|
||||||
{
|
{
|
||||||
// Created to hold the image
|
// Created to hold the image
|
||||||
QImage visibleImage = image;
|
QImage visibleImage = image;
|
||||||
@@ -50,19 +50,19 @@ bool ScribbleArea::saveImage(const QString &fileName, const char *fileFormat)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Used to change the pen color
|
// Used to change the pen color
|
||||||
void ScribbleArea::setPenColor(const QColor &newColor)
|
void PaintingArea::setPenColor(const QColor &newColor)
|
||||||
{
|
{
|
||||||
myPenColor = newColor;
|
myPenColor = newColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used to change the pen width
|
// Used to change the pen width
|
||||||
void ScribbleArea::setPenWidth(int newWidth)
|
void PaintingArea::setPenWidth(int newWidth)
|
||||||
{
|
{
|
||||||
myPenWidth = newWidth;
|
myPenWidth = newWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Color the image area with white
|
// Color the image area with white
|
||||||
void ScribbleArea::clearImage()
|
void PaintingArea::clearImage()
|
||||||
{
|
{
|
||||||
image.fill(qRgb(255, 255, 255));
|
image.fill(qRgb(255, 255, 255));
|
||||||
modified = true;
|
modified = true;
|
||||||
@@ -72,7 +72,7 @@ void ScribbleArea::clearImage()
|
|||||||
// If a mouse button is pressed check if it was the
|
// If a mouse button is pressed check if it was the
|
||||||
// left button and if so store the current position
|
// left button and if so store the current position
|
||||||
// Set that we are currently drawing
|
// Set that we are currently drawing
|
||||||
void ScribbleArea::mousePressEvent(QMouseEvent *event)
|
void PaintingArea::mousePressEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (event->button() == Qt::LeftButton) {
|
if (event->button() == Qt::LeftButton) {
|
||||||
lastPoint = event->pos();
|
lastPoint = event->pos();
|
||||||
@@ -83,14 +83,14 @@ void ScribbleArea::mousePressEvent(QMouseEvent *event)
|
|||||||
// When the mouse moves if the left button is clicked
|
// When the mouse moves if the left button is clicked
|
||||||
// we call the drawline function which draws a line
|
// we call the drawline function which draws a line
|
||||||
// from the last position to the current
|
// from the last position to the current
|
||||||
void ScribbleArea::mouseMoveEvent(QMouseEvent *event)
|
void PaintingArea::mouseMoveEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if ((event->buttons() & Qt::LeftButton) && scribbling)
|
if ((event->buttons() & Qt::LeftButton) && scribbling)
|
||||||
drawLineTo(event->pos());
|
drawLineTo(event->pos());
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the button is released we set variables to stop drawing
|
// If the button is released we set variables to stop drawing
|
||||||
void ScribbleArea::mouseReleaseEvent(QMouseEvent *event)
|
void PaintingArea::mouseReleaseEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (event->button() == Qt::LeftButton && scribbling) {
|
if (event->button() == Qt::LeftButton && scribbling) {
|
||||||
drawLineTo(event->pos());
|
drawLineTo(event->pos());
|
||||||
@@ -101,7 +101,7 @@ void ScribbleArea::mouseReleaseEvent(QMouseEvent *event)
|
|||||||
// QPainter provides functions to draw on the widget
|
// QPainter provides functions to draw on the widget
|
||||||
// The QPaintEvent is sent to widgets that need to
|
// The QPaintEvent is sent to widgets that need to
|
||||||
// update themselves
|
// update themselves
|
||||||
void ScribbleArea::paintEvent(QPaintEvent *event)
|
void PaintingArea::paintEvent(QPaintEvent *event)
|
||||||
{
|
{
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ void ScribbleArea::paintEvent(QPaintEvent *event)
|
|||||||
|
|
||||||
// Resize the image to slightly larger then the main window
|
// Resize the image to slightly larger then the main window
|
||||||
// to cut down on the need to resize the image
|
// to cut down on the need to resize the image
|
||||||
void ScribbleArea::resizeEvent(QResizeEvent *event)
|
void PaintingArea::resizeEvent(QResizeEvent *event)
|
||||||
{
|
{
|
||||||
if (width() > image.width() || height() > image.height()) {
|
if (width() > image.width() || height() > image.height()) {
|
||||||
int newWidth = qMax(width() + 128, image.width());
|
int newWidth = qMax(width() + 128, image.width());
|
||||||
@@ -126,7 +126,7 @@ void ScribbleArea::resizeEvent(QResizeEvent *event)
|
|||||||
QWidget::resizeEvent(event);
|
QWidget::resizeEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScribbleArea::drawLineTo(const QPoint &endPoint)
|
void PaintingArea::drawLineTo(const QPoint &endPoint)
|
||||||
{
|
{
|
||||||
// Used to draw on the widget
|
// Used to draw on the widget
|
||||||
QPainter painter(&image);
|
QPainter painter(&image);
|
||||||
@@ -153,7 +153,7 @@ void ScribbleArea::drawLineTo(const QPoint &endPoint)
|
|||||||
|
|
||||||
// When the app is resized create a new image using
|
// When the app is resized create a new image using
|
||||||
// the changes made to the image
|
// the changes made to the image
|
||||||
void ScribbleArea::resizeImage(QImage *image, const QSize &newSize)
|
void PaintingArea::resizeImage(QImage *image, const QSize &newSize)
|
||||||
{
|
{
|
||||||
// Check if we need to redraw the image
|
// Check if we need to redraw the image
|
||||||
if (image->size() == newSize)
|
if (image->size() == newSize)
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
// ---------- scribblearea.h ----------
|
// ---------- PaintingArea.h ----------
|
||||||
|
|
||||||
#ifndef SCRIBBLEAREA_H
|
#ifndef SCRIBBLEAREA_H
|
||||||
#define SCRIBBLEAREA_H
|
#define SCRIBBLEAREA_H
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
class ScribbleArea : public QWidget
|
class PaintingArea : public QWidget
|
||||||
{
|
{
|
||||||
// Declares our class as a QObject which is the base class
|
// Declares our class as a QObject which is the base class
|
||||||
// for all Qt objects
|
// for all Qt objects
|
||||||
@@ -16,7 +16,7 @@ class ScribbleArea : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ScribbleArea(QWidget *parent = nullptr);
|
PaintingArea(QWidget *parent = nullptr);
|
||||||
|
|
||||||
// Handles all events
|
// Handles all events
|
||||||
bool openImage(const QString &fileName);
|
bool openImage(const QString &fileName);
|
||||||
@@ -16,13 +16,13 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
|||||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
main.cpp \
|
IntelliPhotoGui.cpp \
|
||||||
mainwindow.cpp \
|
PaintingArea.cpp \
|
||||||
scribblearea.cpp
|
main.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
mainwindow.h \
|
IntelliPhotoGui.h \
|
||||||
scribblearea.h
|
PaintingArea.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
widget.ui
|
widget.ui
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!DOCTYPE QtCreatorProject>
|
||||||
<!-- Written by QtCreator 4.10.2, 2019-11-21T11:35:08. -->
|
<!-- Written by QtCreator 4.10.2, 2019-11-21T13:26:30. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>EnvironmentId</variable>
|
<variable>EnvironmentId</variable>
|
||||||
@@ -306,8 +306,8 @@
|
|||||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Scribble</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Scribble</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Scribble2</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/Users/jonas/OneDrive/Desktop/Scribble/Scribble.pro</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/Users/jonas/OneDrive/Documents/GitHub/intelliphoto/IntelliPhoto/Scribble/Scribble.pro</value>
|
||||||
<value type="QString" key="RunConfiguration.Arguments"></value>
|
<value type="QString" key="RunConfiguration.Arguments"></value>
|
||||||
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
// ---------- main.cpp ----------
|
// ---------- main.cpp ----------
|
||||||
|
|
||||||
#include "mainwindow.h"
|
#include "IntelliPhotoGui.h"
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
@@ -13,7 +13,7 @@ int main(int argc, char *argv[])
|
|||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
// Create and open the main window
|
// Create and open the main window
|
||||||
MainWindow window;
|
IntelliPhotoGui window;
|
||||||
window.show();
|
window.show();
|
||||||
|
|
||||||
// Display the main window
|
// Display the main window
|
||||||
|
|||||||
Reference in New Issue
Block a user