Compare commits

...

18 Commits

Author SHA1 Message Date
681a79a672 some fixes 2025-11-28 22:18:37 +03:00
88bcc7f2e9 OSM map tile provider change default to https 2025-10-08 16:56:01 +03:00
04d9cf6edf .clang-format 2025-09-21 21:08:26 +03:00
66dc481d6e .clang-format 2025-09-19 17:39:59 +03:00
f8e361190b version 2.32.2 2025-07-17 11:17:32 +03:00
745376adfb Merge branch 'master' of https://git.shstk.ru/SHS/qad 2025-07-13 00:28:58 +03:00
13d4e6cb75 gesture pitch & pan fix 2025-07-13 00:28:53 +03:00
0f13cf5196 qcodeedit fix incorrect completer position 2025-06-26 17:43:02 +03:00
d403d0a242 maps no retry on access denied 2025-06-10 00:02:41 +03:00
c959a712f7 fix Esc shortcut 2025-06-09 23:41:58 +03:00
f9a8f5d6b1 qad_target_link_libraries now link Qt libs after all other 2025-06-07 10:57:06 +03:00
49ae1473f9 new cmake 2025-04-29 21:51:03 +03:00
b8e8a1300e more piCout operators in piqt.h 2025-03-20 18:48:17 +03:00
26396a4f72 add MapItemBase::renderHints 2025-03-20 18:43:42 +03:00
2cb43ab411 add QSlider to SessionManager 2025-03-20 10:22:28 +03:00
8df58026c4 fix for Qt6
MapView add contrast property
MapView fix plugin
2025-03-19 22:03:51 +03:00
f0c2369df0 fix MapView, so tile provider can be accessible
add MapViewTileProviderBase::maximumLevel()
2025-03-18 16:24:02 +03:00
a0f2d80b4f MapViewTileProviderBase add cacheDir() 2025-03-18 15:17:14 +03:00
28 changed files with 216 additions and 85 deletions

View File

@@ -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

View File

@@ -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)

View File

@@ -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()

View File

@@ -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;
} }

View File

@@ -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">

View File

@@ -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();
} }

View File

@@ -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();

View File

@@ -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_;
}; };

View File

