Skip to content
Snippets Groups Projects
Commit 5ab2a776 authored by BIOUD Youcef's avatar BIOUD Youcef
Browse files

Merge branch 'dev' into 'youcef'

Dev

See merge request !1
parents a4d99bf0 d25b3f58
No related branches found
No related tags found
1 merge request!1Dev
Showing
with 661 additions and 22 deletions
QT += core gui
QT += core gui quickcontrols2
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
......@@ -9,11 +9,38 @@ CONFIG += c++17
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
colorpickerwidget.cpp \
main.cpp \
mainwindow.cpp
mainwindow.cpp \
tools/editable.cpp \
tools/hand.cpp \
tools/selectionnable.cpp \
tools/tool.cpp \
ui/files/treefileselector.cpp \
ui/menu/displaymenulambda.cpp \
ui/menu/filemenulambda.cpp \
ui/menu/menubarmanager.cpp \
ui/toolbox/toolRegister.cpp \
ui/view/imagearea.cpp \
ui/view/selection.cpp \
ui/view/viewmanager.cpp
HEADERS += \
mainwindow.h
colorpickerwidget.h \
mainwindow.h \
tools/editable.h \
tools/hand.h \
tools/selectionnable.h \
tools/tool.h \
ui/files/fileselector.h \
ui/files/treefileselector.h \
ui/menu/displaymenulambda.h \
ui/menu/filemenulambda.h \
ui/menu/menubarmanager.h \
ui/toolbox/toolRegister.h \
ui/view/imagearea.h \
ui/view/selection.h \
ui/view/viewmanager.h
FORMS += \
mainwindow.ui
......@@ -22,3 +49,10 @@ FORMS += \
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
RESOURCES += \
ressource.qrc
DISTFILES += \
ui/Nouveau document texte.txt \
ui/Nouveau document texte.txt
#include "colorpickerwidget.h"
#include <QColorDialog>
#include <QListWidget>
#include <QListWidgetItem>
#include <QVBoxLayout>
#include <QPushButton>
#include <QPushButton>
#include <QKeyEvent>
ColorPickerWidget::ColorPickerWidget(QWidget *parent)
: QWidget(parent) {
QVBoxLayout *layout = new QVBoxLayout(this);
colorListWidget = new QListWidget(this);
layout->addWidget(colorListWidget);
QPushButton *addColorButton = new QPushButton("Add Color", this);
connect(addColorButton, &QPushButton::clicked, this, &ColorPickerWidget::addColor);
layout->addWidget(addColorButton);
QPushButton *pickColorButton = new QPushButton("Pick Color", this);
connect(pickColorButton, &QPushButton::clicked, this, &ColorPickerWidget::pickColor);
layout->addWidget(pickColorButton);
}
void ColorPickerWidget::addColor() {
QColor color = QColorDialog::getColor(Qt::white, this, "Select Color");
if (color.isValid()) {
QListWidgetItem *item = new QListWidgetItem(colorListWidget);
item->setBackground(QBrush(color));
}
}
void ColorPickerWidget::pickColor() {
QListWidgetItem *selectedItem = colorListWidget->currentItem();
if (selectedItem) {
QColor color = QColorDialog::getColor(selectedItem->background().color(), this, "Pick Color");
if (color.isValid()) {
selectedItem->setBackground(QBrush(color));
}
}
}
#ifndef COLORPICKERWIDGET_H
#define COLORPICKERWIDGET_H
#include <QColorDialog>
#include <QListWidget>
#include <QListWidgetItem>
#include <QVBoxLayout>
#include <QPushButton>
class ColorPickerWidget : public QWidget {
Q_OBJECT
public:
ColorPickerWidget(QWidget *parent = nullptr);
private slots:
void addColor();
void pickColor();
private:
QListWidget *colorListWidget;
};
#endif // COLORPICKERWIDGET_H
#include "mainwindow.h"
#include <QApplication>
#include <QQuickStyle>
#include <QFile>
#include <colorpickerwidget.h>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
QString getStyleSheet(const QString & path) {
QFile file(path);
file.open(QFile::ReadOnly);
return QLatin1String(file.readAll());
}
int main(int argc, char *argv[]) {
QApplication application(argc, argv);
application.setStyleSheet(getStyleSheet(":/stylesheet/ressource/stylesheet/QTDark.css"));
MainWindow window;
window.show();
return application.exec();
}
#include "mainwindow.h"
#include <QApplication>
#include <QMimeData>
#include <QColorDialog>
#include <QListWidget>
#include <QListWidgetItem>
#include <QVBoxLayout>
#include <QPushButton>
#include <colorpickerwidget.h>
#include <ui/menu/filemenulambda.h>
#include <ui/menu/displaymenulambda.h>
#include <ui/files/treefileselector.h>
#include <tools/hand.h>
MainWindow::MainWindow(QWidget * parent)
: QMainWindow(parent)
{
setupUi(this);
: QMainWindow(parent), _toolRegister(), _fileselectorManager(nullptr), _viewManager(nullptr) {
this->setupUi(this);
this->setAcceptDrops(true);
this->_imageTabs->clear();
qDebug() << "Mark_1";
this->_fileselectorManager = new ui::TreeFileSelector(this->_filesSelector, this->_filesSelected, this);
QObject::connect(this->_remove_selectable_element, SIGNAL(released()), this->_fileselectorManager, SLOT(removeSelectedItem()));
QObject::connect(this->_add_selectable_element, SIGNAL(released()), this->_fileselectorManager, SLOT(pushItem()));
ColorWindow = findChild<QPushButton*>("ColorWindow");
// Connect the button's clicked signal to the openColorPicker slot
connect(ColorWindow, &QPushButton::clicked, this, &MainWindow::openColorPicker);
// Create an action for Ctrl+C
ctrlCAction = new QAction(this);
ctrlCAction->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_C)); // Change the shortcut
connect(ctrlCAction, &QAction::triggered, this, &MainWindow::handleCtrlCKey);
addAction(ctrlCAction);
qDebug() << "Mark_2";
this->_viewManager = new ui::ViewManager(this->_fileselectorManager, this->_imageTabs);
qDebug() << "Mark_3";
this->_toolRegister.setToolbox(this->_toolbox);
this->_toolRegister.setViewManager(this->_viewManager);
this->_toolRegister.push_back(QSharedPointer<tool::Tool>(new tool::Hand()));
this->_toolRegister.update();
qDebug() << "Mark_4";
this->_menubarManager.insert(this->_menuFile, QSharedPointer<ui::MenuLambda>(new ui::FilemenuLambda(this->_fileselectorManager, this->_viewManager)));
this->_menubarManager.insert(this->_menuAffichage, QSharedPointer<ui::MenuLambda>(new ui::DisplayMenuLambda(this->_viewManager)));
this->_menubarManager.update();
qDebug() << "Mark_5";
}
MainWindow::~MainWindow()
void MainWindow::dragEnterEvent(QDragEnterEvent *e) {
if(e->mimeData()->hasUrls()) {
e->acceptProposedAction();
}
}
void MainWindow::dropEvent(QDropEvent * e) {
this->_fileselectorManager->onDrop(e);
}
void MainWindow::openColorPicker()
{
colorPickerWidget.show();
}
void MainWindow::handleCtrlCKey()
{
// Trigger the ColorWindow button when Ctrl+C is pressed
openColorPicker();
}
MainWindow::~MainWindow() {
delete this->_fileselectorManager;
delete this->_viewManager;
}
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#pragma once
#include "ui_mainwindow.h"
#include <QMainWindow>
#include <QPointer>
class MainWindow : public QMainWindow, private Ui::MainWindow
{
#include "ui/toolbox/toolRegister.h"
#include "ui/menu/menubarmanager.h"
#include "ui/files/fileselector.h"
#include "ui/view/viewmanager.h"
#include <colorpickerwidget.h>
class QAction;
class MainWindow : public QMainWindow, private Ui::MainWindow {
Q_OBJECT
private:
ui::ToolboxRegister _toolRegister;
ui::MenubarManager _menubarManager;
ui::FileSelector * _fileselectorManager;
ui::ViewManager * _viewManager;
public:
MainWindow(QWidget * parent = nullptr);
~MainWindow();
virtual void dropEvent(QDropEvent * e);
virtual void dragEnterEvent(QDragEnterEvent *e);
private slots:
void openColorPicker(); // Slot to open the ColorPickerWidget
void handleCtrlCKey(); // New slot for Ctrl+C
private:
ColorPickerWidget colorPickerWidget; // Declare ColorPickerWidget as a private member
QPushButton *ColorWindow; // Assuming you have a QPushButton in your UI
QAction *ctrlCAction; // New QAction for Ctrl+C
};
#endif // MAINWINDOW_H
This diff is collapsed.
IHM_Retouche_Photo/ressource/image/oxygen/icons/16x16/accessories-text-editor.png

946 B

IHM_Retouche_Photo/ressource/image/oxygen/icons/16x16/align-horizontal-center.png

441 B

IHM_Retouche_Photo/ressource/image/oxygen/icons/16x16/align-none.png

369 B

IHM_Retouche_Photo/ressource/image/oxygen/icons/16x16/align-vertical-center.png

484 B

IHM_Retouche_Photo/ressource/image/oxygen/icons/16x16/application-exit.png

842 B

IHM_Retouche_Photo/ressource/image/oxygen/icons/16x16/application-pgp-encrypted.png

650 B

IHM_Retouche_Photo/ressource/image/oxygen/icons/16x16/application-pgp-keys.png

844 B

IHM_Retouche_Photo/ressource/image/oxygen/icons/16x16/application-pgp-signature.png

1.27 KiB

IHM_Retouche_Photo/ressource/image/oxygen/icons/16x16/application-vnd.iccprofile.png

741 B

IHM_Retouche_Photo/ressource/image/oxygen/icons/16x16/application-x-desktop.png

858 B

IHM_Retouche_Photo/ressource/image/oxygen/icons/16x16/application-x-egon.png

659 B

IHM_Retouche_Photo/ressource/image/oxygen/icons/16x16/application-x-font-afm.png

642 B

IHM_Retouche_Photo/ressource/image/oxygen/icons/16x16/application-x-font-bdf.png

608 B

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment