code format

This commit is contained in:
2022-12-14 14:14:33 +03:00
parent 09e5342956
commit cdb02fc9be
278 changed files with 15371 additions and 12176 deletions

View File

@@ -1,47 +1,48 @@
/*
QAD - Qt ADvanced
QAD - Qt ADvanced
Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru
Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DRAWTOOLS_H
#define DRAWTOOLS_H
#include <QObject>
#include <QAction>
#include <QFontDialog>
#include <QToolButton>
#include <QPlainTextEdit>
#include <QMenu>
#include "blockview.h"
#include "qad_blockview_export.h"
#include <QAction>
#include <QFontDialog>
#include <QMenu>
#include <QObject>
#include <QPlainTextEdit>
#include <QToolButton>
class QComboBox;
class QAD_BLOCKVIEW_EXPORT _DTSizeItem: public QGraphicsObject
{
class QAD_BLOCKVIEW_EXPORT _DTSizeItem: public QGraphicsObject {
Q_OBJECT
public:
_DTSizeItem();
~_DTSizeItem();
void assignObject(QGraphicsItem * item);
protected:
void moveRects();
void applyRect();
@@ -51,7 +52,7 @@ protected:
QRectF boundingRect() const;
void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0) {}
bool sceneEventFilter(QGraphicsItem * watched, QEvent * event);
QGraphicsItem * cur_item;
QGraphicsView * view_;
QGraphicsRectItem rects[8];
@@ -59,55 +60,56 @@ protected:
QRectF nrect;
qreal grid;
bool in_process, can_drag, is_line;
signals:
void sizeChanged();
void textEditRequest();
void pixmapEditRequest();
};
namespace Ui {
class DrawTools;
class DrawTools;
}
class QAD_BLOCKVIEW_EXPORT DrawTools: public QWidget
{
class QAD_BLOCKVIEW_EXPORT DrawTools: public QWidget {
Q_OBJECT
Q_PROPERTY(bool resizeHandlesEnabled READ isResizeHandlesEnabled WRITE setResizeHandlesEnabled)
public:
explicit DrawTools(BlockView * parent = 0);
~DrawTools();
void setBlockView(BlockView * v);
void resetSizeTool() {size_item.assignObject(0);}
bool isResizeHandlesEnabled() const {return resize_enabled;}
void resetSizeTool() { size_item.assignObject(0); }
bool isResizeHandlesEnabled() const { return resize_enabled; }
void setAlignCompact(bool yes);
QComboBox * textEditCombo() const;
QList<QAction * > actionsForAdd() const {return actions_add;}
QList<QAction * > actionsForZ() const {return QList<QAction * >() << &actions_Z_bottom << &actions_Z_down << &actions_Z_up << &actions_Z_top;}
QWidget * propertyWidget() const {return widget_props;}
QList<QAction *> actionsForAdd() const { return actions_add; }
QList<QAction *> actionsForZ() const {
return QList<QAction *>() << &actions_Z_bottom << &actions_Z_down << &actions_Z_up << &actions_Z_top;
}
QWidget * propertyWidget() const { return widget_props; }
protected:
bool eventFilter(QObject * o, QEvent * e);
void changeEvent(QEvent * e);
QAction * newAction(const QIcon & icon, int type);
void setToolButtonsEnabled(bool pen, bool brush, bool wid_hei);
void blockPropSignals(bool block_);
void actionAlignTrigger(bool vert, Qt::AlignmentFlag value);
void emitZAvailabe(QGraphicsItem * item = 0);
QWidget * widget_props;
Ui::DrawTools * ui;
BlockView * view_;
QList<QAction * > actions_add;
QList<QAction *> actions_add;
mutable QAction actions_Z_up, actions_Z_top, actions_Z_down, actions_Z_bottom;
QList<QToolButton * > buttons_align;
QGraphicsItem * new_item, * cur_item;
QList<QToolButton *> buttons_align;
QGraphicsItem *new_item, *cur_item;
QFontDialog font_dlg;
QPointF pp;
QDialog text_dlg;
@@ -118,7 +120,7 @@ protected:
int new_type;
bool resize_enabled;
QString prev_dir;
private slots:
void toggleNewItem(bool on);
void alignClicked();
@@ -126,32 +128,40 @@ private slots:
void sizeChanged();
void propertyChanged();
void comboLineStyleChanged();
void changeFinished() {if (cur_item) emit itemEdited(cur_item);}
void moveZUpAvailable(bool yes) {actions_Z_up.setEnabled(yes); actions_Z_top.setEnabled(yes);}
void moveZDownAvailable(bool yes) {actions_Z_down.setEnabled(yes); actions_Z_bottom.setEnabled(yes);}
void changeFinished() {
if (cur_item) emit itemEdited(cur_item);
}
void moveZUpAvailable(bool yes) {
actions_Z_up.setEnabled(yes);
actions_Z_top.setEnabled(yes);
}
void moveZDownAvailable(bool yes) {
actions_Z_down.setEnabled(yes);
actions_Z_bottom.setEnabled(yes);
}
void buttonImage_clicked();
void buttonImagePaste_clicked();
void buttonFont_clicked();
void buttonTextEdit_clicked();
void actionTop_triggered(bool on) {actionAlignTrigger(true, Qt::AlignTop);}
void actionVCenter_triggered(bool on) {actionAlignTrigger(true, Qt::AlignVCenter);}
void actionBottom_triggered(bool on) {actionAlignTrigger(true, Qt::AlignBottom);}
void actionLeft_triggered(bool on) {actionAlignTrigger(false, Qt::AlignLeft);}
void actionHCenter_triggered(bool on) {actionAlignTrigger(false, Qt::AlignHCenter);}
void actionRight_triggered(bool on) {actionAlignTrigger(false, Qt::AlignRight);}
void actionTop_triggered(bool on) { actionAlignTrigger(true, Qt::AlignTop); }
void actionVCenter_triggered(bool on) { actionAlignTrigger(true, Qt::AlignVCenter); }
void actionBottom_triggered(bool on) { actionAlignTrigger(true, Qt::AlignBottom); }
void actionLeft_triggered(bool on) { actionAlignTrigger(false, Qt::AlignLeft); }
void actionHCenter_triggered(bool on) { actionAlignTrigger(false, Qt::AlignHCenter); }
void actionRight_triggered(bool on) { actionAlignTrigger(false, Qt::AlignRight); }
void actionZ_triggered();
public slots:
void setResizeHandlesEnabled(bool on);
signals:
void itemCreated(QGraphicsItem * item);
void itemAddConfirm(QGraphicsItem * item);
void itemEdited(QGraphicsItem * item);
void itemZChanged(QGraphicsItem * item);
private:
void retranslate();
};