Added: High DPI support for the Configuration Editor. Icons and proportions should look better now when DPI scaling is used.
Improved: Updated Qt to version 5.7 Fixed: The GUI for the Channel command was showing the wrong channels as selected when channel numbers were used instead of names.
This commit is contained in:
1 parent
fb8d573fba
commit
3d8ef28d1b
112 files changed
+779
-212
No files matched your search
@@ -20,6 +20,7 @@
|
||||
#include <QGraphicsScene>
|
||||
#include <QPainter>
|
||||
|
||||
#include "Editor/helpers/DPIHelper.h"
|
||||
#include "ChannelGraphItem.h"
|
||||
|
||||
static const float margin = 5;
|
||||
@@ -43,8 +44,8 @@ QRectF ChannelGraphItem::boundingRect() const
|
||||
// shift by 0.5 to have sharp lines
|
||||
cachedRect.setLeft(0.5);
|
||||
cachedRect.setTop(0.5);
|
||||
cachedRect.setWidth(width + 2 * margin);
|
||||
cachedRect.setHeight(height + 2 * margin);
|
||||
cachedRect.setWidth(width + 2 * DPIHelper::scale(margin));
|
||||
cachedRect.setHeight(height + 2 * DPIHelper::scale(margin));
|
||||
}
|
||||
|
||||
return cachedRect;
|
||||
@@ -62,6 +63,6 @@ void ChannelGraphItem::paint(QPainter* painter, QColor color)
|
||||
gradient.setColorAt(0, QColor(255, 255, 255));
|
||||
gradient.setColorAt(1, color);
|
||||
painter->setBrush(gradient);
|
||||
painter->drawRoundedRect(rect, margin, margin);
|
||||
painter->drawRoundedRect(rect, DPIHelper::scale(margin), DPIHelper::scale(margin));
|
||||
painter->drawText(rect.translated(1, -1), Qt::AlignCenter, name);
|
||||
}
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <QGraphicsItem>
|
||||
|
||||
#include "Editor/helpers/DPIHelper.h"
|
||||
#include "ChannelGraphScene.h"
|
||||
|
||||
ChannelGraphScene::ChannelGraphScene(QWidget* parent)
|
||||
@@ -32,8 +33,8 @@ QPointF ChannelGraphScene::getNextChannelPoint(QGraphicsItem* lastItem, bool out
|
||||
if (lastItem != NULL)
|
||||
{
|
||||
QRectF lastRect = lastItem->sceneBoundingRect();
|
||||
x = lastRect.left() + lastRect.width() + 1 + 10;
|
||||
x = lastRect.left() + lastRect.width() + 1 + DPIHelper::scale(10);
|
||||
}
|
||||
|
||||
return QPointF(x, output ? 50 : 0);
|
||||
return QPointF(x, output ? DPIHelper::scale(50) : 0);
|
||||
}
|
||||
@@ -17,14 +17,14 @@
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include "Editor/helpers/DPIHelper.h"
|
||||
#include "CompactToolBar.h"
|
||||
|
||||
CompactToolBar::CompactToolBar(QWidget* parent)
|
||||
: QToolBar(parent)
|
||||
{
|
||||
setMinimumHeight(1);
|
||||
setMinimumHeight(DPIHelper::scale(33));
|
||||
setOrientation(Qt::Vertical);
|
||||
setIconSize(QSize(16, 16));
|
||||
}
|
||||
|
||||
QSize CompactToolBar::sizeHint() const
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include "Editor/helpers/DPIHelper.h"
|
||||
#include "FrequencyPlotView.h"
|
||||
#include "FrequencyPlotScene.h"
|
||||
|
||||
@@ -37,6 +38,9 @@ vector<double> FrequencyPlotScene::bandsVar;
|
||||
FrequencyPlotScene::FrequencyPlotScene(QObject* parent)
|
||||
: QGraphicsScene(parent)
|
||||
{
|
||||
zoomX = DPIHelper::scaleZoom(1.0);
|
||||
zoomY = DPIHelper::scaleZoom(1.0);
|
||||
|
||||
updateSceneRect();
|
||||
}
|
||||
|
||||
@@ -83,14 +87,17 @@ double FrequencyPlotScene::getZoomY() const
|
||||
|
||||
void FrequencyPlotScene::setZoom(double zoomX, double zoomY)
|
||||
{
|
||||
this->zoomX = zoomX;
|
||||
this->zoomY = zoomY;
|
||||
updateSceneRect();
|
||||
|
||||
for (QGraphicsItem* item : items())
|
||||
if (zoomX != this->zoomX || zoomY != this->zoomY)
|
||||
{
|
||||
FrequencyPlotItem* plotItem = (FrequencyPlotItem*)item;
|
||||
plotItem->updatePos();
|
||||
this->zoomX = zoomX;
|
||||
this->zoomY = zoomY;
|
||||
updateSceneRect();
|
||||
|
||||
for (QGraphicsItem* item : items())
|
||||
{
|
||||
FrequencyPlotItem* plotItem = (FrequencyPlotItem*)item;
|
||||
plotItem->updatePos();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ protected:
|
||||
private:
|
||||
void updateSceneRect();
|
||||
|
||||
double zoomX = 1.0;
|
||||
double zoomY = 1.0;
|
||||
double zoomX;
|
||||
double zoomY;
|
||||
int bandCount = -1;
|
||||
};
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <QWheelEvent>
|
||||
|
||||
#include "Editor/helpers/DPIHelper.h"
|
||||
#include "FrequencyPlotView.h"
|
||||
#include "FrequencyPlotScene.h"
|
||||
#include "FrequencyPlotVRuler.h"
|
||||
@@ -37,7 +38,7 @@ void FrequencyPlotVRuler::paintEvent(QPaintEvent*)
|
||||
|
||||
QPointF topLeft = view->mapToScene(0, 0);
|
||||
QPointF bottomRight = view->mapToScene(view->viewport()->width(), view->viewport()->height());
|
||||
double dbStep = abs(s->yToDb(0) - s->yToDb(30));
|
||||
double dbStep = abs(s->yToDb(0) - s->yToDb(DPIHelper::scale(30)));
|
||||
|
||||
double dbBase = pow(10, floor(log10(dbStep)));
|
||||
if (dbStep >= 5 * dbBase)
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <QWheelEvent>
|
||||
#include <QScrollBar>
|
||||
|
||||
#include "Editor/helpers/DPIHelper.h"
|
||||
#include "FrequencyPlotItem.h"
|
||||
#include "FrequencyPlotView.h"
|
||||
|
||||
@@ -29,7 +30,7 @@ using namespace std;
|
||||
FrequencyPlotView::FrequencyPlotView(QWidget* parent)
|
||||
: QGraphicsView(parent)
|
||||
{
|
||||
setViewportMargins(32, 0, 0, 20);
|
||||
setViewportMargins(DPIHelper::scale(32), 0, 0, DPIHelper::scale(20));
|
||||
hRuler = new FrequencyPlotHRuler(this);
|
||||
vRuler = new FrequencyPlotVRuler(this);
|
||||
hRuler->setMouseTracking(true);
|
||||
@@ -60,7 +61,7 @@ void FrequencyPlotView::drawBackground(QPainter* painter, const QRectF& drawRect
|
||||
FrequencyPlotScene* s = scene();
|
||||
QPointF topLeft = mapToScene(0, 0);
|
||||
QPointF bottomRight = mapToScene(viewport()->width(), viewport()->height());
|
||||
double dbStep = abs(s->yToDb(0) - s->yToDb(30));
|
||||
double dbStep = abs(s->yToDb(0) - s->yToDb(DPIHelper::scale(30)));
|
||||
|
||||
double dbBase = pow(10, floor(log10(dbStep)));
|
||||
if (dbStep >= 5 * dbBase)
|
||||
@@ -176,6 +177,7 @@ void FrequencyPlotView::setScrollOffsets(int x, int y)
|
||||
|
||||
void FrequencyPlotView::wheelEvent(QWheelEvent* event)
|
||||
{
|
||||
event->accept();
|
||||
int delta = event->angleDelta().y();
|
||||
zoom(delta, delta, event->x(), event->y());
|
||||
}
|
||||
|
||||
@@ -19,13 +19,20 @@
|
||||
|
||||
#include <QMouseEvent>
|
||||
|
||||
#include "Editor/helpers/DPIHelper.h"
|
||||
#include "ResizeCorner.h"
|
||||
|
||||
ResizeCorner::ResizeCorner(FilterTable* filterTable, QSize minimumSize, QSize maximumSize, std::function<QSize()> getFunc, std::function<void(QSize)> setFunc, QWidget* parent)
|
||||
: QLabel(parent), minimumSize(minimumSize), maximumSize(maximumSize), getFunc(getFunc), setFunc(setFunc), filterTable(filterTable)
|
||||
{
|
||||
setPixmap(QPixmap(":/icons/resize_corner.png"));
|
||||
QIcon icon(":/icons/resize_corner.ico");
|
||||
QSize desiredSize = DPIHelper::scale(QSize(16, 16));
|
||||
QSize actualSize = icon.actualSize(desiredSize);
|
||||
QPixmap pixmap = icon.pixmap(actualSize);
|
||||
setPixmap(pixmap);
|
||||
setCursor(Qt::SizeFDiagCursor);
|
||||
// move icon to lower right if it does not fill the full area
|
||||
setContentsMargins(desiredSize.width() - actualSize.width(), desiredSize.height() - actualSize.height(), 0, 0);
|
||||
}
|
||||
|
||||
void ResizeCorner::mousePressEvent(QMouseEvent* event)
|
||||
|
||||
Reference in new issue
Block a user