mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 05:00:33 +01:00
Wrap code for better readability
This commit is contained in:
@@ -31,7 +31,9 @@
|
||||
@param parent_template : TitleBlockTemplate
|
||||
@param parent : QWidget
|
||||
*/
|
||||
TitleBlockTemplateCellWidget::TitleBlockTemplateCellWidget(TitleBlockTemplate *parent_template, QWidget *parent) :
|
||||
TitleBlockTemplateCellWidget::TitleBlockTemplateCellWidget(
|
||||
TitleBlockTemplate *parent_template,
|
||||
QWidget *parent) :
|
||||
QWidget(parent),
|
||||
read_only_(false)
|
||||
{
|
||||
|
||||
@@ -27,7 +27,9 @@ int TitleBlockTemplateLocation::MetaTypeId = qRegisterMetaType<TitleBlockTemplat
|
||||
@param collection Parent collection of the title block template
|
||||
@param name Name of the title block template within its parent project or collection
|
||||
*/
|
||||
TitleBlockTemplateLocation::TitleBlockTemplateLocation(const QString &name, TitleBlockTemplatesCollection *collection) :
|
||||
TitleBlockTemplateLocation::TitleBlockTemplateLocation(
|
||||
const QString &name,
|
||||
TitleBlockTemplatesCollection *collection) :
|
||||
collection_(collection),
|
||||
name_(name)
|
||||
{
|
||||
@@ -42,7 +44,8 @@ TitleBlockTemplateLocation::~TitleBlockTemplateLocation() {
|
||||
/**
|
||||
@param loc_str String describing the location of a title block template.
|
||||
*/
|
||||
TitleBlockTemplateLocation TitleBlockTemplateLocation::locationFromString(const QString &loc_str) {
|
||||
TitleBlockTemplateLocation TitleBlockTemplateLocation::locationFromString(
|
||||
const QString &loc_str) {
|
||||
TitleBlockTemplateLocation loc;
|
||||
loc.fromString(loc_str);
|
||||
return(loc);
|
||||
@@ -59,7 +62,8 @@ TitleBlockTemplatesCollection *TitleBlockTemplateLocation::parentCollection() co
|
||||
@brief TitleBlockTemplateLocation::setParentCollection
|
||||
@param collection : TitleBlockTemplatesCollection
|
||||
*/
|
||||
void TitleBlockTemplateLocation::setParentCollection(TitleBlockTemplatesCollection *collection) {
|
||||
void TitleBlockTemplateLocation::setParentCollection(
|
||||
TitleBlockTemplatesCollection *collection) {
|
||||
collection_ = collection;
|
||||
}
|
||||
|
||||
@@ -158,7 +162,8 @@ bool TitleBlockTemplateLocation::isReadOnly() const {
|
||||
@param location other location that should be compared to this one
|
||||
@return true if locations are equal, false otherwise
|
||||
*/
|
||||
bool TitleBlockTemplateLocation::operator==(const TitleBlockTemplateLocation &location) const {
|
||||
bool TitleBlockTemplateLocation::operator==(
|
||||
const TitleBlockTemplateLocation &location) const {
|
||||
return(location.collection_ == collection_ && location.name_ == name_);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,8 @@ class TitleBlockTemplatesCollection;
|
||||
class TitleBlockTemplateLocation {
|
||||
// constructor, destructor
|
||||
public:
|
||||
TitleBlockTemplateLocation(const QString & = QString(), TitleBlockTemplatesCollection * = nullptr);
|
||||
TitleBlockTemplateLocation(const QString & = QString(),
|
||||
TitleBlockTemplatesCollection * = nullptr);
|
||||
virtual ~TitleBlockTemplateLocation();
|
||||
|
||||
// static methods
|
||||
@@ -54,8 +55,9 @@ class TitleBlockTemplateLocation {
|
||||
|
||||
// attributes
|
||||
private:
|
||||
TitleBlockTemplatesCollection *collection_; ///< Collection the template belongs to
|
||||
QString name_; ///< Name of the template
|
||||
TitleBlockTemplatesCollection
|
||||
*collection_; ///< Collection the template belongs to
|
||||
QString name_;///< Name of the template
|
||||
|
||||
public:
|
||||
static int MetaTypeId; ///< Id of the corresponding Qt meta type
|
||||
|
||||
@@ -68,7 +68,8 @@ QString TitleBlockTemplateLocationChooser::name() const {
|
||||
Set the location displayed by this widget
|
||||
@param location to be displayed by this widget
|
||||
*/
|
||||
void TitleBlockTemplateLocationChooser::setLocation(const TitleBlockTemplateLocation &location) {
|
||||
void TitleBlockTemplateLocationChooser::setLocation(
|
||||
const TitleBlockTemplateLocation &location) {
|
||||
int index = indexForCollection(location.parentCollection());
|
||||
collections_ -> setCurrentIndex(index);
|
||||
|
||||
@@ -91,11 +92,14 @@ void TitleBlockTemplateLocationChooser::init() {
|
||||
templates_ = new QComboBox();
|
||||
|
||||
updateCollections();
|
||||
connect(collections_, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTemplates()));
|
||||
connect(collections_, SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(updateTemplates()));
|
||||
|
||||
form_layout_ = new QFormLayout();
|
||||
form_layout_ -> addRow(tr("Collection parente", "used in save as form"), collections_);
|
||||
form_layout_ -> addRow(tr("Modèle existant", "used in save as form"), templates_);
|
||||
form_layout_ -> addRow(tr("Collection parente","used in save as form"),
|
||||
collections_);
|
||||
form_layout_ -> addRow(tr("Modèle existant","used in save as form"),
|
||||
templates_);
|
||||
setLayout(form_layout_);
|
||||
}
|
||||
|
||||
@@ -106,7 +110,8 @@ void TitleBlockTemplateLocationChooser::init() {
|
||||
@return -1 if the collection is unknown to this dialog,
|
||||
or the index of \a coll
|
||||
*/
|
||||
int TitleBlockTemplateLocationChooser::indexForCollection(TitleBlockTemplatesCollection *coll) const {
|
||||
int TitleBlockTemplateLocationChooser::indexForCollection(
|
||||
TitleBlockTemplatesCollection *coll) const {
|
||||
QList<int> indexes = collections_index_.keys(coll);
|
||||
if (indexes.count()) return(indexes.first());
|
||||
return(-1);
|
||||
@@ -120,7 +125,8 @@ void TitleBlockTemplateLocationChooser::updateCollections() {
|
||||
collections_index_.clear();
|
||||
|
||||
int index = 0;
|
||||
foreach(TitleBlockTemplatesCollection *collection, QETApp::availableTitleBlockTemplatesCollections()) {
|
||||
foreach(TitleBlockTemplatesCollection *collection,
|
||||
QETApp::availableTitleBlockTemplatesCollections()) {
|
||||
collections_ -> addItem(collection -> title());
|
||||
collections_index_.insert(index, collection);
|
||||
++ index;
|
||||
|
||||
@@ -29,10 +29,12 @@ class TitleBlockTemplateLocationChooser : public QWidget {
|
||||
Q_OBJECT
|
||||
// Constructor, destructor
|
||||
public:
|
||||
TitleBlockTemplateLocationChooser(const TitleBlockTemplateLocation &, QWidget * = nullptr);
|
||||
TitleBlockTemplateLocationChooser(const TitleBlockTemplateLocation &,
|
||||
QWidget * = nullptr);
|
||||
~TitleBlockTemplateLocationChooser() override;
|
||||
private:
|
||||
TitleBlockTemplateLocationChooser(const TitleBlockTemplateLocationChooser &);
|
||||
TitleBlockTemplateLocationChooser(
|
||||
const TitleBlockTemplateLocationChooser &);
|
||||
|
||||
// methods
|
||||
public:
|
||||
|
||||
@@ -31,7 +31,8 @@ class TitleBlockTemplateLocationSaver : public TitleBlockTemplateLocationChooser
|
||||
Q_OBJECT
|
||||
// Constructor, destructor
|
||||
public:
|
||||
TitleBlockTemplateLocationSaver(const TitleBlockTemplateLocation &, QWidget * = nullptr);
|
||||
TitleBlockTemplateLocationSaver(const TitleBlockTemplateLocation &,
|
||||
QWidget * = nullptr);
|
||||
~TitleBlockTemplateLocationSaver() override;
|
||||
private:
|
||||
TitleBlockTemplateLocationSaver(const TitleBlockTemplateLocationSaver &);
|
||||
|
||||
@@ -56,7 +56,8 @@ TitleBlockTemplateView::TitleBlockTemplateView(QWidget *parent) :
|
||||
@param scene
|
||||
@param parent Parent QWidget.
|
||||
*/
|
||||
TitleBlockTemplateView::TitleBlockTemplateView(QGraphicsScene *scene, QWidget *parent) :
|
||||
TitleBlockTemplateView::TitleBlockTemplateView(QGraphicsScene *scene,
|
||||
QWidget *parent) :
|
||||
QGraphicsView(scene, parent),
|
||||
tbtemplate_(nullptr),
|
||||
tbgrid_(nullptr),
|
||||
@@ -453,7 +454,9 @@ TitleBlockTemplateCellsSet TitleBlockTemplateView::cells(const QRectF &rect) con
|
||||
@param count :
|
||||
If non-zero, will be changed to reflect the number of selected cells
|
||||
*/
|
||||
void TitleBlockTemplateView::analyzeSelectedCells(bool *can_merge, bool *can_split, int *count) {
|
||||
void TitleBlockTemplateView::analyzeSelectedCells(bool *can_merge,
|
||||
bool *can_split,
|
||||
int *count) {
|
||||
if (!can_merge && !can_split) return;
|
||||
|
||||
if (!tbtemplate_) {
|
||||
@@ -834,7 +837,10 @@ bool TitleBlockTemplateView::event(QEvent *event) {
|
||||
@param x : row
|
||||
@param y : column
|
||||
*/
|
||||
void TitleBlockTemplateView::normalizeCells(QList<TitleBlockCell> &cells, int x, int y) const {
|
||||
void TitleBlockTemplateView::normalizeCells(
|
||||
QList<TitleBlockCell> &cells,
|
||||
int x,
|
||||
int y) const {
|
||||
if (!cells.count()) return;
|
||||
|
||||
int min_row = cells.at(0).num_row;
|
||||
@@ -1064,7 +1070,8 @@ void TitleBlockTemplateView::removeItem(QGraphicsLayoutItem *item) {
|
||||
@param items : a list of QGraphicsItem
|
||||
@return the corresponding TitleBlockTemplateCellsSet
|
||||
*/
|
||||
TitleBlockTemplateCellsSet TitleBlockTemplateView::makeCellsSetFromGraphicsItems(const QList<QGraphicsItem *> &items) const {
|
||||
TitleBlockTemplateCellsSet TitleBlockTemplateView::makeCellsSetFromGraphicsItems(
|
||||
const QList<QGraphicsItem *> &items) const {
|
||||
TitleBlockTemplateCellsSet set(this);
|
||||
foreach (QGraphicsItem *item, items) {
|
||||
if (TitleBlockTemplateVisualCell *cell_view = dynamic_cast<TitleBlockTemplateVisualCell *>(item)) {
|
||||
|
||||
@@ -35,7 +35,8 @@ class TitleBlockTemplateView : public QGraphicsView {
|
||||
// constructors, destructor
|
||||
public:
|
||||
TitleBlockTemplateView(QWidget * = nullptr);
|
||||
TitleBlockTemplateView(QGraphicsScene *, QWidget * = nullptr);
|
||||
TitleBlockTemplateView(QGraphicsScene *,
|
||||
QWidget * = nullptr);
|
||||
~TitleBlockTemplateView() override;
|
||||
private:
|
||||
TitleBlockTemplateView(const TitleBlockTemplateView &);
|
||||
@@ -99,7 +100,9 @@ class TitleBlockTemplateView : public QGraphicsView {
|
||||
virtual qreal zoomFactor() const;
|
||||
virtual void fillWithEmptyCells();
|
||||
bool event(QEvent *) override;
|
||||
virtual void normalizeCells(QList<TitleBlockCell> &, int x = 0, int y = 0) const;
|
||||
virtual void normalizeCells(QList<TitleBlockCell> &,
|
||||
int x = 0,
|
||||
int y = 0) const;
|
||||
|
||||
signals:
|
||||
void selectedCellsChanged(QList<TitleBlockCell *>);
|
||||
@@ -114,7 +117,8 @@ class TitleBlockTemplateView : public QGraphicsView {
|
||||
int lastContextMenuCellIndex() const;
|
||||
int indexOf(QGraphicsLayoutItem *);
|
||||
void removeItem(QGraphicsLayoutItem *);
|
||||
TitleBlockTemplateCellsSet makeCellsSetFromGraphicsItems(const QList<QGraphicsItem *> &) const;
|
||||
TitleBlockTemplateCellsSet makeCellsSetFromGraphicsItems(
|
||||
const QList<QGraphicsItem *> &) const;
|
||||
QString makePrettyToolTip(const QString &);
|
||||
|
||||
private slots:
|
||||
|
||||
Reference in New Issue
Block a user