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,49 +1,50 @@
/*
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 BLOCKEDITOR_H
#define BLOCKEDITOR_H
#include <QWidget>
#include <QTreeWidgetItem>
#include <QStyledItemDelegate>
#include "blockitem.h"
#include "qad_blockview_export.h"
#include <QStyledItemDelegate>
#include <QTreeWidgetItem>
#include <QWidget>
namespace Ui {
class BlockEditor;
class BlockEditor;
}
class QAD_BLOCKVIEW_EXPORT BlockEditor : public QWidget
{
class QAD_BLOCKVIEW_EXPORT BlockEditor: public QWidget {
Q_OBJECT
Q_PROPERTY(bool editorMode READ editorMode WRITE setEditorMode)
Q_PROPERTY(bool pinsEditable READ pinsEditable WRITE setPinsEditable)
public:
explicit BlockEditor(QWidget *parent = 0);
explicit BlockEditor(QWidget * parent = 0);
~BlockEditor();
bool editorMode() const {return m_editorMode;}
bool pinsEditable() const {return m_pinsEditable;}
bool editorMode() const { return m_editorMode; }
bool pinsEditable() const { return m_pinsEditable; }
public slots:
void loadFile(QString path);
@@ -67,14 +68,14 @@ private slots:
void on_buttonPinDup_clicked();
void on_buttonPinDelete_clicked();
void on_buttonPinClear_clicked();
void on_treePins_itemChanged(QTreeWidgetItem *item, int column);
void on_treePins_itemChanged(QTreeWidgetItem * item, int column);
private:
bool eventFilter(QObject * o, QEvent * e);
void changeEvent(QEvent * e);
Ui::BlockEditor *ui;
QMap<int, QTreeWidgetItem*> pin_tli;
Ui::BlockEditor * ui;
QMap<int, QTreeWidgetItem *> pin_tli;
BlockItem block;
QString src_title, cur_file;
bool init;
@@ -83,26 +84,28 @@ private:
};
class QAD_BLOCKVIEW_EXPORT PinAlignDelegate: public QStyledItemDelegate {
Q_OBJECT
public:
PinAlignDelegate(QObject * parent = 0): QStyledItemDelegate(parent) {}
QWidget * createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index) const;
QString displayText(const QVariant & value, const QLocale & locale) const;
void setModelData(QWidget * editor, QAbstractItemModel * model, const QModelIndex & index) const;
QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const {return QSize(60, 26);}
QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const { return QSize(60, 26); }
};
class QAD_BLOCKVIEW_EXPORT PinBusDelegate: public QStyledItemDelegate {
Q_OBJECT
public:
PinBusDelegate(QObject * parent = 0): QStyledItemDelegate(parent) {}
QWidget * createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index) const;
QString displayText(const QVariant & value, const QLocale & locale) const;
void setModelData(QWidget * editor, QAbstractItemModel * model, const QModelIndex & index) const;
QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const {return QSize(60, 26);}
QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const { return QSize(60, 26); }
private:
typedef QPair<int, QString> ISPair;
QVector<ISPair> buses;