QElectroTech  0.70
diagramposition.cpp
Go to the documentation of this file.
1 /*
2  Copyright 2006-2019 The QElectroTech Team
3  This file is part of QElectroTech.
4 
5  QElectroTech is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 2 of the License, or
8  (at your option) any later version.
9 
10  QElectroTech is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #include "diagramposition.h"
19 #include "qetapp.h"
20 
29 DiagramPosition::DiagramPosition(const QString &letter, unsigned int number) {
30  // purifie les lettres
31  letter_ = letter.toUpper();
32  letter_.remove(QRegExp("[^A-Z]"));
33  number_ = number;
34 }
35 
40 }
41 
45 QPointF DiagramPosition::position() const {
46  return(position_);
47 }
48 
52 void DiagramPosition::setPosition(const QPointF &position) {
54 }
55 
60  if (isOutOfBounds()) {
61  return("-");
62  }
63  QSettings settings;
64 
65  if (settings.value("border-columns_0", true).toBool()){
66  return(QString("%1%2").arg(letter_).arg(number_ - 1));
67  }else{
68  return(QString("%1%2").arg(letter_).arg(number_));
69  }
70 }
71 
76  return(letter_.isEmpty() || !number_);
77 }
QString letter() const
void setPosition(const QPointF &)
virtual ~DiagramPosition()
unsigned int number() const
QPointF position() const
DiagramPosition(const QString &="", unsigned int=0)
unsigned int number_
bool isOutOfBounds() const