Skip to content
Commits on Source (2)
qmapshack (1.11.1-3) unstable; urgency=medium
* Add upstream patches to fix Qt 5.11 related issues.
-- Bas Couwenberg <sebastic@debian.org> Thu, 19 Jul 2018 09:39:21 +0200
qmapshack (1.11.1-2) unstable; urgency=medium
* Strip trailing whitespace from control & rules files.
......
Description: Display problems after updating QT from 5.10.1 to 5.11.0
Author: kiozen
Origin: https://bitbucket.org/maproom/qmapshack/commits/13e966d3f1a5a3439fffc4d631163410d4b8412a
Bug: https://bitbucket.org/maproom/qmapshack/issues/343/display-problems-after-updating-qt-from
--- a/src/qmapshack/dem/CDemItem.cpp
+++ b/src/qmapshack/dem/CDemItem.cpp
@@ -69,7 +69,18 @@ void CDemItem::showChildren(bool yes)
QTreeWidgetItem * item = new QTreeWidgetItem(this);
item->setFlags(Qt::ItemIsEnabled);
- tw->setItemWidget(item, 0, demfile->getSetup());
+
+ QWidget * widget = demfile->getSetup();
+ tw->setItemWidget(item, 0, widget);
+
+ qint32 w = tw->columnWidth(0) - tw->indentation() - 10;
+ if(tw->verticalScrollBar() != nullptr)
+ {
+ w -= tw->verticalScrollBar()->width();
+ }
+
+ widget->setMaximumWidth(w);
+ widget->setMinimumWidth(w);
}
else
{
--- a/src/qmapshack/dem/CDemList.cpp
+++ b/src/qmapshack/dem/CDemList.cpp
@@ -58,6 +58,32 @@ void CDemTreeWidget::dropEvent( QDropEve
emit sigChanged();
}
+void CDemTreeWidget::resizeEvent(QResizeEvent * e)
+{
+ QTreeWidget::resizeEvent(e);
+
+ qint32 w = columnWidth(0) - indentation() - 10;
+ if(verticalScrollBar() != nullptr)
+ {
+ w -= verticalScrollBar()->width();
+ }
+
+ const int N = topLevelItemCount();
+ for(int n = 0; n < N; n++)
+ {
+ QTreeWidgetItem * item = topLevelItem(n);
+ if(item->childCount() == 1)
+ {
+ QWidget * widget = itemWidget(item->child(0), 0);
+ if(widget != nullptr)
+ {
+ widget->setMaximumWidth(w);
+ widget->setMinimumWidth(w);
+ }
+ }
+ }
+}
+
CDemList::CDemList(QWidget *parent)
: QWidget(parent)
--- a/src/qmapshack/dem/CDemList.h
+++ b/src/qmapshack/dem/CDemList.h
@@ -38,6 +38,8 @@ signals:
protected:
void dragMoveEvent(QDragMoveEvent *event) override;
void dropEvent(QDropEvent *event) override;
+
+ void resizeEvent(QResizeEvent * e) override;
};
--- a/src/qmapshack/map/CMapItem.cpp
+++ b/src/qmapshack/map/CMapItem.cpp
@@ -27,7 +27,7 @@
#include "map/CMapVRT.h"
#include "map/CMapWMTS.h"
#include "map/IMapProp.h"
-#include <QtGui>
+#include <QtWidgets>
QMutex CMapItem::mutexActiveMaps(QMutex::Recursive);
@@ -76,7 +76,18 @@ void CMapItem::showChildren(bool yes)
QTreeWidgetItem * item = new QTreeWidgetItem(this);
item->setFlags(Qt::ItemIsEnabled);
- tw->setItemWidget(item, 0, mapfile->getSetup());
+
+ QWidget * widget = mapfile->getSetup();
+ tw->setItemWidget(item, 0, widget);
+
+ qint32 w = tw->columnWidth(0) - tw->indentation() - 10;
+ if(tw->verticalScrollBar() != nullptr)
+ {
+ w -= tw->verticalScrollBar()->width();
+ }
+
+ widget->setMaximumWidth(w);
+ widget->setMinimumWidth(w);
}
else
{
--- a/src/qmapshack/map/CMapList.cpp
+++ b/src/qmapshack/map/CMapList.cpp
@@ -63,6 +63,32 @@ void CMapTreeWidget::dropEvent(QDropEven
emit sigChanged();
}
+void CMapTreeWidget::resizeEvent(QResizeEvent * e)
+{
+ QTreeWidget::resizeEvent(e);
+
+ qint32 w = columnWidth(0) - indentation() - 10;
+ if(verticalScrollBar() != nullptr)
+ {
+ w -= verticalScrollBar()->width();
+ }
+
+ const int N = topLevelItemCount();
+ for(int n = 0; n < N; n++)
+ {
+ QTreeWidgetItem * item = topLevelItem(n);
+ if(item->childCount() == 1)
+ {
+ QWidget * widget = itemWidget(item->child(0), 0);
+ if(widget != nullptr)
+ {
+ widget->setMaximumWidth(w);
+ widget->setMinimumWidth(w);
+ }
+ }
+ }
+}
+
CMapList::CMapList(QWidget *parent)
: QWidget(parent)
{
--- a/src/qmapshack/map/CMapList.h
+++ b/src/qmapshack/map/CMapList.h
@@ -40,6 +40,8 @@ protected:
void dragEnterEvent(QDragEnterEvent *e) override;
void dragMoveEvent(QDragMoveEvent *e) override;
void dropEvent(QDropEvent *e) override;
+
+ void resizeEvent(QResizeEvent * e) override;
};
#include "ui_IMapList.h"
Description: Display problems after updating QT from 5.10.1 to 5.11.0
fixing size management of scale label
Author: kiozen
Origin: https://bitbucket.org/maproom/qmapshack/commits/39d56fc950c93f997fd1c4956d1d7a20cca5072c
Bug: https://bitbucket.org/maproom/qmapshack/issues/343/display-problems-after-updating-qt-from
--- a/src/qmapshack/CMakeLists.txt
+++ b/src/qmapshack/CMakeLists.txt
@@ -311,6 +311,7 @@ set( SRCS
widgets/CLineEdit.cpp
widgets/CPhotoAlbum.cpp
widgets/CSelectDoubleListWidget.cpp
+ widgets/CScaleLabel.cpp
widgets/CTemplateWidget.cpp
widgets/CTextEdit.cpp
widgets/CTextEditWidget.cpp
@@ -628,6 +629,7 @@ set( HDRS
widgets/CLineEdit.h
widgets/CPhotoAlbum.h
widgets/CSelectDoubleListWidget.h
+ widgets/CScaleLabel.h
widgets/CTemplateWidget.h
widgets/CTextEdit.h
widgets/CTextEditWidget.h
--- a/src/qmapshack/dem/CDemPropSetup.cpp
+++ b/src/qmapshack/dem/CDemPropSetup.cpp
@@ -87,11 +87,6 @@ CDemPropSetup::~CDemPropSetup()
{
}
-void CDemPropSetup::resizeEvent(QResizeEvent * e)
-{
- IDemProp::resizeEvent(e);
- updateScaleLabel();
-}
void CDemPropSetup::slotPropertiesChanged()
{
@@ -102,7 +97,7 @@ void CDemPropSetup::slotPropertiesChange
toolSetMinScale->setChecked( demfile->getMinScale() != NOFLOAT );
toolSetMaxScale->setChecked( demfile->getMaxScale() != NOFLOAT );
- updateScaleLabel();
+ labelScale->setValue(demfile->getMinScale(), scale.x(), demfile->getMaxScale());
checkHillshading->setChecked(demfile->doHillshading());
sliderHillshading->setValue(demfile->getFactorHillshading());
@@ -149,60 +144,6 @@ void CDemPropSetup::slotSetMaxScale(bool
slotPropertiesChanged();
}
-
-#define BAR_HEIGHT 6
-#define HOR_MARGIN 3
-
-void CDemPropSetup::updateScaleLabel()
-{
- int w = labelScale->width();
- int h = labelScale->height();
-
- QPixmap pix(w,h);
- if(pix.isNull())
- {
- return;
- }
-
- pix.fill(Qt::transparent);
- QPainter p(&pix);
-
- // draw bar background
- int xBar = HOR_MARGIN;
- int yBar = (h - BAR_HEIGHT) / 2;
-
- QRect bar(xBar, yBar, w-2*HOR_MARGIN, BAR_HEIGHT);
- p.setPen(Qt::darkBlue);
- p.setBrush(Qt::white);
- p.drawRect(bar);
-
- // draw current scale range
- qreal minScale = demfile->getMinScale();
- qreal maxScale = demfile->getMaxScale();
- if((minScale != NOFLOAT) || (maxScale != NOFLOAT))
- {
- int x1Range = minScale != NOFLOAT ? HOR_MARGIN + qRound(bar.width() * (1 + log10(minScale)) / 5) : bar.left();
- int x2Range = maxScale != NOFLOAT ? HOR_MARGIN + qRound(bar.width() * (1 + log10(maxScale)) / 5) : bar.right();
- int yRange = yBar;
-
- QRect range(x1Range, yRange, x2Range - x1Range, BAR_HEIGHT);
- p.setPen(Qt::NoPen);
- p.setBrush(Qt::darkGreen);
- p.drawRect(range);
- }
-
- // draw scale indicator
- int xInd = HOR_MARGIN + qRound(bar.width() * (1 + log10(scale.x())) / 5) - 3;
- int yInd = yBar - 1;
-
- QRect ind(xInd, yInd, 5, BAR_HEIGHT + 2);
- p.setPen(Qt::darkBlue);
- p.setBrush(Qt::NoBrush);
- p.drawRect(ind);
-
- labelScale->setPixmap(pix);
-}
-
void CDemPropSetup::slotSlopeChanged(int val)
{
uint level = QObject::sender()->property("level").toUInt();
--- a/src/qmapshack/dem/CDemPropSetup.h
+++ b/src/qmapshack/dem/CDemPropSetup.h
@@ -34,9 +34,6 @@ public:
protected slots:
void slotPropertiesChanged() override;
-protected:
- void resizeEvent(QResizeEvent * e) override;
-
private slots:
void slotScaleChanged(const QPointF& s);
void slotSetMinScale(bool checked);
@@ -47,9 +44,6 @@ private slots:
void slotSlopeChanged(int val);
private:
-
- void updateScaleLabel();
-
CTinySpinBox* slopeSpins[SLOPE_LEVELS];
static QPointF scale;
--- a/src/qmapshack/dem/IDemPropSetup.ui
+++ b/src/qmapshack/dem/IDemPropSetup.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>400</width>
- <height>163</height>
+ <width>269</width>
+ <height>173</height>
</rect>
</property>
<property name="windowTitle">
@@ -69,7 +69,7 @@
</widget>
</item>
<item>
- <widget class="QLabel" name="labelScale">
+ <widget class="CScaleLabel" name="labelScale">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Control the range of scale the map is displayed. Use the two buttons left and right to define the actual scale as either minimum or maximum scale.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
@@ -150,6 +150,9 @@
<property name="insertPolicy">
<enum>QComboBox::NoInsert</enum>
</property>
+ <property name="sizeAdjustPolicy">
+ <enum>QComboBox::AdjustToMinimumContentsLength</enum>
+ </property>
</widget>
</item>
</layout>
@@ -595,6 +598,11 @@
<extends>QSpinBox</extends>
<header>widgets/CTinySpinBox.h</header>
</customwidget>
+ <customwidget>
+ <class>CScaleLabel</class>
+ <extends>QLabel</extends>
+ <header location="global">widgets/CScaleLabel.h</header>
+ </customwidget>
</customwidgets>
<resources>
<include location="../resources.qrc"/>
--- a/src/qmapshack/map/CMapPropSetup.cpp
+++ b/src/qmapshack/map/CMapPropSetup.cpp
@@ -74,11 +74,6 @@ CMapPropSetup::~CMapPropSetup()
{
}
-void CMapPropSetup::resizeEvent(QResizeEvent * e) /* override */
-{
- IMapProp::resizeEvent(e);
- updateScaleLabel();
-}
void CMapPropSetup::slotPropertiesChanged() /* override */
{
@@ -91,7 +86,8 @@ void CMapPropSetup::slotPropertiesChange
toolSetMinScale->setChecked(minScale != NOFLOAT);
qreal maxScale = mapfile->getMaxScale();
toolSetMaxScale->setChecked(maxScale != NOFLOAT);
- updateScaleLabel();
+
+ labelScale->setValue(mapfile->getMinScale(), scale.x(), mapfile->getMaxScale());
// vector maps properties
checkPolygons->setChecked(mapfile->getShowPolygons());
@@ -101,7 +97,7 @@ void CMapPropSetup::slotPropertiesChange
// streaming map properties
QString lbl = mapfile->getCachePath();
- labelCachePath->setText(lbl);
+ labelCachePath->setText(lbl.size() < 20 ? lbl : "..." + lbl.right(17));
labelCachePath->setToolTip(lbl);
spinCacheSize->setValue(mapfile->getCacheSize());
spinCacheExpiration->setValue(mapfile->getCacheExpiration());
@@ -135,58 +131,6 @@ void CMapPropSetup::slotSetMaxScale(bool
}
-#define BAR_HEIGHT 6
-#define HOR_MARGIN 3
-
-void CMapPropSetup::updateScaleLabel()
-{
- int w = labelScale->width();
- int h = labelScale->height();
-
- QPixmap pix(w,h);
- if(pix.isNull())
- {
- return;
- }
-
- pix.fill(Qt::transparent);
- QPainter p(&pix);
-
- // draw bar background
- int xBar = HOR_MARGIN;
- int yBar = (h - BAR_HEIGHT) / 2;
-
- QRect bar(xBar, yBar, w-2*HOR_MARGIN, BAR_HEIGHT);
- p.setPen(Qt::darkBlue);
- p.setBrush(Qt::white);
- p.drawRect(bar);
-
- // draw current scale range
- qreal minScale = mapfile->getMinScale();
- qreal maxScale = mapfile->getMaxScale();
- if((minScale != NOFLOAT) || (maxScale != NOFLOAT))
- {
- int x1Range = minScale != NOFLOAT ? HOR_MARGIN + qRound(bar.width() * (1 + log10(minScale)) / 5) : bar.left();
- int x2Range = maxScale != NOFLOAT ? HOR_MARGIN + qRound(bar.width() * (1 + log10(maxScale)) / 5) : bar.right();
- int yRange = yBar;
-
- QRect range(x1Range, yRange, x2Range - x1Range, BAR_HEIGHT);
- p.setPen(Qt::NoPen);
- p.setBrush(Qt::darkGreen);
- p.drawRect(range);
- }
-
- // draw scale indicator
- int xInd = HOR_MARGIN + qRound(bar.width() * (1 + log10(scale.x())) / 5) - 3;
- int yInd = yBar - 1;
-
- QRect ind(xInd, yInd, 5, BAR_HEIGHT + 2);
- p.setPen(Qt::darkBlue);
- p.setBrush(Qt::NoBrush);
- p.drawRect(ind);
-
- labelScale->setPixmap(pix);
-}
void CMapPropSetup::slotLoadTypeFile()
--- a/src/qmapshack/map/CMapPropSetup.h
+++ b/src/qmapshack/map/CMapPropSetup.h
@@ -33,9 +33,6 @@ public:
protected slots:
void slotPropertiesChanged() override;
-protected:
- void resizeEvent(QResizeEvent * e) override;
-
private slots:
void slotScaleChanged(const QPointF& s);
void slotSetMinScale(bool checked);
@@ -44,8 +41,6 @@ private slots:
void slotClearTypeFile();
private:
- void updateScaleLabel();
-
static QPointF scale;
};
--- a/src/qmapshack/map/IMapPropSetup.ui
+++ b/src/qmapshack/map/IMapPropSetup.ui
@@ -69,7 +69,7 @@
</widget>
</item>
<item>
- <widget class="QLabel" name="labelScale">
+ <widget class="CScaleLabel" name="labelScale">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Control the range of scale the map is displayed. Use the two buttons left and right to define the actual scale as either minimum or maximum scale.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
@@ -263,6 +263,9 @@
<property name="text">
<string>-</string>
</property>
+ <property name="scaledContents">
+ <bool>true</bool>
+ </property>
</widget>
</item>
<item row="0" column="0">
@@ -394,6 +397,13 @@
</item>
</layout>
</widget>
+ <customwidgets>
+ <customwidget>
+ <class>CScaleLabel</class>
+ <extends>QLabel</extends>
+ <header location="global">widgets/CScaleLabel.h</header>
+ </customwidget>
+ </customwidgets>
<resources>
<include location="../resources.qrc"/>
</resources>
--- /dev/null
+++ b/src/qmapshack/widgets/CScaleLabel.cpp
@@ -0,0 +1,87 @@
+/**********************************************************************************************
+ Copyright (C) 2018 Oliver Eichler oliver.eichler@gmx.de
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+**********************************************************************************************/
+
+#include "widgets/CScaleLabel.h"
+#include "units/IUnit.h"
+#include "helpers/CDraw.h"
+
+#include <QtWidgets>
+
+#define BAR_HEIGHT 6
+#define HOR_MARGIN 3
+
+
+CScaleLabel::CScaleLabel(QWidget *parent)
+ : QLabel(parent)
+{
+ setScaledContents(true);
+}
+
+void CScaleLabel::setValue(qreal min, qreal scale, qreal max)
+{
+ minScale = min;
+ maxScale = max;
+ currentScale = scale;
+
+ update();
+ //updatePixmap();
+}
+
+void CScaleLabel::paintEvent(QPaintEvent *e)
+{
+ int w = width();
+ int h = height();
+
+ QPainter p;
+ p.begin(this);
+ USE_ANTI_ALIASING(p,true);
+
+ p.fillRect(rect(), Qt::transparent);
+ // draw bar background
+ int xBar = HOR_MARGIN;
+ int yBar = (h - BAR_HEIGHT) / 2;
+
+ QRect bar(xBar, yBar, w-2*HOR_MARGIN, BAR_HEIGHT);
+ p.setPen(Qt::darkBlue);
+ p.setBrush(Qt::white);
+ p.drawRect(bar);
+
+ // draw current scale range
+ if((minScale != NOFLOAT) || (maxScale != NOFLOAT))
+ {
+ int x1Range = minScale != NOFLOAT ? HOR_MARGIN + qRound(bar.width() * (1 + log10(minScale)) / 5) : bar.left();
+ int x2Range = maxScale != NOFLOAT ? HOR_MARGIN + qRound(bar.width() * (1 + log10(maxScale)) / 5) : bar.right();
+ int yRange = yBar;
+
+ QRect range(x1Range, yRange, x2Range - x1Range, BAR_HEIGHT);
+ p.setPen(Qt::NoPen);
+ p.setBrush(Qt::darkGreen);
+ p.drawRect(range);
+ }
+
+ // draw scale indicator
+ int xInd = HOR_MARGIN + qRound(bar.width() * (1 + log10(currentScale)) / 5) - 3;
+ int yInd = yBar - 1;
+
+ QRect ind(xInd, yInd, 5, BAR_HEIGHT + 2);
+ p.setPen(Qt::darkBlue);
+ p.setBrush(Qt::NoBrush);
+ p.drawRect(ind);
+
+ p.end();
+}
--- /dev/null
+++ b/src/qmapshack/widgets/CScaleLabel.h
@@ -0,0 +1,45 @@
+/**********************************************************************************************
+ Copyright (C) 2018 Oliver Eichler oliver.eichler@gmx.de
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+**********************************************************************************************/
+
+#ifndef CSCALELABEL_H
+#define CSCALELABEL_H
+
+#include <QLabel>
+
+class CScaleLabel : public QLabel
+{
+ Q_OBJECT
+public:
+ CScaleLabel(QWidget * parent);
+ virtual ~CScaleLabel() = default;
+
+ void setValue(qreal min, qreal scale, qreal max);
+
+protected:
+ void paintEvent(QPaintEvent *e) override;
+
+private:
+ void updatePixmap();
+
+ qreal minScale = 0;
+ qreal maxScale = 0;
+ qreal currentScale = 0;
+};
+
+#endif //CSCALELABEL_H
+
Description: Building latest version of QMapShack fails after updating QT from 5.10.1 to 5.11.0
Author: kiozen
Origin: https://bitbucket.org/maproom/qmapshack/commits/e9b47af61b0945acb74649bab30dec23ac42f375
Bug: https://bitbucket.org/maproom/qmapshack/issues/344/building-latest-version-of-qmapshack-fails
--- a/src/qmapshack/helpers/CToolBarSetupDialog.cpp
+++ b/src/qmapshack/helpers/CToolBarSetupDialog.cpp
@@ -20,6 +20,8 @@
#include "helpers/CToolBarConfig.h"
#include "helpers/CToolBarSetupDialog.h"
+#include <QAction>
+
bool CToolBarSetupDialog::CItemFilter::shouldBeMoved(QListWidgetItem *item)
{
CDialogItem * dialogItem = dynamic_cast<CDialogItem *>(item);
issue-344_Building-latest-version-of-QMapShack-fails-after-updating-QT-from-5.10.1-to-5.11.0.patch
issue-343-Display-problems-after-updating-QT-from-5.10.1-to-5.11.0.patch
issue-343-fixing-size-management-of-scale-label.patch