Its fullscreen again and it works on i3 too
This commit is contained in:
parent
53a21bb2f1
commit
f5d8ef6885
@ -18,9 +18,10 @@ CropEditor::CropEditor(QPixmap *image, QObject *parent) : QObject(parent) {
|
|||||||
pixmapItem->setScale(1 / ratio);
|
pixmapItem->setScale(1 / ratio);
|
||||||
scene->addItem(pixmapItem);
|
scene->addItem(pixmapItem);
|
||||||
scene->setSceneRect(image->rect());
|
scene->setSceneRect(image->rect());
|
||||||
view->show();
|
// view->show();
|
||||||
view->resize(pixmapItem->pixmap().width(), pixmapItem->pixmap().height());
|
// view->resize(pixmapItem->pixmap().width(), pixmapItem->pixmap().height());
|
||||||
view->move(0, 0);
|
// view->move(0, 0);
|
||||||
|
view->showFullScreen();
|
||||||
|
|
||||||
connect(scene, &CropScene::closedWithRect, this, &CropEditor::crop);
|
connect(scene, &CropScene::closedWithRect, this, &CropEditor::crop);
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,11 @@ CropScene::CropScene(QObject *parent, QPixmap *pixmap)
|
|||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
display = menu.addAction(drawingName);
|
display = menu.addAction(drawingName);
|
||||||
display->setDisabled(true);
|
display->setDisabled(true);
|
||||||
connect(settings, &QAction::triggered, [&] { BrushPenSelection(this).exec(); });
|
connect(settings, &QAction::triggered, [&] {
|
||||||
|
hide();
|
||||||
|
BrushPenSelection(this).exec();
|
||||||
|
show();
|
||||||
|
});
|
||||||
menu.addAction(settings);
|
menu.addAction(settings);
|
||||||
|
|
||||||
magnifier = addPixmap(pixmap->copy(0, 0, 11, 11).scaled(110, 110));
|
magnifier = addPixmap(pixmap->copy(0, 0, 11, 11).scaled(110, 110));
|
||||||
@ -118,10 +122,28 @@ void CropScene::setDrawingSelection(QString name, std::function<DrawItem *()> dr
|
|||||||
if (!drawingSelection->init(this)) setDrawingSelection("None", [] { return nullptr; });
|
if (!drawingSelection->init(this)) setDrawingSelection("None", [] { return nullptr; });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CropScene::hide() {
|
||||||
|
setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CropScene::show() {
|
||||||
|
setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CropScene::setVisible(bool visible) {
|
||||||
|
for (auto view : views()) {
|
||||||
|
if (view->isVisible()) fullscreen |= view->isFullScreen();
|
||||||
|
view->setVisible(visible);
|
||||||
|
if (visible && fullscreen) view->showFullScreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CropScene::fontAsk() {
|
void CropScene::fontAsk() {
|
||||||
|
hide();
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
QFont font = QFontDialog::getFont(&ok, this->font(), nullptr, "Font to use");
|
QFont font = QFontDialog::getFont(&ok, this->font(), nullptr, "Font to use");
|
||||||
if (ok) _font = font;
|
if (ok) _font = font;
|
||||||
|
show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CropScene::mouseMoveEvent(QGraphicsSceneMouseEvent *e) {
|
void CropScene::mouseMoveEvent(QGraphicsSceneMouseEvent *e) {
|
||||||
|
@ -31,6 +31,9 @@ public:
|
|||||||
QGraphicsRectItem *selRect() {
|
QGraphicsRectItem *selRect() {
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
void hide();
|
||||||
|
void show();
|
||||||
|
void setVisible(bool visible);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void fontAsk();
|
void fontAsk();
|
||||||
@ -52,6 +55,7 @@ private:
|
|||||||
void initMagnifierGrid();
|
void initMagnifierGrid();
|
||||||
void addDrawingAction(QMenu &menu, QString name, std::function<DrawItem *()> item);
|
void addDrawingAction(QMenu &menu, QString name, std::function<DrawItem *()> item);
|
||||||
void done();
|
void done();
|
||||||
|
bool fullscreen;
|
||||||
std::function<DrawItem *()> drawingSelectionMaker;
|
std::function<DrawItem *()> drawingSelectionMaker;
|
||||||
QFlags<Qt::MouseButton> prevButtons;
|
QFlags<Qt::MouseButton> prevButtons;
|
||||||
QPixmap *_pixmap;
|
QPixmap *_pixmap;
|
||||||
|
@ -2,9 +2,11 @@
|
|||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
#include <QtMath>
|
#include <QtMath>
|
||||||
|
|
||||||
bool TextItem::init(CropScene *) {
|
bool TextItem::init(CropScene *s) {
|
||||||
bool ok;
|
bool ok;
|
||||||
|
s->hide();
|
||||||
text = QInputDialog::getText(nullptr, "Text to add", "Input", QLineEdit::Normal, QString(), &ok);
|
text = QInputDialog::getText(nullptr, "Text to add", "Input", QLineEdit::Normal, QString(), &ok);
|
||||||
|
s->show();
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
class TextItem : public DrawItem {
|
class TextItem : public DrawItem {
|
||||||
public:
|
public:
|
||||||
QString name() override;
|
QString name() override;
|
||||||
bool init(CropScene *) override;
|
bool init(CropScene *s) override;
|
||||||
void mouseDragEvent(QGraphicsSceneMouseEvent *e, CropScene *scene) override;
|
void mouseDragEvent(QGraphicsSceneMouseEvent *e, CropScene *scene) override;
|
||||||
void mouseDragEndEvent(QGraphicsSceneMouseEvent *, CropScene *) override;
|
void mouseDragEndEvent(QGraphicsSceneMouseEvent *, CropScene *) override;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user