version 2.0.0_alpha
Important! All QtWraps macros renamed! Qt 6 support Graphic export feature qad_types cross-Qt small changes
This commit is contained in:
@@ -106,7 +106,13 @@ void EComboBox::filterChanged(const QString & text, bool first) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < iv.model()->rowCount(); ++i) {
|
||||
iv.setRowHidden(i, pi, !iv.model()->index(i, 0, pi).data().toString().contains(QRegExp(text, Qt::CaseInsensitive)));
|
||||
iv.setRowHidden(i, pi, !iv.model()->index(i, 0, pi).data().toString().contains(
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
QRegExp(text, Qt::CaseInsensitive)
|
||||
#else
|
||||
QRegularExpression(text, QRegularExpression::CaseInsensitiveOption)
|
||||
#endif
|
||||
));
|
||||
iv.model()->setData(iv.model()->index(i, 0), iv.model()->index(i, 0, pi).data().toString(), Qt::ToolTipRole);
|
||||
}
|
||||
iv.show();
|
||||
|
||||
@@ -2,7 +2,11 @@
|
||||
#include <QLineEdit>
|
||||
#include <QLabel>
|
||||
#include <QDebug>
|
||||
#include <QRegExp>
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
# include <QRegExp>
|
||||
#else
|
||||
# include <QRegularExpression>
|
||||
#endif
|
||||
#include <QPainter>
|
||||
#include <QTimer>
|
||||
#include <QStyle>
|
||||
@@ -292,7 +296,13 @@ void EvalSpinBox::focusOutEvent(QFocusEvent * event) {
|
||||
|
||||
void EvalSpinBox::wheelEvent(QWheelEvent * event) {
|
||||
if (event->modifiers().testFlag(Qt::ShiftModifier))
|
||||
stepByDouble(event->delta() > 0 ? 0.1 : -0.1);
|
||||
stepByDouble(
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
||||
event->delta()
|
||||
#else
|
||||
event->angleDelta().y()
|
||||
#endif
|
||||
> 0 ? 0.1 : -0.1);
|
||||
else
|
||||
QAbstractSpinBox::wheelEvent(event);
|
||||
}
|
||||
@@ -304,8 +314,8 @@ void EvalSpinBox::stepByDouble(double steps) {
|
||||
QString t = text();
|
||||
if (eval->check(t)) {
|
||||
t = eval->expression();
|
||||
//QRegExp re("(\\-?\\d+)");
|
||||
QRegExp re("[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)");
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
/* QRegExp re("[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)");
|
||||
int pos = 0;
|
||||
if ((pos = re.indexIn(t)) != -1) {
|
||||
double v = t.mid(pos, re.matchedLength()).toDouble();
|
||||
@@ -316,6 +326,10 @@ void EvalSpinBox::stepByDouble(double steps) {
|
||||
double v = steps;
|
||||
t = QString::number(v) + t;
|
||||
}
|
||||
#else*/
|
||||
QRegularExpression re("[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)");
|
||||
/// TODO andrey
|
||||
#endif
|
||||
eval->check(t);
|
||||
lineEdit()->setText(eval->expression());
|
||||
}
|
||||
|
||||
@@ -482,7 +482,13 @@ bool QCodeEdit::eventFilter(QObject * o, QEvent * e) {
|
||||
break;
|
||||
case QEvent::DragMove:
|
||||
if (!isEnabled()) break;
|
||||
drag_cursor = ui->textCode->cursorForPosition(((QDragMoveEvent*)e)->pos());
|
||||
drag_cursor = ui->textCode->cursorForPosition(
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
((QDragMoveEvent*)e)->pos()
|
||||
#else
|
||||
((QDragMoveEvent*)e)->position().toPoint()
|
||||
#endif
|
||||
);
|
||||
repaintCursor();
|
||||
break;
|
||||
case QEvent::MouseButtonRelease:
|
||||
|
||||
@@ -226,7 +226,8 @@ public slots:
|
||||
void setShowSpaces(bool yes);
|
||||
void setShowLineNumbers(bool yes);
|
||||
void search(const QString & t);
|
||||
void searchNext(bool next = true);
|
||||
void searchNext(bool next);
|
||||
void searchNext() {searchNext(true);}
|
||||
void searchPrevious();
|
||||
void hideSearch();
|
||||
void setWordCompletitionEnabled(bool on) {word_complete = on;}
|
||||
|
||||
@@ -61,7 +61,13 @@ bool QPIConfigWidget::eventFilter(QObject * o, QEvent * e) {
|
||||
if (((QMouseEvent * )e)->buttons() == Qt::RightButton) {
|
||||
qApp->processEvents();
|
||||
itemClicked(pi, 1);
|
||||
popupMenu.popup(((QMouseEvent * )e)->globalPos());
|
||||
popupMenu.popup(
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
((QMouseEvent * )e)->globalPos()
|
||||
#else
|
||||
((QMouseEvent * )e)->globalPosition().toPoint()
|
||||
#endif
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,99 +210,167 @@ void QVariantEdit::_recreate(const QVariant & new_value) {
|
||||
return;
|
||||
}
|
||||
_delete();
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
switch (new_value.type()) {
|
||||
#else
|
||||
switch (new_value.metaType().id()) {
|
||||
#endif
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
case QVariant::Bool:
|
||||
#else
|
||||
case QMetaType::Bool:
|
||||
#endif
|
||||
_check = new QCheckBox(this);
|
||||
_check->setAutoFillBackground(true);
|
||||
_cur_edit = _check;
|
||||
connect(_check, SIGNAL(toggled(bool)), this, SLOT(_changed()));
|
||||
break;
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
case QVariant::Int:
|
||||
#else
|
||||
case QMetaType::Int:
|
||||
#endif
|
||||
_spin = new QDoubleSpinBox(this);
|
||||
_spin->setDecimals(0);
|
||||
_spin->setRange(-0x7FFFFFFF, 0x7FFFFFFF);
|
||||
_cur_edit = _spin;
|
||||
connect(_spin, SIGNAL(valueChanged(double)), this, SLOT(_changed()));
|
||||
break;
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
case QVariant::UInt:
|
||||
#else
|
||||
case QMetaType::UInt:
|
||||
#endif
|
||||
_spin = new QDoubleSpinBox(this);
|
||||
_spin->setDecimals(0);
|
||||
_spin->setRange(0, 0xFFFFFFFF);
|
||||
_cur_edit = _spin;
|
||||
connect(_spin, SIGNAL(valueChanged(double)), this, SLOT(_changed()));
|
||||
break;
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
case QVariant::LongLong:
|
||||
#else
|
||||
case QMetaType::LongLong:
|
||||
#endif
|
||||
_spin = new QDoubleSpinBox(this);
|
||||
_spin->setDecimals(0);
|
||||
_spin->setRange(-0x7FFFFFFFFFFFFFFFL, 0x7FFFFFFFFFFFFFFFL);
|
||||
_cur_edit = _spin;
|
||||
connect(_spin, SIGNAL(valueChanged(double)), this, SLOT(_changed()));
|
||||
break;
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
case QVariant::ULongLong:
|
||||
#else
|
||||
case QMetaType::ULongLong:
|
||||
#endif
|
||||
_spin = new QDoubleSpinBox(this);
|
||||
_spin->setDecimals(0);
|
||||
_spin->setRange(0L, 0x7FFFFFFFFFFFFFFFL);
|
||||
_cur_edit = _spin;
|
||||
connect(_spin, SIGNAL(valueChanged(double)), this, SLOT(_changed()));
|
||||
break;
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
case QVariant::Double:
|
||||
#else
|
||||
case QMetaType::Double:
|
||||
#endif
|
||||
_espin = new EvalSpinBox(this);
|
||||
//_spin->setDecimals(5);
|
||||
//_spin->setRange(-1E+199, 1E+199);
|
||||
_cur_edit = _espin;
|
||||
connect(_espin, SIGNAL(valueChanged(double)), this, SLOT(_changed()));
|
||||
break;
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
case QVariant::Color:
|
||||
#else
|
||||
case QMetaType::QColor:
|
||||
#endif
|
||||
_color = new ColorButton(this);
|
||||
_color->setUseAlphaChannel(true);
|
||||
_cur_edit = _color;
|
||||
connect(_color, SIGNAL(colorChanged(QColor)), this, SLOT(_changed()));
|
||||
break;
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
case QVariant::String:
|
||||
#else
|
||||
case QMetaType::QString:
|
||||
#endif
|
||||
_line = new CLineEdit(this);
|
||||
_cur_edit = _line;
|
||||
connect(_line, SIGNAL(textChanged(QString)), this, SLOT(_changed()));
|
||||
break;
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
case QVariant::StringList:
|
||||
#else
|
||||
case QMetaType::QStringList:
|
||||
#endif
|
||||
_list = new StringListEdit(this);
|
||||
_cur_edit = _list;
|
||||
connect(_list, SIGNAL(valueChanged()), this, SLOT(_changed()));
|
||||
break;
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
case QVariant::Rect:
|
||||
#else
|
||||
case QMetaType::QRect:
|
||||
#endif
|
||||
_rect = new QRectEdit(this);
|
||||
_rect->setDecimals(0);
|
||||
_cur_edit = _rect;
|
||||
connect(_rect, SIGNAL(valueChanged(QRectF)), this, SLOT(_changed()));
|
||||
break;
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
case QVariant::RectF:
|
||||
#else
|
||||
case QMetaType::QRectF:
|
||||
#endif
|
||||
_rect = new QRectEdit(this);
|
||||
_rect->setDecimals(3);
|
||||
_cur_edit = _rect;
|
||||
connect(_rect, SIGNAL(valueChanged(QRectF)), this, SLOT(_changed()));
|
||||
break;
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
case QVariant::Point:
|
||||
#else
|
||||
case QMetaType::QPoint:
|
||||
#endif
|
||||
_point = new QPointEdit(this);
|
||||
_point->setDecimals(0);
|
||||
_cur_edit = _point;
|
||||
connect(_point, SIGNAL(valueChanged(QPointF)), this, SLOT(_changed()));
|
||||
break;
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
case QVariant::PointF:
|
||||
#else
|
||||
case QMetaType::QPointF:
|
||||
#endif
|
||||
_point = new QPointEdit(this);
|
||||
_point->setDecimals(3);
|
||||
_cur_edit = _point;
|
||||
connect(_point, SIGNAL(valueChanged(QPointF)), this, SLOT(_changed()));
|
||||
break;
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
case QVariant::Date:
|
||||
#else
|
||||
case QMetaType::QDate:
|
||||
#endif
|
||||
_date = new QDateEdit(this);
|
||||
_cur_edit = _date;
|
||||
connect(_date, SIGNAL(dateTimeChanged(QDateTime)), this, SLOT(_changed()));
|
||||
break;
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
case QVariant::Time:
|
||||
#else
|
||||
case QMetaType::QTime:
|
||||
#endif
|
||||
_date = new QTimeEdit(this);
|
||||
_cur_edit = _date;
|
||||
connect(_date, SIGNAL(dateTimeChanged(QDateTime)), this, SLOT(_changed()));
|
||||
break;
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
case QVariant::DateTime:
|
||||
#else
|
||||
case QMetaType::QDateTime:
|
||||
#endif
|
||||
_date = new QDateTimeEdit(this);
|
||||
_cur_edit = _date;
|
||||
connect(_date, SIGNAL(dateTimeChanged(QDateTime)), this, SLOT(_changed()));
|
||||
@@ -351,23 +419,107 @@ void QVariantEdit::_recreate(const QVariant & new_value) {
|
||||
|
||||
|
||||
QVariant QVariantEdit::value() const {
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
switch (_value.type()) {
|
||||
case QVariant::Bool: return _check->isChecked();
|
||||
case QVariant::Int: return int(_spin->value());
|
||||
case QVariant::UInt: return (unsigned int)(_spin->value());
|
||||
case QVariant::LongLong: return qlonglong(_spin->value());
|
||||
case QVariant::ULongLong: return qulonglong(_spin->value());
|
||||
case QVariant::Double: return _espin->value();
|
||||
case QVariant::Color: return _color->color();
|
||||
case QVariant::String: return _line->text();
|
||||
case QVariant::StringList: return _list->value();
|
||||
case QVariant::Rect: return _rect->value().toRect();
|
||||
case QVariant::RectF: return _rect->value();
|
||||
case QVariant::Point: return _point->value().toPoint();
|
||||
case QVariant::PointF: return _point->value();
|
||||
case QVariant::Date: return _date->date();
|
||||
case QVariant::Time: return _date->time();
|
||||
case QVariant::DateTime: return _date->dateTime();
|
||||
#else
|
||||
switch (_value.metaType().id()) {
|
||||
#endif
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
case QVariant::Bool:
|
||||
#else
|
||||
case QMetaType::Bool:
|
||||
#endif
|
||||
return _check->isChecked();
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
case QVariant::Int:
|
||||
#else
|
||||
case QMetaType::Int:
|
||||
#endif
|
||||
return int(_spin->value());
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
case QVariant::UInt:
|
||||
#else
|
||||
case QMetaType::UInt:
|
||||
#endif
|
||||
return (unsigned int)(_spin->value());
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
case QVariant::LongLong:
|
||||
#else
|
||||
case QMetaType::LongLong:
|
||||
#endif
|
||||
return qlonglong(_spin->value());
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
case QVariant::ULongLong:
|
||||
#else
|
||||
case QMetaType::ULongLong:
|
||||
#endif
|
||||
return qulonglong(_spin->value());
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
case QVariant::Double:
|
||||
#else
|
||||
case QMetaType::Double:
|
||||
#endif
|
||||
return _espin->value();
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
case QVariant::Color:
|
||||
#else
|
||||
case QMetaType::QColor:
|
||||
#endif
|
||||
return _color->color();
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
case QVariant::String:
|
||||
#else
|
||||
case QMetaType::QString:
|
||||
#endif
|
||||
return _line->text();
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
case QVariant::StringList:
|
||||
#else
|
||||
case QMetaType::QStringList:
|
||||
#endif
|
||||
return _list->value();
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
case QVariant::Rect:
|
||||
#else
|
||||
case QMetaType::QRect:
|
||||
#endif
|
||||
return _rect->value().toRect();
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
case QVariant::RectF:
|
||||
#else
|
||||
case QMetaType::QRectF:
|
||||
#endif
|
||||
return _rect->value();
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
case QVariant::Point:
|
||||
#else
|
||||
case QMetaType::QPoint:
|
||||
#endif
|
||||
return _point->value().toPoint();
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
case QVariant::PointF:
|
||||
#else
|
||||
case QMetaType::QPointF:
|
||||
#endif
|
||||
return _point->value();
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
case QVariant::Date:
|
||||
#else
|
||||
case QMetaType::QDate:
|
||||
#endif
|
||||
return _date->date();
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
case QVariant::Time:
|
||||
#else
|
||||
case QMetaType::QTime:
|
||||
#endif
|
||||
return _date->time();
|
||||
#if QT_VERSION_MAJOR <= 5
|
||||
case QVariant::DateTime:
|
||||
#else
|
||||
case QMetaType::QDateTime:
|
||||
#endif
|
||||
return _date->dateTime();
|
||||
default:
|
||||
if (_value.canConvert<QAD::Enum>() && _enum) {
|
||||
QAD::Enum ret;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#endif
|
||||
#include "session_manager.h"
|
||||
#include "qad_locations.h"
|
||||
#include "qad_types.h"
|
||||
|
||||
|
||||
SessionManager::SessionManager(QString file) {
|
||||
@@ -107,7 +108,7 @@ void SessionManager::save() {
|
||||
sr.setValue(floats[i].first, *floats[i].second, false);
|
||||
QSet<QObject*> all_list;
|
||||
foreach (QObject * c, tsc) {
|
||||
all_list |= QSet<QObject*>::fromList(c->findChildren<QObject*>());
|
||||
all_list |= QList2QSet(c->findChildren<QObject*>());
|
||||
}
|
||||
QMap<const QMetaObject*, QByteArray> funcs = metaFunctions(all_list, "sessionSave");
|
||||
//qDebug() << "check for save" << all_list.size();
|
||||
@@ -231,7 +232,7 @@ void SessionManager::load(bool onlyMainwindow) {
|
||||
*floats[i].second = sr.getValue(floats[i].first, *floats[i].second).toFloat();
|
||||
QSet<QObject*> all_list;
|
||||
foreach (QObject * c, tsc) {
|
||||
all_list |= QSet<QObject*>::fromList(c->findChildren<QObject*>());
|
||||
all_list |= QList2QSet(c->findChildren<QObject*>());
|
||||
}
|
||||
QMap<const QMetaObject*, QByteArray> funcs = metaFunctions(all_list, "sessionLoad");
|
||||
//qDebug() << "check for load" << all_list.size();
|
||||
|
||||
@@ -117,8 +117,10 @@ private:
|
||||
|
||||
public slots:
|
||||
void save();
|
||||
void load(bool onlyMainwindow = false);
|
||||
void clear(bool with_filename = true);
|
||||
void load(bool onlyMainwindow);
|
||||
void load() {load(false);}
|
||||
void clear(bool with_filename);
|
||||
void clear() {clear(true);}
|
||||
|
||||
signals:
|
||||
void loading(QPIConfig & );
|
||||
|
||||
Reference in New Issue
Block a user