[TD]Allow balloons to be attached to non-part views

This commit is contained in:
wandererfan
2023-01-10 09:24:12 -05:00
committed by WandererFan
parent 437457e996
commit bc036abb30
15 changed files with 1491 additions and 1453 deletions

View File

@@ -22,18 +22,18 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <cmath>
#include <cmath>
# include <QApplication>
# include <QBitmap>
# include <QContextMenuEvent>
# include <QGLWidget>
# include <QLabel>
# include <QMouseEvent>
# include <QPainter>
# include <QPaintEvent>
# include <QScrollBar>
# include <QWheelEvent>
#include <QApplication>
#include <QBitmap>
#include <QContextMenuEvent>
#include <QGLWidget>
#include <QLabel>
#include <QMouseEvent>
#include <QPaintEvent>
#include <QPainter>
#include <QScrollBar>
#include <QWheelEvent>
#endif
#include <App/Application.h>
@@ -50,7 +50,6 @@
#include <Mod/TechDraw/App/DrawPage.h>
#include <Mod/TechDraw/App/DrawSVGTemplate.h>
#include "QGVPage.h"
#include "MDIViewPage.h"
#include "PreferencesGui.h"
#include "QGSPage.h"
@@ -64,6 +63,7 @@
#include "QGVNavStyleRevit.h"
#include "QGVNavStyleTinkerCAD.h"
#include "QGVNavStyleTouchpad.h"
#include "QGVPage.h"
#include "Rez.h"
#include "ViewProviderPage.h"
@@ -83,20 +83,13 @@
#define PAN_HOT_X 7
#define PAN_HOT_Y 7
static unsigned char pan_bitmap[PAN_BYTES] =
{
0xc0, 0x03, 0x60, 0x02, 0x20, 0x04, 0x10, 0x08,
0x68, 0x16, 0x54, 0x2a, 0x73, 0xce, 0x01, 0x80,
0x01, 0x80, 0x73, 0xce, 0x54, 0x2a, 0x68, 0x16,
0x10, 0x08, 0x20, 0x04, 0x40, 0x02, 0xc0, 0x03
};
static unsigned char pan_bitmap[PAN_BYTES] = {
0xc0, 0x03, 0x60, 0x02, 0x20, 0x04, 0x10, 0x08, 0x68, 0x16, 0x54, 0x2a, 0x73, 0xce, 0x01, 0x80,
0x01, 0x80, 0x73, 0xce, 0x54, 0x2a, 0x68, 0x16, 0x10, 0x08, 0x20, 0x04, 0x40, 0x02, 0xc0, 0x03};
static unsigned char pan_mask_bitmap[PAN_BYTES] =
{
0xc0, 0x03, 0xe0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, 0xe8, 0x17, 0xdc, 0x3b, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xdc, 0x3b, 0xe8, 0x17, 0xf0, 0x0f, 0xe0, 0x07, 0xc0, 0x03,
0xc0, 0x03
};
static unsigned char pan_mask_bitmap[PAN_BYTES] = {
0xc0, 0x03, 0xe0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, 0xe8, 0x17, 0xdc, 0x3b, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xdc, 0x3b, 0xe8, 0x17, 0xf0, 0x0f, 0xe0, 0x07, 0xc0, 0x03, 0xc0, 0x03};
/*** zoom-style cursor ******/
#define ZOOM_WIDTH 16
@@ -105,83 +98,83 @@ static unsigned char pan_mask_bitmap[PAN_BYTES] =
#define ZOOM_HOT_X 5
#define ZOOM_HOT_Y 7
static unsigned char zoom_bitmap[ZOOM_BYTES] =
{
0x00, 0x0f, 0x80, 0x1c, 0x40, 0x38, 0x20, 0x70,
0x90, 0xe4, 0xc0, 0xcc, 0xf0, 0xfc, 0x00, 0x0c,
0x00, 0x0c, 0xf0, 0xfc, 0xc0, 0xcc, 0x90, 0xe4,
0x20, 0x70, 0x40, 0x38, 0x80, 0x1c, 0x00, 0x0f
};
static unsigned char zoom_bitmap[ZOOM_BYTES] = {
0x00, 0x0f, 0x80, 0x1c, 0x40, 0x38, 0x20, 0x70, 0x90, 0xe4, 0xc0, 0xcc, 0xf0, 0xfc, 0x00, 0x0c,
0x00, 0x0c, 0xf0, 0xfc, 0xc0, 0xcc, 0x90, 0xe4, 0x20, 0x70, 0x40, 0x38, 0x80, 0x1c, 0x00, 0x0f};
static unsigned char zoom_mask_bitmap[ZOOM_BYTES] =
{
0x00, 0x0f, 0x80, 0x1f, 0xc0, 0x3f, 0xe0, 0x7f, 0xf0, 0xff, 0xf0, 0xff, 0xf0, 0xff, 0x00,
0x0f, 0x00, 0x0f, 0xf0, 0xff, 0xf0, 0xff, 0xf0, 0xff, 0xe0, 0x7f, 0xc0, 0x3f, 0x80, 0x1f,
0x00, 0x0f
};
static unsigned char zoom_mask_bitmap[ZOOM_BYTES] = {
0x00, 0x0f, 0x80, 0x1f, 0xc0, 0x3f, 0xe0, 0x7f, 0xf0, 0xff, 0xf0, 0xff, 0xf0, 0xff, 0x00, 0x0f,
0x00, 0x0f, 0xf0, 0xff, 0xf0, 0xff, 0xf0, 0xff, 0xe0, 0x7f, 0xc0, 0x3f, 0x80, 0x1f, 0x00, 0x0f};
using namespace Gui;
using namespace TechDraw;
using namespace TechDrawGui;
class QGVPage::Private : public ParameterGrp::ObserverType {
class QGVPage::Private: public ParameterGrp::ObserverType
{
public:
/// handle to the viewer parameter group
ParameterGrp::handle hGrp;
QGVPage* page;
explicit Private(QGVPage* page) : page(page) {
explicit Private(QGVPage* page) : page(page)
{
// attach parameter Observer
hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View");
hGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/View");
hGrp->Attach(this);
}
void init() {
void init()
{
page->m_atCursor = hGrp->GetBool("ZoomAtCursor", 1l);
page->m_invertZoom = hGrp->GetBool("InvertZoom", 0l);
page->m_zoomIncrement = hGrp->GetFloat("ZoomStep", 0.02);
auto hTDPref = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/General");
auto hTDPref = App::GetApplication()
.GetUserParameter()
.GetGroup("BaseApp")
->GetGroup("Preferences")
->GetGroup("Mod/TechDraw/General");
page->m_reversePan = hTDPref->GetInt("KbPan", 1);
page->m_reverseScroll = hTDPref->GetInt("KbScroll", 1);
}
/// Observer message from the ParameterGrp
void OnChange(ParameterGrp::SubjectType &rCaller, ParameterGrp::MessageType Reason) override {
void OnChange(ParameterGrp::SubjectType& rCaller, ParameterGrp::MessageType Reason) override
{
const ParameterGrp& rGrp = static_cast<ParameterGrp&>(rCaller);
if (strcmp(Reason, "NavigationStyle") == 0) {
std::string model = rGrp.GetASCII("NavigationStyle", CADNavigationStyle::getClassTypeId().getName());
std::string model =
rGrp.GetASCII("NavigationStyle", CADNavigationStyle::getClassTypeId().getName());
page->setNavigationStyle(model);
} else if (strcmp(Reason, "InvertZoom") == 0) {
}
else if (strcmp(Reason, "InvertZoom") == 0) {
page->m_invertZoom = rGrp.GetBool("InvertZoom", true);
} else if (strcmp(Reason, "ZoomStep") == 0) {
}
else if (strcmp(Reason, "ZoomStep") == 0) {
page->m_zoomIncrement = rGrp.GetFloat("ZoomStep", 0.0f);
} else if (strcmp(Reason, "ZoomAtCursor") == 0) {
}
else if (strcmp(Reason, "ZoomAtCursor") == 0) {
page->m_atCursor = rGrp.GetBool("ZoomAtCursor", true);
if (page->m_atCursor) {
page->setResizeAnchor(QGVPage::AnchorUnderMouse);
page->setTransformationAnchor(QGVPage::AnchorUnderMouse);
} else {
}
else {
page->setResizeAnchor(QGVPage::AnchorViewCenter);
page->setTransformationAnchor(QGVPage::AnchorViewCenter);
}
}
}
void detach() {
hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View");
void detach()
{
hGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/View");
hGrp->Detach(this);
}
};
QGVPage::QGVPage(ViewProviderPage *vpPage, QGSPage* scenePage, QWidget *parent)
: QGraphicsView(parent),
m_renderer(Native),
drawBkg(true),
m_vpPage(nullptr),
m_scene(scenePage),
balloonPlacing(false),
panningActive(false),
m_showGrid(false),
m_navStyle(nullptr),
d(new Private(this))
QGVPage::QGVPage(ViewProviderPage* vpPage, QGSPage* scenePage, QWidget* parent)
: QGraphicsView(parent), m_renderer(Native), drawBkg(true), m_vpPage(nullptr),
m_scene(scenePage), balloonPlacing(false), panningActive(false), m_showGrid(false),
m_navStyle(nullptr), d(new Private(this))
{
assert(vpPage);
m_vpPage = vpPage;
@@ -197,27 +190,29 @@ QGVPage::QGVPage(ViewProviderPage *vpPage, QGSPage* scenePage, QWidget *parent)
setCacheMode(QGraphicsView::CacheBackground);
setRenderer(Native);
// setRenderer(OpenGL); //gives rotten quality, don't use this
// setRenderer(OpenGL); //gives rotten quality, don't use this
setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
d->init();
if (m_atCursor) {
setResizeAnchor(AnchorUnderMouse);
setTransformationAnchor(AnchorUnderMouse);
} else {
}
else {
setResizeAnchor(AnchorViewCenter);
setTransformationAnchor(AnchorViewCenter);
}
setAlignment(Qt::AlignCenter);
// setDragMode(ScrollHandDrag);
// setDragMode(ScrollHandDrag);
setDragMode(QGraphicsView::NoDrag);
resetCursor();
bkgBrush = new QBrush(getBackgroundColor());
balloonCursor = new QLabel(this);
balloonCursor->setPixmap(prepareCursorPixmap("TechDraw_Balloon.svg", balloonHotspot = QPoint(8, 59)));
balloonCursor->setPixmap(
prepareCursorPixmap("TechDraw_Balloon.svg", balloonHotspot = QPoint(8, 59)));
balloonCursor->hide();
initNavigationStyle();
@@ -232,10 +227,7 @@ QGVPage::~QGVPage()
d->detach();
}
void QGVPage::centerOnPage(void)
{
centerOn(m_vpPage->getQGSPage()->getTemplateCenter());
}
void QGVPage::centerOnPage(void) { centerOn(m_vpPage->getQGSPage()->getTemplateCenter()); }
void QGVPage::initNavigationStyle()
{
@@ -245,7 +237,7 @@ void QGVPage::initNavigationStyle()
void QGVPage::setNavigationStyle(std::string navParm)
{
// Base::Console().Message("QGVP::setNavigationStyle(%s)\n", navParm.c_str());
// Base::Console().Message("QGVP::setNavigationStyle(%s)\n", navParm.c_str());
if (m_navStyle) {
delete m_navStyle;
}
@@ -263,34 +255,47 @@ void QGVPage::setNavigationStyle(std::string navParm)
if (foundBlender != std::string::npos) {
m_navStyle = static_cast<QGVNavStyle*>(new QGVNavStyleBlender(this));
} else if (foundCAD != std::string::npos) {
}
else if (foundCAD != std::string::npos) {
m_navStyle = static_cast<QGVNavStyle*>(new QGVNavStyleCAD(this));
} else if (foundTouchPad != std::string::npos) {
}
else if (foundTouchPad != std::string::npos) {
m_navStyle = static_cast<QGVNavStyle*>(new QGVNavStyleTouchpad(this));
} else if (foundInventor != std::string::npos) {
}
else if (foundInventor != std::string::npos) {
m_navStyle = static_cast<QGVNavStyle*>(new QGVNavStyleInventor(this));
} else if (foundTinker != std::string::npos) {
}
else if (foundTinker != std::string::npos) {
m_navStyle = static_cast<QGVNavStyle*>(new QGVNavStyleTinkerCAD(this));
} else if (foundGesture != std::string::npos) {
}
else if (foundGesture != std::string::npos) {
m_navStyle = static_cast<QGVNavStyle*>(new QGVNavStyleGesture(this));
} else if (foundMaya != std::string::npos) {
}
else if (foundMaya != std::string::npos) {
m_navStyle = static_cast<QGVNavStyle*>(new QGVNavStyleMaya(this));
} else if (foundOCC != std::string::npos) {
}
else if (foundOCC != std::string::npos) {
m_navStyle = static_cast<QGVNavStyle*>(new QGVNavStyleOCC(this));
} else if (foundOpenSCAD != std::string::npos) {
}
else if (foundOpenSCAD != std::string::npos) {
m_navStyle = static_cast<QGVNavStyle*>(new QGVNavStyleOpenSCAD(this));
} else if (foundRevit != std::string::npos) {
}
else if (foundRevit != std::string::npos) {
m_navStyle = static_cast<QGVNavStyle*>(new QGVNavStyleRevit(this));
} else {
}
else {
m_navStyle = new QGVNavStyle(this);
}
}
void QGVPage::startBalloonPlacing()
void QGVPage::startBalloonPlacing(DrawView* parent)
{
// Base::Console().Message("QGVP::startBalloonPlacing(%s)\n", parent->getNameInDocument());
balloonPlacing = true;
m_balloonParent = parent;
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
activateCursor(QCursor(balloonCursor->pixmap(Qt::ReturnByValue), balloonHotspot.x(), balloonHotspot.y()));
activateCursor(
QCursor(balloonCursor->pixmap(Qt::ReturnByValue), balloonHotspot.x(), balloonHotspot.y()));
#else
activateCursor(QCursor(*balloonCursor->pixmap(), balloonHotspot.x(), balloonHotspot.y()));
#endif
@@ -299,22 +304,23 @@ void QGVPage::startBalloonPlacing()
void QGVPage::cancelBalloonPlacing()
{
balloonPlacing = false;
m_balloonParent = nullptr;
balloonCursor->hide();
resetCursor();
}
void QGVPage::drawBackground(QPainter *painter, const QRectF &)
void QGVPage::drawBackground(QPainter* painter, const QRectF&)
{
//Note: Background is not part of scene()
if(!drawBkg)
//Note: Background is not part of scene()
if (!drawBkg)
return;
if(!m_vpPage) {
if (!m_vpPage) {
return;
}
if (!m_vpPage->getDrawPage()) {
// Base::Console().Message("QGVP::drawBackground - no Page Feature!\n");
// Base::Console().Message("QGVP::drawBackground - no Page Feature!\n");
return;
}
@@ -322,14 +328,14 @@ void QGVPage::drawBackground(QPainter *painter, const QRectF &)
painter->resetTransform();
painter->setBrush(*bkgBrush);
painter->drawRect(viewport()->rect().adjusted(-2, -2, 2,2)); //just bigger than viewport to prevent artifacts
painter->drawRect(
viewport()->rect().adjusted(-2, -2, 2, 2));//just bigger than viewport to prevent artifacts
// Default to A3 landscape, though this is currently relevant
// only for opening corrupt docs, etc.
float pageWidth = 420,
pageHeight = 297;
float pageWidth = 420, pageHeight = 297;
if ( m_vpPage->getDrawPage()->hasValidTemplate() ) {
if (m_vpPage->getDrawPage()->hasValidTemplate()) {
pageWidth = Rez::guiX(m_vpPage->getDrawPage()->getPageWidth());
pageHeight = Rez::guiX(m_vpPage->getDrawPage()->getPageHeight());
}
@@ -352,11 +358,12 @@ void QGVPage::setRenderer(RendererType type)
if (m_renderer == OpenGL) {
#ifndef QT_NO_OPENGL
// setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers))); //QGLWidget is obsolete
// setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers))); //QGLWidget is obsolete
setViewport(new QOpenGLWidget);
setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
#endif
} else {
}
else {
setViewport(new QWidget);
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
}
@@ -371,7 +378,7 @@ void QGVPage::setHighQualityAntialiasing(bool highQualityAntialiasing)
#endif
}
void QGVPage::paintEvent(QPaintEvent *event)
void QGVPage::paintEvent(QPaintEvent* event)
{
if (m_renderer == Image) {
if (m_image.size() != viewport()->size()) {
@@ -384,16 +391,17 @@ void QGVPage::paintEvent(QPaintEvent *event)
QPainter p(viewport());
p.drawImage(0, 0, m_image);
} else {
}
else {
QGraphicsView::paintEvent(event);
}
}
void QGVPage::contextMenuEvent(QContextMenuEvent *event)
void QGVPage::contextMenuEvent(QContextMenuEvent* event)
{
if (m_navStyle->allowContextMenu(event)) {
QGraphicsView::contextMenuEvent(event); //this eats the event. mouseReleaseEvent will not be called.
QGraphicsView::contextMenuEvent(
event);//this eats the event. mouseReleaseEvent will not be called.
return;
}
@@ -402,9 +410,8 @@ void QGVPage::contextMenuEvent(QContextMenuEvent *event)
if (m_saveContextEvent) {
delete m_saveContextEvent;
}
m_saveContextEvent = new QContextMenuEvent(QContextMenuEvent::Mouse,
event->pos(),
event->globalPos());
m_saveContextEvent =
new QContextMenuEvent(QContextMenuEvent::Mouse, event->pos(), event->globalPos());
}
void QGVPage::pseudoContextEvent()
@@ -414,13 +421,13 @@ void QGVPage::pseudoContextEvent()
}
}
void QGVPage::wheelEvent(QWheelEvent *event)
void QGVPage::wheelEvent(QWheelEvent* event)
{
m_navStyle->handleWheelEvent(event);
event->accept();
}
void QGVPage::keyPressEvent(QKeyEvent *event)
void QGVPage::keyPressEvent(QKeyEvent* event)
{
m_navStyle->handleKeyPressEvent(event);
if (!event->isAccepted()) {
@@ -428,7 +435,7 @@ void QGVPage::keyPressEvent(QKeyEvent *event)
}
}
void QGVPage::keyReleaseEvent(QKeyEvent *event)
void QGVPage::keyReleaseEvent(QKeyEvent* event)
{
m_navStyle->handleKeyReleaseEvent(event);
if (!event->isAccepted()) {
@@ -436,7 +443,8 @@ void QGVPage::keyReleaseEvent(QKeyEvent *event)
}
}
void QGVPage::focusOutEvent(QFocusEvent *event) {
void QGVPage::focusOutEvent(QFocusEvent* event)
{
Q_UNUSED(event);
m_navStyle->handleFocusOutEvent(event);
}
@@ -445,8 +453,8 @@ void QGVPage::kbPanScroll(int xMove, int yMove)
{
if (xMove != 0) {
QScrollBar* hsb = horizontalScrollBar();
// int hRange = hsb->maximum() - hsb->minimum(); //default here is 100?
// int hDelta = xMove/hRange
// int hRange = hsb->maximum() - hsb->minimum(); //default here is 100?
// int hDelta = xMove/hRange
int hStep = hsb->singleStep() * xMove * m_reversePan;
int hNow = hsb->value();
hsb->setValue(hNow + hStep);
@@ -459,70 +467,72 @@ void QGVPage::kbPanScroll(int xMove, int yMove)
}
}
void QGVPage::enterEvent(QEvent *event)
void QGVPage::enterEvent(QEvent* event)
{
QGraphicsView::enterEvent(event);
m_navStyle->handleEnterEvent(event);
QGraphicsView::enterEvent(event);
}
void QGVPage::leaveEvent(QEvent * event)
void QGVPage::leaveEvent(QEvent* event)
{
m_navStyle->handleLeaveEvent(event);
QGraphicsView::leaveEvent(event);
}
void QGVPage::mousePressEvent(QMouseEvent *event)
void QGVPage::mousePressEvent(QMouseEvent* event)
{
m_navStyle->handleMousePressEvent(event);
QGraphicsView::mousePressEvent(event);
}
void QGVPage::mouseMoveEvent(QMouseEvent *event)
void QGVPage::mouseMoveEvent(QMouseEvent* event)
{
m_navStyle->handleMouseMoveEvent(event);
QGraphicsView::mouseMoveEvent(event);
}
void QGVPage::mouseReleaseEvent(QMouseEvent *event)
void QGVPage::mouseReleaseEvent(QMouseEvent* event)
{
m_navStyle->handleMouseReleaseEvent(event);
QGraphicsView::mouseReleaseEvent(event);
resetCursor();
}
TechDraw::DrawPage* QGVPage::getDrawPage()
{
return m_vpPage->getDrawPage();
}
TechDraw::DrawPage* QGVPage::getDrawPage() { return m_vpPage->getDrawPage(); }
QColor QGVPage::getBackgroundColor()
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
.GetUserParameter()
.GetGroup("BaseApp")
->GetGroup("Preferences")
->GetGroup("Mod/TechDraw/Colors");
App::Color fcColor;
fcColor.setPackedValue(hGrp->GetUnsigned("Background", 0x70707000));
return fcColor.asValue<QColor>();
}
double QGVPage::getDevicePixelRatio() const {
for (Gui::MDIView *view : m_vpPage->getDocument()->getMDIViews()) {
double QGVPage::getDevicePixelRatio() const
{
for (Gui::MDIView* view : m_vpPage->getDocument()->getMDIViews()) {
if (view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) {
return static_cast<Gui::View3DInventor *>(view)->getViewer()->devicePixelRatio();
return static_cast<Gui::View3DInventor*>(view)->getViewer()->devicePixelRatio();
}
}
return 1.0;
}
QPixmap QGVPage::prepareCursorPixmap(const char *iconName, QPoint &hotspot) {
QPixmap QGVPage::prepareCursorPixmap(const char* iconName, QPoint& hotspot)
{
QPointF floatHotspot(hotspot);
double pixelRatio = getDevicePixelRatio();
// Due to impossibility to query cursor size via Qt API, we stick to (32x32)*device_pixel_ratio
// as FreeCAD Wiki suggests - see https://wiki.freecadweb.org/HiDPI_support#Custom_cursor_size
double cursorSize = 32.0*pixelRatio;
double cursorSize = 32.0 * pixelRatio;
QPixmap pixmap = Gui::BitmapFactory().pixmapFromSvg(iconName, QSizeF(cursorSize, cursorSize));
pixmap.setDevicePixelRatio(pixelRatio);
@@ -544,27 +554,23 @@ QPixmap QGVPage::prepareCursorPixmap(const char *iconName, QPoint &hotspot) {
return pixmap;
}
void QGVPage::activateCursor(QCursor cursor) {
void QGVPage::activateCursor(QCursor cursor)
{
this->setCursor(cursor);
viewport()->setCursor(cursor);
}
void QGVPage::resetCursor() {
void QGVPage::resetCursor()
{
this->setCursor(Qt::ArrowCursor);
viewport()->setCursor(Qt::ArrowCursor);
}
void QGVPage::setPanCursor()
{
activateCursor(panCursor);
}
void QGVPage::setPanCursor() { activateCursor(panCursor); }
void QGVPage::setZoomCursor()
{
activateCursor(zoomCursor);
}
void QGVPage::setZoomCursor() { activateCursor(zoomCursor); }
void QGVPage::drawForeground(QPainter *painter, const QRectF &rect)
void QGVPage::drawForeground(QPainter* painter, const QRectF& rect)
{
Q_UNUSED(rect);
if (m_showGrid) {
@@ -588,8 +594,8 @@ void QGVPage::makeGrid(int gridWidth, int gridHeight, double gridStep)
//draw horizontal lines
for (int i = 0; i < rows; i++) {
vPos = i * step;
QPointF start (horizStart, -vPos);
QPointF end (width, -vPos);
QPointF start(horizStart, -vPos);
QPointF end(width, -vPos);
grid.moveTo(start);
grid.lineTo(end);
}
@@ -610,9 +616,10 @@ void QGVPage::makeGrid(int gridWidth, int gridHeight, double gridStep)
std::string QGVPage::getNavStyleParameter()
{
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath
("User parameter:BaseApp/Preferences/View");
std::string model = hGrp->GetASCII("NavigationStyle", NavigationStyle::getClassTypeId().getName());
ParameterGrp::handle hGrp =
App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View");
std::string model =
hGrp->GetASCII("NavigationStyle", NavigationStyle::getClassTypeId().getName());
return model;
}
@@ -624,7 +631,7 @@ Base::Type QGVPage::getStyleType(std::string model)
void QGVPage::createStandardCursors(double dpr)
{
(void) dpr; //avoid clang warning re unused parameter
(void)dpr;//avoid clang warning re unused parameter
QBitmap cursor = QBitmap::fromData(QSize(PAN_WIDTH, PAN_HEIGHT), pan_bitmap);
QBitmap mask = QBitmap::fromData(QSize(PAN_WIDTH, PAN_HEIGHT), pan_mask_bitmap);
#if defined(Q_OS_WIN32)