@@ -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();
} }
@@ -104,6 +110,7 @@ void MapView::setTileObsoleteTime(int secs) {
void MapView::setTileProvider(MapViewTileProviderBase * p) { void MapView::setTileProvider(MapViewTileProviderBase * p) {
if (p) max_level = p->maximumLevel();
cache->clearCache(); cache->clearCache();
downloader->setTileProvider(p); downloader->setTileProvider(p);
drawBackground(); drawBackground();
@@ -116,8 +123,8 @@ MapViewTileProviderBase * MapView::tileProvider() const {
void collectDownloadIndeces(MapViewTileCache * cache, void collectDownloadIndeces(MapViewTileCache * cache,
QQueue<OSM::TileIndex> & indeces, QQueue<MapViewTypes::TileIndex> & indeces,
OSM::TileIndex index, MapViewTypes::TileIndex index,
int target_zoom_level, int target_zoom_level,
bool only_new) { bool only_new) {
if (only_new) { if (only_new) {
@@ -130,7 +137,7 @@ void collectDownloadIndeces(MapViewTileCache * cache,
int y = index.y * 2; int y = index.y * 2;
for (int i = 0; i < 2; ++i) { for (int i = 0; i < 2; ++i) {
for (int j = 0; j < 2; ++j) { for (int j = 0; j < 2; ++j) {
collectDownloadIndeces(cache, indeces, (OSM::TileIndex){z, x + i, y + j}, target_zoom_level, only_new); collectDownloadIndeces(cache, indeces, (MapViewTypes::TileIndex){z, x + i, y + j}, target_zoom_level, only_new);
} }
} }
} }
@@ -142,10 +149,10 @@ void MapView::downloadCurrentView(int target_zoom_level, bool only_new, int para
int ex = qMin(tiles_side, (int)ceil(view_rect.right() * tiles_side)); int ex = qMin(tiles_side, (int)ceil(view_rect.right() * tiles_side));
int ey = qMin(tiles_side, (int)ceil(view_rect.bottom() * tiles_side)); int ey = qMin(tiles_side, (int)ceil(view_rect.bottom() * tiles_side));
target_zoom_level = qMin(target_zoom_level, max_level); target_zoom_level = qMin(target_zoom_level, max_level);
QQueue<OSM::TileIndex> indeces; QQueue<MapViewTypes::TileIndex> indeces;
for (int ix = sx; ix < ex; ++ix) { for (int ix = sx; ix < ex; ++ix) {
for (int iy = sy; iy < ey; ++iy) { for (int iy = sy; iy < ey; ++iy) {
collectDownloadIndeces(cache, indeces, (OSM::TileIndex){zoom_level, ix, iy}, target_zoom_level, only_new); collectDownloadIndeces(cache, indeces, (MapViewTypes::TileIndex){zoom_level, ix, iy}, target_zoom_level, only_new);
} }
} }
if (indeces.size() < 4) return; if (indeces.size() < 4) return;
@@ -257,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()));
} }
@@ -291,7 +303,7 @@ void MapView::drawBackground() {
QRectF r((ix)*ts, (iy)*ts, ts, ts); QRectF r((ix)*ts, (iy)*ts, ts, ts);
r.translate(-offset); r.translate(-offset);
QRectF px_rct(QPointF(), tile_size /*QSizeF(tileSize, tileSize)*/); QRectF px_rct(QPointF(), tile_size /*QSizeF(tileSize, tileSize)*/);
auto tile = cache->getTile((OSM::TileIndex){zoom_level, ix, iy}, px_rct); auto tile = cache->getTile((MapViewTypes::TileIndex){zoom_level, ix, iy}, px_rct);
if (!tile.isEmpty()) { if (!tile.isEmpty()) {
p.drawPixmap(r, tile.pixmap, px_rct); p.drawPixmap(r, tile.pixmap, px_rct);
} else { } else {
@@ -308,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_) {
@@ -320,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());
@@ -360,7 +375,7 @@ void MapView::zoomLevelChanged(int new_level) {
tiles_side = 1 << zoom_level; tiles_side = 1 << zoom_level;
// for (int x = 0; x < tiles_side; ++x) // for (int x = 0; x < tiles_side; ++x)
// for (int y = 0; y < tiles_side; ++y) // for (int y = 0; y < tiles_side; ++y)
// downloader->queueTile(OSM::TileIndex{zoom_level, x, y}); // downloader->queueTile(MapViewTypes::TileIndex{zoom_level, x, y});
} }

View File

@@ -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:

View File

@@ -5,8 +5,8 @@
MapViewTileCache::MapViewTileCache(MapView * p): QThread() { MapViewTileCache::MapViewTileCache(MapView * p): QThread() {
qRegisterMetaType<OSM::TileIndex>(); qRegisterMetaType<MapViewTypes::TileIndex>();
qRegisterMetaType<OSM::TilePixmap>(); qRegisterMetaType<MapViewTypes::TilePixmap>();
parent = p; parent = p;
setCacheRoot(QAD::userPath(QAD::ltCache, "mapview") + "/"); setCacheRoot(QAD::userPath(QAD::ltCache, "mapview") + "/");
setAdditionalCacheSize(64); setAdditionalCacheSize(64);
@@ -21,16 +21,16 @@ MapViewTileCache::~MapViewTileCache() {
} }
void MapViewTileCache::tileDownloaded(OSM::TileIndex index, const QPixmap & pixmap) { void MapViewTileCache::tileDownloaded(MapViewTypes::TileIndex index, const QPixmap & pixmap) {
auto * tile = new OSM::TilePixmap(); auto * tile = new MapViewTypes::TilePixmap();
tile->index = index; tile->index = index;
tile->pixmap = pixmap; tile->pixmap = pixmap;
saveTile(tile); saveTile(tile);
} }
OSM::TilePixmap MapViewTileCache::getTile(OSM::TileIndex index, QRectF & rect_src) { MapViewTypes::TilePixmap MapViewTileCache::getTile(MapViewTypes::TileIndex index, QRectF & rect_src) {
OSM::TilePixmap ret = getTileFromCache(index); MapViewTypes::TilePixmap ret = getTileFromCache(index);
if (ret.isEmpty() || ret.obsolete) { if (ret.isEmpty() || ret.obsolete) {
if (!is_offline) parent->downloader->queueTile(index); if (!is_offline) parent->downloader->queueTile(index);
} }
@@ -61,7 +61,7 @@ void MapViewTileCache::clearCache() {
} }
bool MapViewTileCache::isTileFileExists(OSM::TileIndex index) const { bool MapViewTileCache::isTileFileExists(MapViewTypes::TileIndex index) const {
QString hashdir = index.cacheDir(); QString hashdir = index.cacheDir();
if (!cache_dir.exists(hashdir)) return false; if (!cache_dir.exists(hashdir)) return false;
QString hashname = hashdir + "/" + index.hashName(); QString hashname = hashdir + "/" + index.hashName();
@@ -79,7 +79,7 @@ void MapViewTileCache::tileProviderChanged() {
cache_dir.setPath(cache_root); cache_dir.setPath(cache_root);
auto * provider = parent->downloader->provider; auto * provider = parent->downloader->provider;
if (provider) { if (provider) {
cache_dir.setPath(cache_root + "/" + provider->name()); cache_dir.setPath(cache_root + "/" + provider->cacheDir());
} }
qDebug() << "[MapViewTileCache] Cache dir" << cache_dir.absolutePath(); qDebug() << "[MapViewTileCache] Cache dir" << cache_dir.absolutePath();
if (!cache_dir.exists()) cache_dir.mkpath("."); if (!cache_dir.exists()) cache_dir.mkpath(".");
@@ -91,8 +91,8 @@ void MapViewTileCache::setOfflineMode(bool yes) {
} }
OSM::TilePixmap MapViewTileCache::getTileFromCache(OSM::TileIndex index) { MapViewTypes::TilePixmap MapViewTileCache::getTileFromCache(MapViewTypes::TileIndex index) {
OSM::TilePixmap ret; MapViewTypes::TilePixmap ret;
ret.index = index; ret.index = index;
auto * tile = tile_cache[index.hash()]; auto * tile = tile_cache[index.hash()];
if (tile) { if (tile) {
@@ -104,7 +104,7 @@ OSM::TilePixmap MapViewTileCache::getTileFromCache(OSM::TileIndex index) {
if (cache_dir.exists(hashname)) { if (cache_dir.exists(hashname)) {
QString fname = cache_dir.absoluteFilePath(hashname); QString fname = cache_dir.absoluteFilePath(hashname);
ret.pixmap.load(fname, "png"); ret.pixmap.load(fname, "png");
tile = new OSM::TilePixmap(); tile = new MapViewTypes::TilePixmap();
tile->index = index; tile->index = index;
tile->pixmap = ret.pixmap; tile->pixmap = ret.pixmap;
if (secs_obsolete > 0) { if (secs_obsolete > 0) {
@@ -125,7 +125,7 @@ void MapViewTileCache::updateCacheSize() {
} }
void MapViewTileCache::saveTile(OSM::TilePixmap * tile) { void MapViewTileCache::saveTile(MapViewTypes::TilePixmap * tile) {
tile_cache.insert(tile->index.hash(), tile, tile->pixmapBytes()); tile_cache.insert(tile->index.hash(), tile, tile->pixmapBytes());
emit tileReady(*tile); emit tileReady(*tile);
cond_mutex.lock(); cond_mutex.lock();
@@ -137,7 +137,7 @@ void MapViewTileCache::saveTile(OSM::TilePixmap * tile) {
} }
void MapViewTileCache::writeToDisk(const OSM::TilePixmap & tile) { void MapViewTileCache::writeToDisk(const MapViewTypes::TilePixmap & tile) {
QString hashdir = tile.index.cacheDir(); QString hashdir = tile.index.cacheDir();
if (!cache_dir.exists(hashdir)) cache_dir.mkdir(hashdir); if (!cache_dir.exists(hashdir)) cache_dir.mkdir(hashdir);
QFile f(cache_dir.absoluteFilePath(hashdir + "/" + tile.index.hashName())); QFile f(cache_dir.absoluteFilePath(hashdir + "/" + tile.index.hashName()));
@@ -149,7 +149,7 @@ void MapViewTileCache::writeToDisk(const OSM::TilePixmap & tile) {
void MapViewTileCache::run() { void MapViewTileCache::run() {
while (!isInterruptionRequested()) { while (!isInterruptionRequested()) {
OSM::TilePixmap tile; MapViewTypes::TilePixmap tile;
cond_mutex.lock(); cond_mutex.lock();
if (queue.isEmpty()) { if (queue.isEmpty()) {
cond.wait(&cond_mutex); cond.wait(&cond_mutex);

View File

@@ -20,7 +20,7 @@
#ifndef mapview_tile_cache_h #ifndef mapview_tile_cache_h
#define mapview_tile_cache_h #define mapview_tile_cache_h
#include "osm_types_p.h" #include "mapview_types.h"
#include <QCache> #include <QCache>
#include <QDir> #include <QDir>
@@ -48,11 +48,11 @@ public:
} }
void setTileObsoleteTime(int secs) { secs_obsolete = secs; } void setTileObsoleteTime(int secs) { secs_obsolete = secs; }
void tileDownloaded(OSM::TileIndex index, const QPixmap & pixmap); void tileDownloaded(MapViewTypes::TileIndex index, const QPixmap & pixmap);
OSM::TilePixmap getTile(OSM::TileIndex index, QRectF & rect_src); MapViewTypes::TilePixmap getTile(MapViewTypes::TileIndex index, QRectF & rect_src);
void clearCache(); void clearCache();
bool isTileFileExists(OSM::TileIndex index) const; bool isTileFileExists(MapViewTypes::TileIndex index) const;
QString cacheRoot() const { return cache_root; } QString cacheRoot() const { return cache_root; }
void setCacheRoot(const QString & p); void setCacheRoot(const QString & p);
@@ -61,10 +61,10 @@ public:
void setOfflineMode(bool yes); void setOfflineMode(bool yes);
private: private:
OSM::TilePixmap getTileFromCache(OSM::TileIndex index); MapViewTypes::TilePixmap getTileFromCache(MapViewTypes::TileIndex index);
void updateCacheSize(); void updateCacheSize();
void saveTile(OSM::TilePixmap * tile); void saveTile(MapViewTypes::TilePixmap * tile);
void writeToDisk(const OSM::TilePixmap & tile); void writeToDisk(const MapViewTypes::TilePixmap & tile);
void run() override; void run() override;
MapView * parent; MapView * parent;
@@ -75,15 +75,15 @@ private:
int secs_obsolete = -1; int secs_obsolete = -1;
int fixed_size_b = 0, add_size_b = 0; int fixed_size_b = 0, add_size_b = 0;
bool is_offline = false; bool is_offline = false;
QQueue<OSM::TilePixmap> queue; QQueue<MapViewTypes::TilePixmap> queue;
QCache<quint64, OSM::TilePixmap> tile_cache; QCache<quint64, MapViewTypes::TilePixmap> tile_cache;
public slots: public slots:
private slots: private slots:
signals: signals:
void tileReady(OSM::TilePixmap); void tileReady(MapViewTypes::TilePixmap);
}; };

View File

@@ -4,7 +4,7 @@
MapViewTileDownloader::MapViewTileDownloader(MapView * p): QThread() { MapViewTileDownloader::MapViewTileDownloader(MapView * p): QThread() {
qRegisterMetaType<OSM::TileIndex>(); qRegisterMetaType<MapViewTypes::TileIndex>();
parent = p; parent = p;
start(); start();
} }
@@ -18,7 +18,7 @@ MapViewTileDownloader::~MapViewTileDownloader() {
} }
bool MapViewTileDownloader::queueTile(OSM::TileIndex index, bool force) { bool MapViewTileDownloader::queueTile(MapViewTypes::TileIndex index, bool force) {
// auto hash = tile.hash(); // auto hash = tile.hash();
bool ret = false; bool ret = false;
cond_mutex.lock(); cond_mutex.lock();
@@ -32,7 +32,7 @@ bool MapViewTileDownloader::queueTile(OSM::TileIndex index, bool force) {
} }
void MapViewTileDownloader::queueTiles(QList<OSM::TileIndex> indeces) { void MapViewTileDownloader::queueTiles(QList<MapViewTypes::TileIndex> indeces) {
cond_mutex.lock(); cond_mutex.lock();
queue << indeces; queue << indeces;
cond.wakeOne(); cond.wakeOne();
@@ -50,23 +50,25 @@ void MapViewTileDownloader::clearQueue() {
void MapViewTileDownloader::setTileProvider(MapViewTileProviderBase * p) { void MapViewTileDownloader::setTileProvider(MapViewTileProviderBase * p) {
if (provider) { if (provider) {
disconnect(provider, &MapViewTileProviderBase::tileReady, this, &MapViewTileDownloader::tileReady); disconnect(provider, &MapViewTileProviderBase::tileReady, this, &MapViewTileDownloader::tileReady);
disconnect(provider, &MapViewTileProviderBase::parametersChanged, this, &MapViewTileDownloader::parametersChanged);
provider->deleteLater(); provider->deleteLater();
} }
provider = p; provider = p;
if (provider) { if (provider) {
connect(provider, &MapViewTileProviderBase::tileReady, this, &MapViewTileDownloader::tileReady); connect(provider, &MapViewTileProviderBase::tileReady, this, &MapViewTileDownloader::tileReady);
connect(provider, &MapViewTileProviderBase::parametersChanged, this, &MapViewTileDownloader::parametersChanged);
} }
parent->cache->tileProviderChanged(); parent->cache->tileProviderChanged();
} }
void MapViewTileDownloader::requestTile(OSM::TileIndex index) { void MapViewTileDownloader::requestTile(MapViewTypes::TileIndex index) {
if (!provider) return; if (!provider) return;
provider->requestTile(index); provider->requestTile(index);
} }
void MapViewTileDownloader::tileReady(OSM::TileIndex index, QPixmap pm) { void MapViewTileDownloader::tileReady(MapViewTypes::TileIndex index, QPixmap pm) {
if (!pm.isNull()) parent->cache->tileDownloaded(index, pm); if (!pm.isNull()) parent->cache->tileDownloaded(index, pm);
cond_mutex.lock(); cond_mutex.lock();
in_progress.remove(index.hash()); in_progress.remove(index.hash());
@@ -75,6 +77,11 @@ void MapViewTileDownloader::tileReady(OSM::TileIndex index, QPixmap pm) {
} }
void MapViewTileDownloader::parametersChanged() {
parent->cache->tileProviderChanged();
}
void MapViewTileDownloader::run() { void MapViewTileDownloader::run() {
while (!isInterruptionRequested()) { while (!isInterruptionRequested()) {
cond_mutex.lock(); cond_mutex.lock();

View File

@@ -21,7 +21,7 @@
#define mapview_tile_downloader_h #define mapview_tile_downloader_h
#include "mapview_tile_provider_base.h" #include "mapview_tile_provider_base.h"
#include "osm_types_p.h" #include "mapview_types.h"
#include <QMutex> #include <QMutex>
#include <QNetworkAccessManager> #include <QNetworkAccessManager>
@@ -43,8 +43,8 @@ public:
explicit MapViewTileDownloader(MapView * p); explicit MapViewTileDownloader(MapView * p);
~MapViewTileDownloader(); ~MapViewTileDownloader();
bool queueTile(OSM::TileIndex index, bool force = false); bool queueTile(MapViewTypes::TileIndex index, bool force = false);
void queueTiles(QList<OSM::TileIndex> indeces); void queueTiles(QList<MapViewTypes::TileIndex> indeces);
void clearQueue(); void clearQueue();
void setTileProvider(MapViewTileProviderBase * p); void setTileProvider(MapViewTileProviderBase * p);
@@ -52,19 +52,20 @@ public:
private: private:
void run() override; void run() override;
void requestTile(OSM::TileIndex index); void requestTile(MapViewTypes::TileIndex index);
MapView * parent; MapView * parent;
MapViewTileProviderBase * provider = nullptr; MapViewTileProviderBase * provider = nullptr;
QWaitCondition cond; QWaitCondition cond;
QMutex cond_mutex; QMutex cond_mutex;
QQueue<OSM::TileIndex> queue; QQueue<MapViewTypes::TileIndex> queue;
QSet<quint64> in_progress; QSet<quint64> in_progress;
public slots: public slots:
private slots: private slots:
void tileReady(OSM::TileIndex index, QPixmap pm); void tileReady(MapViewTypes::TileIndex index, QPixmap pm);
void parametersChanged();
signals: signals:
void tileDone(); void tileDone();

View File

@@ -3,11 +3,17 @@
void MapViewTileProviderBase::setParameters(const PIValueTree & vt) { void MapViewTileProviderBase::setParameters(const PIValueTree & vt) {
parameters.applyValues(vt); parameters.applyValues(vt);
applyParameters(); applyParametersIntenal();
} }
void MapViewTileProviderBase::initParameters(const PIValueTree & vt) { void MapViewTileProviderBase::initParameters(const PIValueTree & vt) {
parameters = vt; parameters = vt;
applyParameters(); applyParametersIntenal();
}
void MapViewTileProviderBase::applyParametersIntenal() {
applyParameters();
emit parametersChanged();
} }

View File

@@ -20,9 +20,10 @@
#ifndef mapview_tile_provider_base_h #ifndef mapview_tile_provider_base_h
#define mapview_tile_provider_base_h #define mapview_tile_provider_base_h
#include "osm_types_p.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>
@@ -37,9 +38,11 @@ public:
const PIValueTree & getParameters() const { return parameters; } const PIValueTree & getParameters() const { return parameters; }
void setParameters(const PIValueTree & vt); void setParameters(const PIValueTree & vt);
virtual QString name() const = 0; virtual QString name() const = 0;
virtual bool requestTile(OSM::TileIndex index) = 0; virtual bool requestTile(MapViewTypes::TileIndex index) = 0;
virtual QSize tileSize() = 0; virtual QSize tileSize() = 0;
virtual QString cacheDir() const { return name(); }
virtual int maximumLevel() const = 0;
protected: protected:
void initParameters(const PIValueTree & vt); void initParameters(const PIValueTree & vt);
@@ -47,10 +50,12 @@ protected:
virtual void applyParameters() {} virtual void applyParameters() {}
private: private:
void applyParametersIntenal();
PIValueTree parameters; PIValueTree parameters;
signals: signals:
void tileReady(OSM::TileIndex index, QPixmap pm); void tileReady(MapViewTypes::TileIndex index, QPixmap pm);
void parametersChanged();
}; };

View File

@@ -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);
@@ -27,16 +27,20 @@ QString MapViewTileProvider_MapTiler::name() const {
} }
bool MapViewTileProvider_MapTiler::requestTile(OSM::TileIndex index) { bool MapViewTileProvider_MapTiler::requestTile(MapViewTypes::TileIndex index) {
QNetworkRequest req(url + QString("/%1/%2/%3/%4.jpg?key=%5").arg(tileset).arg(index.z).arg(index.x).arg(index.y).arg(key)); QNetworkRequest req(url + QString("/%1/%2/%3/%4.jpg?key=%5").arg(tileset).arg(index.z).arg(index.x).arg(index.y).arg(key));
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;
@@ -58,6 +62,16 @@ QSize MapViewTileProvider_MapTiler::tileSize() {
} }
QString MapViewTileProvider_MapTiler::cacheDir() const {
return name() + "/" + tileset;
}
int MapViewTileProvider_MapTiler::maximumLevel() const {
return 20;
}
void MapViewTileProvider_MapTiler::applyParameters() { void MapViewTileProvider_MapTiler::applyParameters() {
url = PI2QString(getParameters().childValue("url").toString()); url = PI2QString(getParameters().childValue("url").toString());
key = PI2QString(getParameters().childValue("key").toString()); key = PI2QString(getParameters().childValue("key").toString());

View File

@@ -33,8 +33,10 @@ public:
~MapViewTileProvider_MapTiler(); ~MapViewTileProvider_MapTiler();
QString name() const override; QString name() const override;
bool requestTile(OSM::TileIndex index) override; bool requestTile(MapViewTypes::TileIndex index) override;
QSize tileSize() override; QSize tileSize() override;
QString cacheDir() const override;
int maximumLevel() const override;
protected: protected:
void applyParameters() override; void applyParameters() override;

View File

@@ -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);
} }
@@ -24,7 +24,7 @@ QString MapViewTileProvider_OSM::name() const {
} }
bool MapViewTileProvider_OSM::requestTile(OSM::TileIndex index) { bool MapViewTileProvider_OSM::requestTile(MapViewTypes::TileIndex index) {
QNetworkRequest req(url + QString("/%1/%2/%3.png").arg(index.z).arg(index.x).arg(index.y)); QNetworkRequest req(url + QString("/%1/%2/%3.png").arg(index.z).arg(index.x).arg(index.y));
req.setHeader(QNetworkRequest::UserAgentHeader, "Qt/5"); req.setHeader(QNetworkRequest::UserAgentHeader, "Qt/5");
auto * r = nam->get(req); auto * r = nam->get(req);
@@ -51,6 +51,11 @@ QSize MapViewTileProvider_OSM::tileSize() {
} }
int MapViewTileProvider_OSM::maximumLevel() const {
return 19;
}
void MapViewTileProvider_OSM::applyParameters() { void MapViewTileProvider_OSM::applyParameters() {
url = PI2QString(getParameters().childValue("url").toString()); url = PI2QString(getParameters().childValue("url").toString());
} }

View File

@@ -33,8 +33,9 @@ public:
~MapViewTileProvider_OSM(); ~MapViewTileProvider_OSM();
QString name() const override; QString name() const override;
bool requestTile(OSM::TileIndex index) override; bool requestTile(MapViewTypes::TileIndex index) override;
QSize tileSize() override; QSize tileSize() override;
int maximumLevel() const override;
protected: protected:
void applyParameters() override; void applyParameters() override;

View File

@@ -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
@@ -17,11 +17,11 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "osm_types_p.h" #include "mapview_types.h"
#include <QString> #include <QString>
using namespace OSM; using namespace MapViewTypes;
QString TileIndex ::hashName() const { QString TileIndex ::hashName() const {

View File

@@ -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
@@ -17,15 +17,17 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef osm_types_h #ifndef mapview_types_h
#define osm_types_h #define mapview_types_h
#include "qad_map_export.h"
#include <QMetaType> #include <QMetaType>
#include <QPixmap> #include <QPixmap>
namespace OSM { namespace MapViewTypes {
struct TileIndex { struct QAD_MAP_EXPORT TileIndex {
int z; int z;
int x; int x;
int y; int y;
@@ -34,7 +36,7 @@ struct TileIndex {
QString cacheDir() const; QString cacheDir() const;
}; };
struct TilePixmap { struct QAD_MAP_EXPORT TilePixmap {
TileIndex index; TileIndex index;
QPixmap pixmap; QPixmap pixmap;
bool obsolete = false; bool obsolete = false;
@@ -50,9 +52,9 @@ inline bool operator==(const TilePixmap & v0, const TilePixmap & v1) {
return v0.index == v1.index; return v0.index == v1.index;
} }
} // namespace OSM } // namespace MapViewTypes
Q_DECLARE_METATYPE(OSM::TileIndex); Q_DECLARE_METATYPE(MapViewTypes::TileIndex);
Q_DECLARE_METATYPE(OSM::TilePixmap); Q_DECLARE_METATYPE(MapViewTypes::TilePixmap);
#endif #endif

View File

@@ -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;
} }

View File

@@ -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);

View File

@@ -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()));
} }

View File

@@ -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();
} }

View File

@@ -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();

View File

@@ -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;