mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-27 20:58:47 +00:00
Printing: fix rendering bug for odd number of dives
Odd number of dives needs extra space from the buttom, so that when we scroll to the last page extra whitespace is shown under the last dive frame, this is fixed by adding a default footer to the base template. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
c152314790
commit
1040f0d4e5
4 changed files with 20 additions and 12 deletions
|
@ -30,7 +30,7 @@ void Printer::render()
|
|||
|
||||
webView->page()->setViewportSize(size);
|
||||
|
||||
int Pages = ceil((float)webView->page()->mainFrame()->contentsSize().rheight() / A4_300DPI_HIGHT);
|
||||
int Pages = ceil(getTotalWork() / 2.0);
|
||||
for (int i = 0; i < Pages; i++) {
|
||||
webView->page()->mainFrame()->render(&painter, QWebFrame::ContentsLayer);
|
||||
webView->page()->mainFrame()->scroll(0, A4_300DPI_HIGHT);
|
||||
|
|
|
@ -84,6 +84,11 @@
|
|||
overflow: hidden !important;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
#footer {
|
||||
width: 96%;
|
||||
height: 50%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -200,5 +205,7 @@
|
|||
</div>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
<div id="footer">
|
||||
<div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -3,16 +3,7 @@
|
|||
#include "templatelayout.h"
|
||||
#include "helpers.h"
|
||||
|
||||
TemplateLayout::TemplateLayout()
|
||||
{
|
||||
}
|
||||
|
||||
TemplateLayout::~TemplateLayout()
|
||||
{
|
||||
delete m_engine;
|
||||
}
|
||||
|
||||
int TemplateLayout::getTotalWork()
|
||||
int getTotalWork()
|
||||
{
|
||||
int dives = 0, i;
|
||||
struct dive *dive;
|
||||
|
@ -25,6 +16,15 @@ int TemplateLayout::getTotalWork()
|
|||
return dives;
|
||||
}
|
||||
|
||||
TemplateLayout::TemplateLayout()
|
||||
{
|
||||
}
|
||||
|
||||
TemplateLayout::~TemplateLayout()
|
||||
{
|
||||
delete m_engine;
|
||||
}
|
||||
|
||||
QString TemplateLayout::generate()
|
||||
{
|
||||
int progress = 0;
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
#include <grantlee_templates.h>
|
||||
#include "mainwindow.h"
|
||||
|
||||
int getTotalWork();
|
||||
|
||||
class TemplateLayout : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -13,7 +15,6 @@ public:
|
|||
|
||||
private:
|
||||
Grantlee::Engine *m_engine;
|
||||
int getTotalWork();
|
||||
|
||||
signals:
|
||||
void progressUpdated(int value);
|
||||
|
|
Loading…
Reference in a new issue