Compare commits
16 Commits
f0c2369df0
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 681a79a672 | |||
| 88bcc7f2e9 | |||
| 04d9cf6edf | |||
| 66dc481d6e | |||
| f8e361190b | |||
| 745376adfb | |||
| 13d4e6cb75 | |||
| 0f13cf5196 | |||
| d403d0a242 | |||
| c959a712f7 | |||
| f9a8f5d6b1 | |||
| 49ae1473f9 | |||
| b8e8a1300e | |||
| 26396a4f72 | |||
| 2cb43ab411 | |||
| 8df58026c4 |
@@ -135,7 +135,7 @@ JavaScriptWrapImports: true
|
|||||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||||
LambdaBodyIndentation: Signature
|
LambdaBodyIndentation: Signature
|
||||||
MacroBlockBegin: "PRIVATE_DEFINITION_START|STATIC_INITIALIZER_BEGIN"
|
MacroBlockBegin: "PRIVATE_DEFINITION_START|STATIC_INITIALIZER_BEGIN"
|
||||||
MacroBlockEnd: "PRIVATE_DEFINITION_END|STATIC_INITIALIZER_END"
|
MacroBlockEnd: "PRIVATE_DEFINITION_END|PRIVATE_DEFINITION_END_NO_INITIALIZE|STATIC_INITIALIZER_END"
|
||||||
MaxEmptyLinesToKeep: 2
|
MaxEmptyLinesToKeep: 2
|
||||||
NamespaceIndentation: None
|
NamespaceIndentation: None
|
||||||
ObjCBinPackProtocolList: Auto
|
ObjCBinPackProtocolList: Auto
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
cmake_minimum_required(VERSION 3.0)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
cmake_policy(SET CMP0017 NEW) # need include() with .cmake
|
cmake_policy(SET CMP0017 NEW) # need include() with .cmake
|
||||||
cmake_policy(SET CMP0072 NEW) # FindOpenGL prefers GLVND by default
|
cmake_policy(SET CMP0072 NEW) # FindOpenGL prefers GLVND by default
|
||||||
project(QAD)
|
project(QAD)
|
||||||
set(QAD_MAJOR 2)
|
set(QAD_MAJOR 2)
|
||||||
set(QAD_MINOR 32)
|
set(QAD_MINOR 32)
|
||||||
set(QAD_REVISION 1)
|
set(QAD_REVISION 2)
|
||||||
set(QAD_SUFFIX )
|
set(QAD_SUFFIX )
|
||||||
set(QAD_COMPANY SHS)
|
set(QAD_COMPANY SHS)
|
||||||
set(QAD_DOMAIN org.SHS)
|
set(QAD_DOMAIN org.SHS)
|
||||||
|
|||||||
@@ -137,6 +137,9 @@ endif()
|
|||||||
if (POLICY CMP0074)
|
if (POLICY CMP0074)
|
||||||
cmake_policy(SET CMP0074 NEW) # ignore <PackageName>_ROOT variables
|
cmake_policy(SET CMP0074 NEW) # ignore <PackageName>_ROOT variables
|
||||||
endif()
|
endif()
|
||||||
|
if (POLICY CMP0177)
|
||||||
|
cmake_policy(SET CMP0177 OLD)
|
||||||
|
endif()
|
||||||
set(__qt_bug_modules "UiTools")
|
set(__qt_bug_modules "UiTools")
|
||||||
|
|
||||||
set(__qt_modules_4 "CLucene;Core;Declarative;Gui;Help;main;Multimedia;Network;OpenGL;\
|
set(__qt_modules_4 "CLucene;Core;Declarative;Gui;Help;main;Multimedia;Network;OpenGL;\
|
||||||
@@ -723,7 +726,7 @@ macro(qad_target_link_libraries _NAME)
|
|||||||
list(APPEND _ARGS ${_i})
|
list(APPEND _ARGS ${_i})
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
target_link_libraries(${_TARGET} ${Qt${_v}_LIBRARIES} ${_ARGS})
|
target_link_libraries(${_TARGET} ${_ARGS} ${Qt${_v}_LIBRARIES})
|
||||||
#message("link ${_TARGET}: ${Qt${_v}_LIBRARIES} ${_ARGS}")
|
#message("link ${_TARGET}: ${Qt${_v}_LIBRARIES} ${_ARGS}")
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|||||||
@@ -342,6 +342,7 @@ void Graphic::procGesture(QGesture * g) {
|
|||||||
QPointF dp = -pg->delta();
|
QPointF dp = -pg->delta();
|
||||||
dp.rx() /= getScaleX();
|
dp.rx() /= getScaleX();
|
||||||
dp.ry() /= getScaleY();
|
dp.ry() /= getScaleY();
|
||||||
|
dp.ry() = -dp.y();
|
||||||
selrect.translate(dp);
|
selrect.translate(dp);
|
||||||
totalUpdate();
|
totalUpdate();
|
||||||
} break;
|
} break;
|
||||||
@@ -357,11 +358,7 @@ void Graphic::procGesture(QGesture * g) {
|
|||||||
} break;
|
} break;
|
||||||
case Qt::TapAndHoldGesture: {
|
case Qt::TapAndHoldGesture: {
|
||||||
QTapAndHoldGesture * pg = (QTapAndHoldGesture *)g;
|
QTapAndHoldGesture * pg = (QTapAndHoldGesture *)g;
|
||||||
if (pg->state() == Qt::GestureStarted)
|
if (pg->state() == Qt::GestureStarted) QMetaObject::invokeMethod(this, [this]() { showMenu(); }, Qt::QueuedConnection);
|
||||||
QMetaObject::invokeMethod(
|
|
||||||
this,
|
|
||||||
[this]() { showMenu(); },
|
|
||||||
Qt::QueuedConnection);
|
|
||||||
} break;
|
} break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -255,7 +255,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="qad_graphic.qrc">
|
<iconset resource="qad_graphic.qrc">
|
||||||
<normaloff>:/icons/zoom-original.png</normaloff>:/icons/zoom-original.png</iconset>
|
<normaloff>:/icons/zoom-original.png</normaloff>:/icons/zoom-original.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -505,6 +505,9 @@
|
|||||||
<property name="shortcut">
|
<property name="shortcut">
|
||||||
<string>Esc</string>
|
<string>Esc</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="shortcutContext">
|
||||||
|
<enum>Qt::WidgetShortcut</enum>
|
||||||
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionCheck_all">
|
<action name="actionCheck_all">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
|
|||||||
@@ -182,6 +182,7 @@ void GraphicAnalysis::updateGraphic(int index) {
|
|||||||
void GraphicAnalysis::updateAllGraphic() {
|
void GraphicAnalysis::updateAllGraphic() {
|
||||||
for (int i = 0; i < graphicsCount(); ++i)
|
for (int i = 0; i < graphicsCount(); ++i)
|
||||||
updateGraphic(i);
|
updateGraphic(i);
|
||||||
|
updateGraphics();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -261,11 +262,13 @@ void GraphicAnalysis::addPoint(const QPointF & p, int graphic, bool update_) {
|
|||||||
|
|
||||||
void GraphicAnalysis::setGraphicTransformFunction(std::function<QPolygonF(const QPolygonF &)> f) {
|
void GraphicAnalysis::setGraphicTransformFunction(std::function<QPolygonF(const QPolygonF &)> f) {
|
||||||
tf_gr = f;
|
tf_gr = f;
|
||||||
|
updateAllGraphic();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GraphicAnalysis::setSpectrumTransformFunction(std::function<QPolygonF(const QPolygonF &)> f) {
|
void GraphicAnalysis::setSpectrumTransformFunction(std::function<QPolygonF(const QPolygonF &)> f) {
|
||||||
tf_fft = f;
|
tf_fft = f;
|
||||||
|
updateAllGraphic();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,9 @@
|
|||||||
#include "osm_math_p.h"
|
#include "osm_math_p.h"
|
||||||
|
|
||||||
|
|
||||||
MapItemBase::MapItemBase() {}
|
MapItemBase::MapItemBase() {
|
||||||
|
m_hints = QPainter::Antialiasing | QPainter::SmoothPixmapTransform;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
MapItemBase::~MapItemBase() {
|
MapItemBase::~MapItemBase() {
|
||||||
@@ -19,6 +21,18 @@ void MapItemBase::setInteracive(bool newInteracive) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MapItemBase::setRenderHints(QPainter::RenderHints h) {
|
||||||
|
m_hints = h;
|
||||||
|
updateParent();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MapItemBase::setRenderHint(QPainter::RenderHint h, bool on) {
|
||||||
|
m_hints.setFlag(h, on);
|
||||||
|
updateParent();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MapItemBase::setVisible(bool newVisible) {
|
void MapItemBase::setVisible(bool newVisible) {
|
||||||
m_visible = newVisible;
|
m_visible = newVisible;
|
||||||
updateParent();
|
updateParent();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
QAD - Qt ADvanced
|
QAD - Qt ADvanced
|
||||||
|
|
||||||
Ivan Pelipenko peri4ko@yandex.ru
|
Ivan Pelipenko peri4ko@yandex.ru
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
@@ -38,10 +38,13 @@ public:
|
|||||||
explicit MapItemBase();
|
explicit MapItemBase();
|
||||||
virtual ~MapItemBase();
|
virtual ~MapItemBase();
|
||||||
|
|
||||||
|
|
||||||
bool isInteracive() const { return m_interacive; }
|
bool isInteracive() const { return m_interacive; }
|
||||||
void setInteracive(bool newInteracive);
|
void setInteracive(bool newInteracive);
|
||||||
|
|
||||||
|
QPainter::RenderHints renderHints() const { return m_hints; }
|
||||||
|
void setRenderHints(QPainter::RenderHints h);
|
||||||
|
void setRenderHint(QPainter::RenderHint h, bool on = true);
|
||||||
|
|
||||||
bool isVisible() const { return m_visible; }
|
bool isVisible() const { return m_visible; }
|
||||||
void setVisible(bool newVisible);
|
void setVisible(bool newVisible);
|
||||||
bool isHidden() const { return !isVisible(); }
|
bool isHidden() const { return !isVisible(); }
|
||||||
@@ -97,6 +100,7 @@ private:
|
|||||||
QPointF m_position, m_scale = {1., 1.}, m_offset;
|
QPointF m_position, m_scale = {1., 1.}, m_offset;
|
||||||
QRectF m_bounding;
|
QRectF m_bounding;
|
||||||
QCursor m_cursor;
|
QCursor m_cursor;
|
||||||
|
QPainter::RenderHints m_hints;
|
||||||
QMap<int, QVariant> data_;
|
QMap<int, QVariant> data_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -81,6 +81,12 @@ void MapView::setZoom(double z) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MapView::setContrast(double value) {
|
||||||
|
contrast = piClampd(value, 0., 100.);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QString MapView::cachePath() const {
|
QString MapView::cachePath() const {
|
||||||
return cache->cacheRoot();
|
return cache->cacheRoot();
|
||||||
}
|
}
|
||||||
@@ -258,6 +264,11 @@ void MapView::wheelEvent(QWheelEvent * e) {
|
|||||||
void MapView::paintEvent(QPaintEvent *) {
|
void MapView::paintEvent(QPaintEvent *) {
|
||||||
QPainter p(this);
|
QPainter p(this);
|
||||||
p.drawPixmap(0, 0, background);
|
p.drawPixmap(0, 0, background);
|
||||||
|
if (contrast < 100.) {
|
||||||
|
auto col = palette().color(QPalette::Window);
|
||||||
|
col.setAlphaF(1. - contrast / 100.);
|
||||||
|
p.fillRect(rect(), col);
|
||||||
|
}
|
||||||
drawItems(p);
|
drawItems(p);
|
||||||
updateMouse(mapFromGlobal(QCursor::pos()));
|
updateMouse(mapFromGlobal(QCursor::pos()));
|
||||||
}
|
}
|
||||||
@@ -309,8 +320,7 @@ void MapView::drawBackground() {
|
|||||||
|
|
||||||
void MapView::drawItems(QPainter & p) {
|
void MapView::drawItems(QPainter & p) {
|
||||||
auto src_tr = p.transform();
|
auto src_tr = p.transform();
|
||||||
p.setRenderHint(QPainter::Antialiasing);
|
QPainter::RenderHints cur_hints;
|
||||||
p.setRenderHint(QPainter::SmoothPixmapTransform);
|
|
||||||
QPoint mouse = mapFromGlobal(QCursor::pos());
|
QPoint mouse = mapFromGlobal(QCursor::pos());
|
||||||
MapItemBase * hover = nullptr;
|
MapItemBase * hover = nullptr;
|
||||||
for (auto * i: items_) {
|
for (auto * i: items_) {
|
||||||
@@ -321,6 +331,10 @@ void MapView::drawItems(QPainter & p) {
|
|||||||
p.translate(i->m_offset.x(), -i->m_offset.y());
|
p.translate(i->m_offset.x(), -i->m_offset.y());
|
||||||
p.rotate(i->getRotation());
|
p.rotate(i->getRotation());
|
||||||
if (!i->ignore_scale) p.scale(i->getScale().x(), i->getScale().y());
|
if (!i->ignore_scale) p.scale(i->getScale().x(), i->getScale().y());
|
||||||
|
if (cur_hints != i->renderHints()) {
|
||||||
|
cur_hints = i->renderHints();
|
||||||
|
p.setRenderHints(cur_hints);
|
||||||
|
}
|
||||||
i->draw(&p);
|
i->draw(&p);
|
||||||
QTransform mtr;
|
QTransform mtr;
|
||||||
mtr.rotate(-i->getRotation());
|
mtr.rotate(-i->getRotation());
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ class QAD_MAP_EXPORT MapView: public QWidget {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(QPointF center READ center WRITE setCenter)
|
Q_PROPERTY(QPointF center READ center WRITE setCenter)
|
||||||
Q_PROPERTY(double zoom READ getZoom WRITE setZoom)
|
Q_PROPERTY(double zoom READ getZoom WRITE setZoom)
|
||||||
|
Q_PROPERTY(double contrast READ getContrast WRITE setContrast)
|
||||||
Q_PROPERTY(bool offlineMode READ isOfflineMode WRITE setOfflineMode)
|
Q_PROPERTY(bool offlineMode READ isOfflineMode WRITE setOfflineMode)
|
||||||
|
|
||||||
friend class MapViewTileDownloader;
|
friend class MapViewTileDownloader;
|
||||||
@@ -58,6 +59,12 @@ public:
|
|||||||
double getZoom() const { return zoom_; }
|
double getZoom() const { return zoom_; }
|
||||||
void setZoom(double z);
|
void setZoom(double z);
|
||||||
|
|
||||||
|
double getContrast() const { return contrast; }
|
||||||
|
|
||||||
|
/// 0 - 100
|
||||||
|
void setContrast(double value);
|
||||||
|
|
||||||
|
/// {lat, lng}
|
||||||
QPointF clickedCoordinate() const { return last_click_coord; }
|
QPointF clickedCoordinate() const { return last_click_coord; }
|
||||||
|
|
||||||
QString cachePath() const;
|
QString cachePath() const;
|
||||||
@@ -107,7 +114,7 @@ private:
|
|||||||
QVector<MapItemBase *> items_;
|
QVector<MapItemBase *> items_;
|
||||||
QBrush brush_tr;
|
QBrush brush_tr;
|
||||||
bool is_pan = false, is_downloading = false, is_offline = false;
|
bool is_pan = false, is_downloading = false, is_offline = false;
|
||||||
double zoom_ = 1., scale_ = 1., px2m = 1.;
|
double zoom_ = 1., scale_ = 1., px2m = 1., contrast = 100.;
|
||||||
int zoom_level = 0, tiles_side = 1, max_level = 19;
|
int zoom_level = 0, tiles_side = 1, max_level = 19;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include "mapview_types.h"
|
#include "mapview_types.h"
|
||||||
#include "qad_map_export.h"
|
#include "qad_map_export.h"
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <pivaluetree.h>
|
#include <pivaluetree.h>
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
MapViewTileProvider_MapTiler::MapViewTileProvider_MapTiler() {
|
MapViewTileProvider_MapTiler::MapViewTileProvider_MapTiler() {
|
||||||
nam = new QNetworkAccessManager();
|
nam = new QNetworkAccessManager();
|
||||||
PIValueTree p;
|
PIValueTree p;
|
||||||
p.addChild(PIValueTree("url", "https://api.maptiler.com/maps"));
|
p.addChild(PIValueTree("url", "https://api.maptiler.com/tiles"));
|
||||||
p.addChild(PIValueTree("key", ""));
|
p.addChild(PIValueTree("key", ""));
|
||||||
p.addChild(PIValueTree("tileset", ""));
|
p.addChild(PIValueTree("tileset", ""));
|
||||||
initParameters(p);
|
initParameters(p);
|
||||||
@@ -32,11 +32,15 @@ bool MapViewTileProvider_MapTiler::requestTile(MapViewTypes::TileIndex index) {
|
|||||||
req.setHeader(QNetworkRequest::UserAgentHeader, "Qt/5");
|
req.setHeader(QNetworkRequest::UserAgentHeader, "Qt/5");
|
||||||
auto * r = nam->get(req);
|
auto * r = nam->get(req);
|
||||||
if (!r) return false;
|
if (!r) return false;
|
||||||
// qDebug() << "Reqst:" << index.z << index.x << index.y;
|
// qDebug() << "Reqst:" << index.z << index.x << index.y << req.url().toString();
|
||||||
connect(r, &QNetworkReply::finished, this, [this, r, index]() {
|
connect(r, &QNetworkReply::finished, this, [this, r, index]() {
|
||||||
r->deleteLater();
|
r->deleteLater();
|
||||||
QPixmap tim;
|
QPixmap tim;
|
||||||
if (r->error() != QNetworkReply::NoError) {
|
if (r->error() != QNetworkReply::NoError) {
|
||||||
|
if (r->error() == QNetworkReply::ContentAccessDenied) {
|
||||||
|
qDebug() << "Error:" << index.z << index.x << index.y << r->error();
|
||||||
|
return;
|
||||||
|
}
|
||||||
qDebug() << "Retry:" << index.z << index.x << index.y << r->error();
|
qDebug() << "Retry:" << index.z << index.x << index.y << r->error();
|
||||||
QTimer::singleShot(500, this, [this, index] { requestTile(index); });
|
QTimer::singleShot(500, this, [this, index] { requestTile(index); });
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
MapViewTileProvider_OSM::MapViewTileProvider_OSM() {
|
MapViewTileProvider_OSM::MapViewTileProvider_OSM() {
|
||||||
nam = new QNetworkAccessManager();
|
nam = new QNetworkAccessManager();
|
||||||
PIValueTree p;
|
PIValueTree p;
|
||||||
p.addChild(PIValueTree("url", "http://tile.openstreetmap.org"));
|
p.addChild(PIValueTree("url", "https://tile.openstreetmap.org"));
|
||||||
initParameters(p);
|
initParameters(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "mapplugin.h"
|
#include "mapplugin.h"
|
||||||
|
|
||||||
#include "mapview.h"
|
#include "mapview.h"
|
||||||
|
#include "mapview_tile_provider_osm.h"
|
||||||
|
|
||||||
#include <QtCore/QtPlugin>
|
#include <QtCore/QtPlugin>
|
||||||
|
|
||||||
@@ -26,6 +27,7 @@ bool MapPlugin::isInitialized() const {
|
|||||||
|
|
||||||
QWidget * MapPlugin::createWidget(QWidget * parent) {
|
QWidget * MapPlugin::createWidget(QWidget * parent) {
|
||||||
MapView * w = new MapView(parent);
|
MapView * w = new MapView(parent);
|
||||||
|
w->setTileProvider(new MapViewTileProvider_OSM());
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -887,6 +887,32 @@ inline PICout operator<<(PICout s, const QColor & v) {
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline PICout operator<<(PICout s, const QVector2D & v) {
|
||||||
|
s << PIMathVectorT2d({v[0], v[1]});
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline PICout operator<<(PICout s, const QVector3D & v) {
|
||||||
|
s << PIMathVectorT3d({v[0], v[1], v[2]});
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline PICout operator<<(PICout s, const QVector4D & v) {
|
||||||
|
s << PIMathVectorT4d({v[0], v[1], v[2], v[3]});
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<int N, int M, typename T>
|
||||||
|
inline PICout operator<<(PICout s, const QGenericMatrix<N, M, T> & v) {
|
||||||
|
s << Q2PIMathMatrixT(v);
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline PICout operator<<(PICout s, const QMatrix4x4 & v) {
|
||||||
|
s << Q2PIMathMatrixT(v);
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef PIQT_HAS_GEOPOSITION
|
#ifdef PIQT_HAS_GEOPOSITION
|
||||||
inline PICout operator<<(PICout s, const QGeoCoordinate & v) {
|
inline PICout operator<<(PICout s, const QGeoCoordinate & v) {
|
||||||
s << Q2PIGeoPosition(v);
|
s << Q2PIGeoPosition(v);
|
||||||
|
|||||||
@@ -608,7 +608,7 @@ void PIValueTreeEdit::applyVariantEdit(PIVariantEdit * ve, const PIValueTree & v
|
|||||||
ve->setAttributes(attributesWithRO(vt.attributes()));
|
ve->setAttributes(attributesWithRO(vt.attributes()));
|
||||||
ve->setValue(vt.value());
|
ve->setValue(vt.value());
|
||||||
ve->setFullEditMode(is_full_edit);
|
ve->setFullEditMode(is_full_edit);
|
||||||
ve->setToolTip(PI2QString(vt.attribute(PIValueTree::Attribute::toolTip).toString()));
|
ve->setToolTip(PIVariantEditorBase::vtTr(vt.attribute(PIValueTree::Attribute::toolTip).toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
#include <QScreen>
|
||||||
|
|
||||||
|
|
||||||
QCodeEditCompleter::QCodeEditCompleter(QWidget * parent): QTreeWidget(parent) {
|
QCodeEditCompleter::QCodeEditCompleter(QWidget * parent): QTreeWidget(parent) {
|
||||||
@@ -79,8 +80,13 @@ void QCodeEditCompleter::invoke(QPoint global_pos) {
|
|||||||
setCurrentItem(topLevelItem(1));
|
setCurrentItem(topLevelItem(1));
|
||||||
if (isHidden()) move(global_pos);
|
if (isHidden()) move(global_pos);
|
||||||
if (topLevelItemCount() > 0) {
|
if (topLevelItemCount() > 0) {
|
||||||
|
const auto screen = qApp->screenAt(global_pos);
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
adjust();
|
adjust();
|
||||||
|
if (global_pos.y() + height() > screen->availableSize().height()) {
|
||||||
|
global_pos.setY(global_pos.y() -height() - fontHeight(this));
|
||||||
|
}
|
||||||
|
move(global_pos);
|
||||||
} else {
|
} else {
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,6 +97,8 @@ void SessionManager::save() {
|
|||||||
sr.setValue(buttons[i].first, buttons[i].second->isChecked(), false);
|
sr.setValue(buttons[i].first, buttons[i].second->isChecked(), false);
|
||||||
for (int i = 0; i < stacks.size(); ++i)
|
for (int i = 0; i < stacks.size(); ++i)
|
||||||
sr.setValue(stacks[i].first, stacks[i].second->currentIndex(), false);
|
sr.setValue(stacks[i].first, stacks[i].second->currentIndex(), false);
|
||||||
|
for (int i = 0; i < sliders.size(); ++i)
|
||||||
|
sr.setValue(sliders[i].first, sliders[i].second->value(), false);
|
||||||
for (int i = 0; i < actions.size(); ++i)
|
for (int i = 0; i < actions.size(); ++i)
|
||||||
sr.setValue(actions[i].first, actions[i].second->isChecked(), false);
|
sr.setValue(actions[i].first, actions[i].second->isChecked(), false);
|
||||||
for (int i = 0; i < stringlists.size(); ++i)
|
for (int i = 0; i < stringlists.size(); ++i)
|
||||||
@@ -221,6 +223,8 @@ void SessionManager::load(bool onlyMainwindow) {
|
|||||||
for (int i = 0; i < stacks.size(); ++i)
|
for (int i = 0; i < stacks.size(); ++i)
|
||||||
stacks[i].second->setCurrentIndex(
|
stacks[i].second->setCurrentIndex(
|
||||||
qMin<int>(sr.getValue(stacks[i].first, stacks[i].second->currentIndex()).toInt(), stacks[i].second->count()));
|
qMin<int>(sr.getValue(stacks[i].first, stacks[i].second->currentIndex()).toInt(), stacks[i].second->count()));
|
||||||
|
for (int i = 0; i < sliders.size(); ++i)
|
||||||
|
sliders[i].second->setValue(sr.getValue(sliders[i].first, sliders[i].second->value()).toInt());
|
||||||
for (int i = 0; i < actions.size(); ++i)
|
for (int i = 0; i < actions.size(); ++i)
|
||||||
actions[i].second->setChecked(sr.getValue(actions[i].first, actions[i].second->isChecked()).toBool());
|
actions[i].second->setChecked(sr.getValue(actions[i].first, actions[i].second->isChecked()).toBool());
|
||||||
for (int i = 0; i < stringlists.size(); ++i)
|
for (int i = 0; i < stringlists.size(); ++i)
|
||||||
@@ -267,6 +271,7 @@ void SessionManager::clear(bool with_filename) {
|
|||||||
tabs.clear();
|
tabs.clear();
|
||||||
buttons.clear();
|
buttons.clear();
|
||||||
stacks.clear();
|
stacks.clear();
|
||||||
|
sliders.clear();
|
||||||
actions.clear();
|
actions.clear();
|
||||||
stringlists.clear();
|
stringlists.clear();
|
||||||
strings.clear();
|
strings.clear();
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ public:
|
|||||||
void addEntry(QAction * e) { addEntry(e->objectName(), e); }
|
void addEntry(QAction * e) { addEntry(e->objectName(), e); }
|
||||||
void addEntry(QAbstractButton * e) { addEntry(e->objectName(), e); }
|
void addEntry(QAbstractButton * e) { addEntry(e->objectName(), e); }
|
||||||
void addEntry(QStackedWidget * e) { addEntry(e->objectName(), e); }
|
void addEntry(QStackedWidget * e) { addEntry(e->objectName(), e); }
|
||||||
|
void addEntry(QSlider * e) { addEntry(e->objectName(), e); }
|
||||||
void addMainWidget(QWidget * e) { addMainWidget(e->objectName(), e); }
|
void addMainWidget(QWidget * e) { addMainWidget(e->objectName(), e); }
|
||||||
void removeMainWidget(QWidget * e);
|
void removeMainWidget(QWidget * e);
|
||||||
|
|
||||||
@@ -81,6 +82,7 @@ public:
|
|||||||
void addEntry(const QString & name, QGroupBox * e) { groups.push_back(QPair<QString, QGroupBox *>(name, e)); }
|
void addEntry(const QString & name, QGroupBox * e) { groups.push_back(QPair<QString, QGroupBox *>(name, e)); }
|
||||||
void addEntry(const QString & name, QAbstractButton * e) { buttons.push_back(QPair<QString, QAbstractButton *>(name, e)); }
|
void addEntry(const QString & name, QAbstractButton * e) { buttons.push_back(QPair<QString, QAbstractButton *>(name, e)); }
|
||||||
void addEntry(const QString & name, QStackedWidget * e) { stacks.push_back(QPair<QString, QStackedWidget *>(name, e)); }
|
void addEntry(const QString & name, QStackedWidget * e) { stacks.push_back(QPair<QString, QStackedWidget *>(name, e)); }
|
||||||
|
void addEntry(const QString & name, QSlider * e) { sliders.push_back(QPair<QString, QSlider *>(name, e)); }
|
||||||
void addEntry(const QString & name, QAction * e) { actions.push_back(QPair<QString, QAction *>(name, e)); }
|
void addEntry(const QString & name, QAction * e) { actions.push_back(QPair<QString, QAction *>(name, e)); }
|
||||||
void addEntry(const QString & name, QStringList * e) { stringlists.push_back(QPair<QString, QStringList *>(name, e)); }
|
void addEntry(const QString & name, QStringList * e) { stringlists.push_back(QPair<QString, QStringList *>(name, e)); }
|
||||||
void addEntry(const QString & name, QString * e) { strings.push_back(QPair<QString, QString *>(name, e)); }
|
void addEntry(const QString & name, QString * e) { strings.push_back(QPair<QString, QString *>(name, e)); }
|
||||||
@@ -106,6 +108,7 @@ private:
|
|||||||
QVector<QPair<QString, QGroupBox *>> groups;
|
QVector<QPair<QString, QGroupBox *>> groups;
|
||||||
QVector<QPair<QString, QAbstractButton *>> buttons;
|
QVector<QPair<QString, QAbstractButton *>> buttons;
|
||||||
QVector<QPair<QString, QStackedWidget *>> stacks;
|
QVector<QPair<QString, QStackedWidget *>> stacks;
|
||||||
|
QVector<QPair<QString, QSlider *>> sliders;
|
||||||
QVector<QPair<QString, QAction *>> actions;
|
QVector<QPair<QString, QAction *>> actions;
|
||||||
QVector<QPair<QString, QStringList *>> stringlists;
|
QVector<QPair<QString, QStringList *>> stringlists;
|
||||||
QVector<QPair<QString, QString *>> strings;
|
QVector<QPair<QString, QString *>> strings;
|
||||||
|
|||||||
Reference in New Issue
Block a user