[Kst] branches/work/kst/portto4/kst
Mike Fenton
mike at staikos.net
Thu Jan 15 22:53:33 CET 2009
SVN commit 911671 by fenton:
Add resize of view when exporting graphics.
Switch to a white rather than transparent background painting for print/export.
Switch export to print mode for painter.
M +0 -5 devel-docs/Kst2Specs/Bugs
M +6 -1 devel-docs/Kst2Specs/FixedBugs
M +7 -2 src/libkstapp/mainwindow.cpp
M +4 -9 src/libkstapp/view.cpp
--- branches/work/kst/portto4/kst/devel-docs/Kst2Specs/Bugs #911670:911671
@@ -63,11 +63,6 @@
----------
-Export as png with a set width and height shows transparency (blank)
-where extra space is, rather than resizing the view for the export.
-
-----------
-
Kst should ask about saving the .kst file on exit if the document has changed
(basically, any change other than a mouse/arrow zoom). See 1.x.
*Mike*
--- branches/work/kst/portto4/kst/devel-docs/Kst2Specs/FixedBugs #911670:911671
@@ -285,4 +285,9 @@
either with the toolbar icon remaining depressed until the action is
finished, or in the mouse icon.
*Mike*
---------
\ No newline at end of file
+--------
+
+Export as png with a set width and height shows transparency (blank)
+where extra space is, rather than resizing the view for the export.
+*Mike*
+----------
\ No newline at end of file
--- branches/work/kst/portto4/kst/src/libkstapp/mainwindow.cpp #911670:911671
@@ -218,7 +218,7 @@
void MainWindow::exportGraphicsFile(const QString &filename, const QString &format, int width, int height, int display) {
int viewCount = 0;
- foreach (QGraphicsView *view, _tabWidget->views()) {
+ foreach (View *view, _tabWidget->views()) {
QSize size;
if (display == 0) {
size.setWidth(width);
@@ -241,7 +241,12 @@
QImage image(size, QImage::Format_ARGB32);
QPainter painter(&image);
- view->render(&painter, QRectF(0, 0, size.width(), size.height()), QRect(), Qt::KeepAspectRatio);
+ QSize currentSize(view->size());
+ view->resize(size);
+ view->setPrinting(true);
+ view->render(&painter);
+ view->setPrinting(false);
+ view->resize(currentSize);
QString file = filename;
if (viewCount != 0) {
--- branches/work/kst/portto4/kst/src/libkstapp/view.cpp #911670:911671
@@ -330,15 +330,6 @@
void View::sharePlots() {
- qDebug() << "View::sharePlots";
-// SharedAxisCommand *layout = new SharedAxisCommand(new LayoutBoxItem(this));
-// layout->createLayout(0);
-//
-// if (_layoutBoxItem) {
-// _layoutBoxItem->setEnabled(false);
-// delete _layoutBoxItem;
-// _layoutBoxItem = 0;
-// }
new LayoutBoxItem(this);
ViewGridLayout::sharePlots(_layoutBoxItem);
@@ -402,6 +393,10 @@
void View::drawBackground(QPainter *painter, const QRectF &rect) {
if (isPrinting()) {
+ QBrush currentBrush(backgroundBrush());
+ setBackgroundBrush(Qt::white);
+ QGraphicsView::drawBackground(painter, rect);
+ setBackgroundBrush(currentBrush);
return;
}
More information about the Kst
mailing list