mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Profile: use a printMode flag in ProfileGraphicsView
When printing the profile there are certain features which we want different (or disabled). This includes font scale ignoring and showing a toolip. To achieve that we check for a printMode flag in ProfileGraphicsView which can be set using setPrintMode(bool). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
b722bf6931
commit
8ea849d0c2
2 changed files with 12 additions and 1 deletions
|
@ -46,6 +46,7 @@ extern int evn_used;
|
||||||
|
|
||||||
ProfileGraphicsView::ProfileGraphicsView(QWidget* parent) : QGraphicsView(parent), toolTip(0) , dive(0), diveDC(0)
|
ProfileGraphicsView::ProfileGraphicsView(QWidget* parent) : QGraphicsView(parent), toolTip(0) , dive(0), diveDC(0)
|
||||||
{
|
{
|
||||||
|
printMode = false;
|
||||||
gc.printer = false;
|
gc.printer = false;
|
||||||
fill_profile_color();
|
fill_profile_color();
|
||||||
setScene(new QGraphicsScene());
|
setScene(new QGraphicsScene());
|
||||||
|
@ -189,6 +190,11 @@ void ProfileGraphicsView::refresh()
|
||||||
plot(current_dive, TRUE);
|
plot(current_dive, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProfileGraphicsView::setPrintMode(bool mode)
|
||||||
|
{
|
||||||
|
printMode = mode;
|
||||||
|
}
|
||||||
|
|
||||||
void ProfileGraphicsView::plot(struct dive *d, bool forceRedraw)
|
void ProfileGraphicsView::plot(struct dive *d, bool forceRedraw)
|
||||||
{
|
{
|
||||||
struct divecomputer *dc;
|
struct divecomputer *dc;
|
||||||
|
@ -214,6 +220,8 @@ void ProfileGraphicsView::plot(struct dive *d, bool forceRedraw)
|
||||||
toolTip = new ToolTipItem();
|
toolTip = new ToolTipItem();
|
||||||
installEventFilter(toolTip);
|
installEventFilter(toolTip);
|
||||||
scene()->addItem(toolTip);
|
scene()->addItem(toolTip);
|
||||||
|
if (printMode)
|
||||||
|
toolTip->setVisible(false);
|
||||||
|
|
||||||
// Fix this for printing / screen later.
|
// Fix this for printing / screen later.
|
||||||
// plot_set_scale(scale_mode_t);
|
// plot_set_scale(scale_mode_t);
|
||||||
|
@ -1106,7 +1114,8 @@ QGraphicsItemGroup *ProfileGraphicsView::plot_text(text_render_options_t *tro,co
|
||||||
textItem->setPen(Qt::NoPen);
|
textItem->setPen(Qt::NoPen);
|
||||||
|
|
||||||
group->setPos(point.x() + dx, point.y() + dy);
|
group->setPos(point.x() + dx, point.y() + dy);
|
||||||
group->setFlag(QGraphicsItem::ItemIgnoresTransformations);
|
if (!printMode)
|
||||||
|
group->setFlag(QGraphicsItem::ItemIgnoresTransformations);
|
||||||
|
|
||||||
if (!parent)
|
if (!parent)
|
||||||
scene()->addItem(group);
|
scene()->addItem(group);
|
||||||
|
|
|
@ -92,6 +92,7 @@ public:
|
||||||
void plot(struct dive *d, bool forceRedraw = FALSE);
|
void plot(struct dive *d, bool forceRedraw = FALSE);
|
||||||
bool eventFilter(QObject* obj, QEvent* event);
|
bool eventFilter(QObject* obj, QEvent* event);
|
||||||
void clear();
|
void clear();
|
||||||
|
void setPrintMode(bool);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent *event);
|
void resizeEvent(QResizeEvent *event);
|
||||||
|
@ -134,6 +135,7 @@ private:
|
||||||
struct dive *dive;
|
struct dive *dive;
|
||||||
struct divecomputer *diveDC;
|
struct divecomputer *diveDC;
|
||||||
int zoomLevel;
|
int zoomLevel;
|
||||||
|
bool printMode;
|
||||||
|
|
||||||
// Top Level Items.
|
// Top Level Items.
|
||||||
QGraphicsItem* profileGrid;
|
QGraphicsItem* profileGrid;
|
||||||
|
|
Loading…
Add table
Reference in a new issue