UI improvement on the Draw-Figures Tab
parent
145bf8c688
commit
028190bc3d
|
@ -1,5 +1,14 @@
|
||||||
#include "drawmapfigure.h"
|
#include "drawmapfigure.h"
|
||||||
|
|
||||||
|
QStringList DrawMapFigure::figuresList = QStringList() << QT_TR_NOOP("Unknown")
|
||||||
|
<< QT_TR_NOOP("Arrow")
|
||||||
|
<< QT_TR_NOOP("Circle")
|
||||||
|
<< QT_TR_NOOP("Ellipse")
|
||||||
|
<< QT_TR_NOOP("Line")
|
||||||
|
<< QT_TR_NOOP("Point")
|
||||||
|
<< QT_TR_NOOP("Rectangle")
|
||||||
|
<< QT_TR_NOOP("Text");
|
||||||
|
|
||||||
DrawMapFigure::DrawMapFigure(QObject *parent) :
|
DrawMapFigure::DrawMapFigure(QObject *parent) :
|
||||||
QObject(parent)
|
QObject(parent)
|
||||||
{
|
{
|
||||||
|
@ -18,9 +27,8 @@ DrawMapFigure::DrawMapFigure(const QString &str, QObject *parent) :
|
||||||
QString params = match.captured("params");
|
QString params = match.captured("params");
|
||||||
|
|
||||||
color.setNamedColor(params.section(' ', 1, 1));
|
color.setNamedColor(params.section(' ', 1, 1));
|
||||||
bool ok;
|
|
||||||
figure = getFigure(match.captured("type"));
|
figure = getFigure(match.captured("type"));
|
||||||
if(color.isValid() && ok){
|
if(color.isValid()){
|
||||||
switch (figure) {
|
switch (figure) {
|
||||||
case Text:
|
case Text:
|
||||||
//parse text and fall through for point
|
//parse text and fall through for point
|
||||||
|
@ -143,12 +151,7 @@ QColor DrawMapFigure::getColor() const
|
||||||
|
|
||||||
QStringList DrawMapFigure::getFigureList()
|
QStringList DrawMapFigure::getFigureList()
|
||||||
{
|
{
|
||||||
QMetaEnum metaEnum = QMetaEnum::fromType<Figure>();
|
return figuresList;
|
||||||
QStringList list;
|
|
||||||
for(int i =0; i<metaEnum.keyCount();i++){
|
|
||||||
list << metaEnum.key(i);
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawMapFigure::setFigure(const Figure &value)
|
void DrawMapFigure::setFigure(const Figure &value)
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
class DrawMapFigure : public QObject
|
class DrawMapFigure : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
|
||||||
public:
|
public:
|
||||||
enum Figure{
|
enum Figure{
|
||||||
Unknown,
|
Unknown,
|
||||||
|
@ -100,7 +100,8 @@ protected:
|
||||||
QColor color;
|
QColor color;
|
||||||
QMetaEnum metaFigure = QMetaEnum::fromType<Figure>();
|
QMetaEnum metaFigure = QMetaEnum::fromType<Figure>();
|
||||||
private:
|
private:
|
||||||
|
Q_OBJECT
|
||||||
|
static QStringList figuresList;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DRAWMAPFIGURE_H
|
#endif // DRAWMAPFIGURE_H
|
||||||
|
|
|
@ -6,14 +6,7 @@ DrawMapFigureTableModel::DrawMapFigureTableModel(QObject *parent)
|
||||||
: QAbstractTableModel(parent)
|
: QAbstractTableModel(parent)
|
||||||
{
|
{
|
||||||
list = new QList<DrawMapFigure *>;
|
list = new QList<DrawMapFigure *>;
|
||||||
header <<"Figure"<<"Use image coordinates"<<"Point"<<"Geometry"<<"Color"<<"Text";
|
header <<tr("Figure")<<tr("Coordinates")<<tr("Point")<<tr("Geometry")<<tr("Color")<<tr("Text");
|
||||||
}
|
|
||||||
|
|
||||||
DrawMapFigureTableModel::DrawMapFigureTableModel(QList<DrawMapFigure *> *list, QObject *parent)
|
|
||||||
: QAbstractTableModel(parent)
|
|
||||||
{
|
|
||||||
this->list = list;
|
|
||||||
header <<"Figure"<<"Use image coordinates"<<"Point"<<"Geometry"<<"Color"<<"Text";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant DrawMapFigureTableModel::headerData(int section, Qt::Orientation orientation, int role) const
|
QVariant DrawMapFigureTableModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||||
|
@ -97,13 +90,18 @@ QVariant DrawMapFigureTableModel::data(const QModelIndex &index, int role) const
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
|
if(role == Qt::EditRole){
|
||||||
return item->getUseImageCoordinates();
|
return item->getUseImageCoordinates();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return item->getUseImageCoordinates() ? "Image (x,y)" : "Minetest (x,z)";
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
return (item->requiresPoint()) ? QString("(%1,%2)").arg(p.x()).arg(p.y()) : QVariant();
|
return (item->requiresPoint()) ? QString("(%1,%2)").arg(p.x()).arg(p.y()) : QVariant();
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
return item->requiresGeometry() ? item->getGeometry()->getString() : QVariant();
|
return item->requiresGeometry() ? item->getGeometry()->getString(Geometry::FormatKeep) : QVariant();
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
return item->getColor();
|
return item->getColor();
|
||||||
|
@ -121,6 +119,9 @@ QVariant DrawMapFigureTableModel::data(const QModelIndex &index, int role) const
|
||||||
else if(role == Qt::DecorationRole && col==4){
|
else if(role == Qt::DecorationRole && col==4){
|
||||||
return item->getColor();
|
return item->getColor();
|
||||||
}
|
}
|
||||||
|
else if(role == Qt::CheckStateRole && col ==1){
|
||||||
|
return item->getUseImageCoordinates()? Qt::Checked : Qt::Unchecked;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
@ -156,6 +157,12 @@ bool DrawMapFigureTableModel::setData(const QModelIndex &index, const QVariant &
|
||||||
emit dataChanged(index, index, QVector<int>() << role);
|
emit dataChanged(index, index, QVector<int>() << role);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if( index.isValid() && role == Qt::CheckStateRole &&index.column()==1){
|
||||||
|
DrawMapFigure *item = list->at(index.row());
|
||||||
|
item->setUseImageCoordinates(value.toInt() == Qt::Checked);
|
||||||
|
emit dataChanged(index, index, QVector<int>() << role);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,7 +176,7 @@ Qt::ItemFlags DrawMapFigureTableModel::flags(const QModelIndex &index) const
|
||||||
if(col == 0)
|
if(col == 0)
|
||||||
flag |= Qt::ItemIsEnabled|Qt::ItemIsEditable;
|
flag |= Qt::ItemIsEnabled|Qt::ItemIsEditable;
|
||||||
else if(col == 1)
|
else if(col == 1)
|
||||||
flag |= Qt::ItemIsEditable;
|
flag |= Qt::ItemIsUserCheckable;
|
||||||
else if (col == 2 && item->requiresPoint())
|
else if (col == 2 && item->requiresPoint())
|
||||||
flag |= Qt::ItemIsEditable;
|
flag |= Qt::ItemIsEditable;
|
||||||
else if (col == 3 && item->requiresGeometry())
|
else if (col == 3 && item->requiresGeometry())
|
||||||
|
|
|
@ -1,248 +0,0 @@
|
||||||
#include "drawmapfiguretablemodel.h"
|
|
||||||
|
|
||||||
#include <QBrush>
|
|
||||||
|
|
||||||
DrawMapFigureTableModel::DrawMapFigureTableModel(QObject *parent)
|
|
||||||
: QAbstractTableModel(parent)
|
|
||||||
{
|
|
||||||
list = new QList<DrawMapFigure *>;
|
|
||||||
header <<"Figure"<<"Use image coordinates"<<"Point"<<"Geometry"<<"Color"<<"Text";
|
|
||||||
}
|
|
||||||
|
|
||||||
DrawMapFigureTableModel::DrawMapFigureTableModel(QList<DrawMapFigure *> *list, QObject *parent)
|
|
||||||
: QAbstractTableModel(parent)
|
|
||||||
{
|
|
||||||
this->list = list;
|
|
||||||
header <<"Figure"<<"Use image coordinates"<<"Point"<<"Geometry"<<"Color"<<"Text";
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant DrawMapFigureTableModel::headerData(int section, Qt::Orientation orientation, int role) const
|
|
||||||
{
|
|
||||||
if (role == Qt::DisplayRole && orientation == Qt::Horizontal && section <= header.size())
|
|
||||||
{
|
|
||||||
return header[section];
|
|
||||||
}
|
|
||||||
else if(role == Qt::DisplayRole && orientation == Qt::Vertical){
|
|
||||||
return section+1;
|
|
||||||
}
|
|
||||||
return QVariant();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DrawMapFigureTableModel::setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role)
|
|
||||||
{
|
|
||||||
if (value != headerData(section, orientation, role) && role == Qt::DisplayRole && orientation == Qt::Horizontal)
|
|
||||||
{
|
|
||||||
header[section] = value.toString();
|
|
||||||
emit headerDataChanged(orientation, section, section);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int DrawMapFigureTableModel::rowCount(const QModelIndex &parent) const
|
|
||||||
{
|
|
||||||
Q_UNUSED(parent);
|
|
||||||
if (parent.isValid())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
|
|
||||||
return list->size();
|
|
||||||
}
|
|
||||||
|
|
||||||
int DrawMapFigureTableModel::columnCount(const QModelIndex &parent) const
|
|
||||||
{
|
|
||||||
Q_UNUSED(parent);
|
|
||||||
if (parent.isValid())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return header.size();
|
|
||||||
// FIXME: Implement me!
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant DrawMapFigureTableModel::data(const QModelIndex &index, int role) const
|
|
||||||
{
|
|
||||||
if (index.isValid()){
|
|
||||||
int row = index.row();
|
|
||||||
int col = index.column();
|
|
||||||
DrawMapFigure *item = list->at(row);
|
|
||||||
QPoint p = item->getPoint();
|
|
||||||
QMetaEnum metaEnum = QMetaEnum::fromType<DrawMapFigure::Figure>();
|
|
||||||
if(role == Qt::DecorationRole && col ==0)
|
|
||||||
{
|
|
||||||
return item->getIcon();
|
|
||||||
}
|
|
||||||
else if(role == Qt::BackgroundRole)
|
|
||||||
{
|
|
||||||
if(item->getFigure()==DrawMapFigure::Unknown){
|
|
||||||
return QBrush(Qt::red);
|
|
||||||
}
|
|
||||||
else if(col == 2 && !item->requiresPoint()){
|
|
||||||
return QBrush(Qt::lightGray);
|
|
||||||
}
|
|
||||||
else if (col == 3 && !item->requiresGeometry()){
|
|
||||||
return QBrush(Qt::lightGray);
|
|
||||||
}
|
|
||||||
else if(col == 5 && !item->requiresText()){
|
|
||||||
return QBrush(Qt::lightGray);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(role == Qt::EditRole ||role == Qt::DisplayRole){
|
|
||||||
|
|
||||||
switch(col){
|
|
||||||
case 0:
|
|
||||||
return (role == Qt::EditRole) ? QVariant(item->getFigure()) : QString(metaEnum.key(item->getFigure()));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1:
|
|
||||||
return item->getUseImageCoordinates();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
return (item->requiresPoint()) ? QString("(%1,%2)").arg(p.x()).arg(p.y()) : QVariant();
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
return item->requiresGeometry() ? item->getGeometry()->getString() : QVariant();
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
return item->getColor();
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
return item->getText();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return QVariant();
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME: Implement me!
|
|
||||||
return QVariant();
|
|
||||||
}
|
|
||||||
else if(role == Qt::DecorationRole && col==4){
|
|
||||||
return item->getColor();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return QVariant();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DrawMapFigureTableModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
|
||||||
{
|
|
||||||
if (index.isValid() && role == Qt::EditRole && data(index, role) != value) {
|
|
||||||
int row = index.row();
|
|
||||||
int col = index.column();
|
|
||||||
DrawMapFigure *item = list->at(row);
|
|
||||||
switch(col){
|
|
||||||
case 0:
|
|
||||||
item->setFigure(value.toInt());
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
item->setUseImageCoordinates(value.toBool());
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
item->setPoint(value.toString());
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
item->getGeometry()->set(value.toString());
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
item->setColor(QColor(value.toString()));
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
item->setText(value.toString());
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// FIXME: Implement me!
|
|
||||||
emit dataChanged(index, index, QVector<int>() << role);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Qt::ItemFlags DrawMapFigureTableModel::flags(const QModelIndex &index) const
|
|
||||||
{
|
|
||||||
if (!index.isValid())
|
|
||||||
return Qt::NoItemFlags;
|
|
||||||
Qt::ItemFlags flag = QAbstractItemModel::flags(index);
|
|
||||||
int col = index.column();
|
|
||||||
DrawMapFigure *item = list->at(index.row());
|
|
||||||
if(col == 0)
|
|
||||||
flag |= Qt::ItemIsEnabled|Qt::ItemIsEditable;
|
|
||||||
else if(col == 1)
|
|
||||||
flag |= Qt::ItemIsEditable;
|
|
||||||
else if (col == 2 && item->requiresPoint())
|
|
||||||
flag |= Qt::ItemIsEditable;
|
|
||||||
else if (col == 3 && item->requiresGeometry())
|
|
||||||
flag |= Qt::ItemIsEditable;
|
|
||||||
else if (col == 4)
|
|
||||||
flag |= Qt::ItemIsEditable;
|
|
||||||
else if(col == 5 && item->requiresText())
|
|
||||||
flag |= Qt::ItemIsEditable;
|
|
||||||
|
|
||||||
return flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DrawMapFigureTableModel::insertRows(int position, int count, const QModelIndex &parent)
|
|
||||||
{
|
|
||||||
beginInsertRows(parent, position, position + count - 1);
|
|
||||||
for (int row = 0; row < count; ++row) {
|
|
||||||
list->insert(position, new DrawMapFigure());
|
|
||||||
}
|
|
||||||
endInsertRows();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DrawMapFigureTableModel::insertColumns(int column, int count, const QModelIndex &parent)
|
|
||||||
{
|
|
||||||
beginInsertColumns(parent, column, column + count - 1);
|
|
||||||
// FIXME: Implement me!
|
|
||||||
endInsertColumns();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DrawMapFigureTableModel::removeRows(int position, int count, const QModelIndex &parent)
|
|
||||||
{
|
|
||||||
beginRemoveRows(parent, position, position + count - 1);
|
|
||||||
for (int row = 0; row < count; ++row) {
|
|
||||||
list->removeAt(position);
|
|
||||||
}
|
|
||||||
endRemoveRows();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DrawMapFigureTableModel::removeColumns(int column, int count, const QModelIndex &parent)
|
|
||||||
{
|
|
||||||
beginRemoveColumns(parent, column, column + count - 1);
|
|
||||||
// FIXME: Implement me!
|
|
||||||
endRemoveColumns();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList DrawMapFigureTableModel::getStringList() const
|
|
||||||
{
|
|
||||||
QStringList retval;
|
|
||||||
for (int i = 0; i < list->size(); ++i)
|
|
||||||
retval << list->at(i)->getString();
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList DrawMapFigureTableModel::getArguments() const
|
|
||||||
{
|
|
||||||
QStringList retval;
|
|
||||||
for (int i = 0; i < list->size(); ++i)
|
|
||||||
retval << list->at(i)->getSplittedString();
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DrawMapFigureTableModel::insertStringList(const QStringList &other)
|
|
||||||
{
|
|
||||||
if(other.length() > 0){
|
|
||||||
int leng = other.length();
|
|
||||||
beginInsertRows(QModelIndex() , list->length(), list->length()+leng - 1);
|
|
||||||
//insertRows(0, other.length(),QModelIndex());
|
|
||||||
for(int i = 0; i < leng; ++i){
|
|
||||||
list->append(new DrawMapFigure(other.at(i)));
|
|
||||||
}
|
|
||||||
endInsertRows();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -12,7 +12,6 @@ class DrawMapFigureTableModel : public QAbstractTableModel
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DrawMapFigureTableModel(QObject *parent = 0);
|
explicit DrawMapFigureTableModel(QObject *parent = 0);
|
||||||
explicit DrawMapFigureTableModel(QList<DrawMapFigure *> *list, QObject *parent = 0);
|
|
||||||
|
|
||||||
// Header:
|
// Header:
|
||||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||||
|
|
20
geometry.cpp
20
geometry.cpp
|
@ -40,7 +40,7 @@ Geometry::Format Geometry::set(QString str)
|
||||||
QRegularExpressionMatch match;
|
QRegularExpressionMatch match;
|
||||||
if(str.isEmpty()){
|
if(str.isEmpty()){
|
||||||
qDebug()<<"format is FormatNone";
|
qDebug()<<"format is FormatNone";
|
||||||
return FormatNone;
|
format = FormatNone;
|
||||||
}
|
}
|
||||||
else if((match =corners.match(str)).hasMatch()) {
|
else if((match =corners.match(str)).hasMatch()) {
|
||||||
qDebug()<<"format is Corners";
|
qDebug()<<"format is Corners";
|
||||||
|
@ -52,7 +52,7 @@ Geometry::Format Geometry::set(QString str)
|
||||||
// Order is important here!
|
// Order is important here!
|
||||||
computeDimensions();
|
computeDimensions();
|
||||||
computeCenter();
|
computeCenter();
|
||||||
return Geometry::Corners;
|
format = Geometry::Corners;
|
||||||
}
|
}
|
||||||
else if((match =centerDimension.match(str)).hasMatch()){
|
else if((match =centerDimension.match(str)).hasMatch()){
|
||||||
qDebug()<<"format is CenterDimensions";
|
qDebug()<<"format is CenterDimensions";
|
||||||
|
@ -67,7 +67,7 @@ Geometry::Format Geometry::set(QString str)
|
||||||
computeDimensions();
|
computeDimensions();
|
||||||
computeCenter();
|
computeCenter();
|
||||||
}
|
}
|
||||||
return Geometry::CenterDimensions;
|
format = Geometry::CenterDimensions;
|
||||||
}
|
}
|
||||||
else if((match = cornerDimension.match(str)).hasMatch()){
|
else if((match = cornerDimension.match(str)).hasMatch()){
|
||||||
qDebug()<<"format is CornerDimensions";
|
qDebug()<<"format is CornerDimensions";
|
||||||
|
@ -82,7 +82,7 @@ Geometry::Format Geometry::set(QString str)
|
||||||
computeDimensions();
|
computeDimensions();
|
||||||
computeCenter();
|
computeCenter();
|
||||||
}
|
}
|
||||||
return Geometry::CornerDimensions;
|
format = Geometry::CornerDimensions;
|
||||||
}
|
}
|
||||||
else if((match = cornerDimensionAlternate.match(str)).hasMatch()){
|
else if((match = cornerDimensionAlternate.match(str)).hasMatch()){
|
||||||
qDebug() << "format is <width>x<height>[<+|-xoffset><+|-yoffset>]";
|
qDebug() << "format is <width>x<height>[<+|-xoffset><+|-yoffset>]";
|
||||||
|
@ -99,7 +99,7 @@ Geometry::Format Geometry::set(QString str)
|
||||||
computeDimensions();
|
computeDimensions();
|
||||||
computeCenter();
|
computeCenter();
|
||||||
}
|
}
|
||||||
return Geometry::CenterDimensions;
|
format = Geometry::CenterDimensions;
|
||||||
}
|
}
|
||||||
else if(match.lastCapturedIndex() ==4){
|
else if(match.lastCapturedIndex() ==4){
|
||||||
qDebug() << "format is CornerDimensions";
|
qDebug() << "format is CornerDimensions";
|
||||||
|
@ -114,15 +114,17 @@ Geometry::Format Geometry::set(QString str)
|
||||||
computeDimensions();
|
computeDimensions();
|
||||||
computeCenter();
|
computeCenter();
|
||||||
}
|
}
|
||||||
return Geometry::CornerDimensions;
|
format = Geometry::CornerDimensions;
|
||||||
}
|
}
|
||||||
else return Geometry::FormatCustom;
|
else format = Geometry::FormatCustom;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
qDebug()<<"Warning: Could not parse format of string: "<<str;
|
qDebug()<<"Warning: Could not parse format of string: "<<str;
|
||||||
return Geometry::FormatCustom;
|
format = Geometry::FormatCustom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return format;
|
||||||
|
|
||||||
}
|
}
|
||||||
void Geometry::setMax(void)
|
void Geometry::setMax(void)
|
||||||
{
|
{
|
||||||
|
@ -184,6 +186,8 @@ void Geometry::setCorners(int c0x, int c0y, int c1x, int c1y)
|
||||||
|
|
||||||
QString Geometry::getString(Geometry::Format format)
|
QString Geometry::getString(Geometry::Format format)
|
||||||
{
|
{
|
||||||
|
if(format == FormatKeep)
|
||||||
|
format = this->format; // Use the preferred format
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case CenterDimensions:
|
case CenterDimensions:
|
||||||
if(center[0]==0 && center[1] ==0)
|
if(center[0]==0 && center[1] ==0)
|
||||||
|
|
|
@ -52,6 +52,8 @@ private:
|
||||||
void computeCorner1(void);
|
void computeCorner1(void);
|
||||||
void computeCenter(void); // Depends dimensions to be correct !
|
void computeCenter(void); // Depends dimensions to be correct !
|
||||||
void computeDimensions(void);
|
void computeDimensions(void);
|
||||||
|
|
||||||
|
Format format = FormatNone;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GEOMETRY_H
|
#endif // GEOMETRY_H
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
236
mainwindow.ui
236
mainwindow.ui
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>800</width>
|
<width>972</width>
|
||||||
<height>600</height>
|
<height>605</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab_genaral">
|
<widget class="QWidget" name="tab_genaral">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
|
@ -894,7 +894,7 @@ Nodes higher than this level will not be drawn. This can be used to avoid floati
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>524</width>
|
<width>653</width>
|
||||||
<height>427</height>
|
<height>427</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1955,8 +1955,8 @@ Nodes higher than this level will not be drawn. This can be used to avoid floati
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>513</width>
|
<width>663</width>
|
||||||
<height>369</height>
|
<height>374</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||||
|
@ -2182,15 +2182,109 @@ Nodes higher than this level will not be drawn. This can be used to avoid floati
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>Draw figures</string>
|
<string>Draw figures</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_15">
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QGroupBox" name="groupBox_8">
|
||||||
|
<property name="title">
|
||||||
|
<string>Properties</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_14">
|
||||||
|
<item row="1" column="1" colspan="2">
|
||||||
|
<widget class="QGroupBox" name="groupBox_9">
|
||||||
|
<property name="title">
|
||||||
|
<string>Geometry</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||||
|
<item>
|
||||||
|
<widget class="GeometryWidget" name="figure_geometry" native="true"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="figure_geometry_apply">
|
||||||
|
<property name="text">
|
||||||
|
<string>Apply</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QComboBox" name="figureSelect"/>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="2">
|
||||||
|
<widget class="ColorLineEdit" name="figure_color">
|
||||||
|
<property name="text">
|
||||||
|
<string>red</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>Figure:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="2">
|
||||||
|
<widget class="QLineEdit" name="figure_point"/>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1" colspan="2">
|
||||||
|
<widget class="QCheckBox" name="figureUseImageCoordinates">
|
||||||
|
<property name="text">
|
||||||
|
<string>Use Image Coodinates</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="text">
|
||||||
|
<string>Color: </string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="2">
|
||||||
|
<widget class="QLineEdit" name="figure_text"/>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="1">
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="text">
|
||||||
|
<string>Text:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QLabel" name="label_21">
|
||||||
|
<property name="text">
|
||||||
|
<string>Point</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QGroupBox" name="groupBox_14">
|
||||||
|
<property name="title">
|
||||||
|
<string>Information:</string>
|
||||||
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox_3">
|
<widget class="QTextBrowser" name="figureInformation">
|
||||||
<property name="sizePolicy">
|
<property name="acceptRichText">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
<bool>false</bool>
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
</property>
|
||||||
|
<property name="source">
|
||||||
|
<url>
|
||||||
|
<string>qrc:/doc/drawfigure.html</string>
|
||||||
|
</url>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0" rowspan="2">
|
||||||
|
<widget class="QGroupBox" name="groupBox_3">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Elements</string>
|
<string>Elements</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -2213,15 +2307,15 @@ Nodes higher than this level will not be drawn. This can be used to avoid floati
|
||||||
<widget class="QTableView" name="figures_list">
|
<widget class="QTableView" name="figures_list">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>10</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="dragDropMode">
|
<property name="minimumSize">
|
||||||
<enum>QAbstractItemView::DragDrop</enum>
|
<size>
|
||||||
</property>
|
<width>460</width>
|
||||||
<property name="defaultDropAction">
|
<height>0</height>
|
||||||
<enum>Qt::MoveAction</enum>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="selectionMode">
|
<property name="selectionMode">
|
||||||
<enum>QAbstractItemView::SingleSelection</enum>
|
<enum>QAbstractItemView::SingleSelection</enum>
|
||||||
|
@ -2240,110 +2334,6 @@ Nodes higher than this level will not be drawn. This can be used to avoid floati
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBox_8">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="title">
|
|
||||||
<string>Properties</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_14">
|
|
||||||
<item row="3" column="2">
|
|
||||||
<widget class="QLineEdit" name="figure_point"/>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="1">
|
|
||||||
<widget class="QLabel" name="label_22">
|
|
||||||
<property name="text">
|
|
||||||
<string>Information: </string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<widget class="QComboBox" name="figureSelect"/>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QLabel" name="label_5">
|
|
||||||
<property name="text">
|
|
||||||
<string>Figure:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="2">
|
|
||||||
<widget class="ColorLineEdit" name="figure_color">
|
|
||||||
<property name="text">
|
|
||||||
<string>red</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="1">
|
|
||||||
<widget class="QLabel" name="label_6">
|
|
||||||
<property name="text">
|
|
||||||
<string>Color: </string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1" colspan="2">
|
|
||||||
<widget class="QCheckBox" name="figureUseImageCoordinates">
|
|
||||||
<property name="text">
|
|
||||||
<string>Use Image Coodinates</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="2">
|
|
||||||
<widget class="QLineEdit" name="figure_text"/>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="1">
|
|
||||||
<widget class="QLabel" name="label_7">
|
|
||||||
<property name="text">
|
|
||||||
<string>Text:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1" colspan="2">
|
|
||||||
<widget class="QGroupBox" name="groupBox_9">
|
|
||||||
<property name="title">
|
|
||||||
<string>Geometry</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
|
||||||
<item>
|
|
||||||
<widget class="GeometryWidget" name="figure_geometry" native="true"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="figure_geometry_apply">
|
|
||||||
<property name="text">
|
|
||||||
<string>Apply</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="QLabel" name="label_21">
|
|
||||||
<property name="text">
|
|
||||||
<string>Point</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="7" column="1" colspan="2">
|
|
||||||
<widget class="QTextBrowser" name="figureInformation">
|
|
||||||
<property name="acceptRichText">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="source">
|
|
||||||
<url>
|
|
||||||
<string>qrc:/doc/drawfigure.html</string>
|
|
||||||
</url>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="tab_output">
|
<widget class="QWidget" name="tab_output">
|
||||||
|
@ -2445,7 +2435,7 @@ Nodes higher than this level will not be drawn. This can be used to avoid floati
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>800</width>
|
<width>972</width>
|
||||||
<height>26</height>
|
<height>26</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
|
Loading…
Reference in New Issue