Print preview for KmPlot
ClosedPublic

Authored by yurchor on Dec 16 2018, 4:21 PM.

Details

Summary

A bit ugly attempt to implement print preview with an additional configuration widget.

Test Plan
  1. Plot something.
  2. Choose "File -> Print Preview"
  3. Press the last button on the toolbar to configure the print options.
  4. Press the "Ok" button.
  5. The preview should be updated with the parameters chosen on step 3.
  6. Press the "Print" button. The plot with the chosen parameters should be printed (identical to the preview).

I need an advice on the quality of the code.

Many thanks in advance for your reviews.

Diff Detail

Repository
R334 KmPlot
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
yurchor created this revision.Dec 16 2018, 4:21 PM
Restricted Application added a project: KDE Edu. · View Herald TranscriptDec 16 2018, 4:21 PM
Restricted Application added a subscriber: kde-edu. · View Herald Transcript
yurchor requested review of this revision.Dec 16 2018, 4:21 PM
yurchor updated this revision to Diff 47725.Dec 17 2018, 5:04 PM
yurchor retitled this revision from [WIP] Print preview for KmPlot to Print preview for KmPlot.
yurchor edited the test plan for this revision. (Show Details)

Fix updating print preview.

yurchor updated this revision to Diff 47782.Dec 18 2018, 5:05 PM

Add some docs.

Restricted Application added a project: Documentation. · View Herald TranscriptDec 18 2018, 5:05 PM
Restricted Application added a subscriber: kde-doc-english. · View Herald Transcript
yurchor updated this revision to Diff 48056.Dec 23 2018, 12:00 PM

Remove extraneous changes.

yurchor updated this revision to Diff 48072.Dec 23 2018, 2:02 PM

Should be a safer version (QPointers and delete after use).

tcanabrava added inline comments.
kmplot/maindlg.cpp
703–704

If you are creating them here to delete them in the end of the function, why don't you create them on the stack?

735–736

create them on the stack do you don't need to call delete.

tcanabrava requested changes to this revision.Dec 24 2018, 12:56 PM
This revision now requires changes to proceed.Dec 24 2018, 12:56 PM
yurchor marked 2 inline comments as done.Dec 24 2018, 4:32 PM
yurchor added inline comments.
kmplot/maindlg.cpp
703–704

The same pattern can be found above.

Just for other possible reviewers, the discussions on this topic can be found by the following addresses

https://blogs.kde.org/node/3919

https://phabricator.kde.org/D7285

https://phabricator.kde.org/D17697

It seems that this is a questionable decision but it might be of some sense. Thanks in advance for your opinions.

yurchor updated this revision to Diff 49466.Jan 14 2019, 5:52 PM
yurchor marked an inline comment as done.

Rebase

aacid added a subscriber: aacid.Jan 14 2019, 9:56 PM

I feel there's some code that could be shared between this function and the one above

yurchor updated this revision to Diff 49527.Jan 15 2019, 1:58 PM

Group the similar printing setup instructions into the separate function.

aacid added inline comments.Jan 15 2019, 9:39 PM
kmplot/maindlg.cpp
235 ↗(On Diff #49527)

maybe use a new style connect here?

cfeck added a subscriber: cfeck.Jan 15 2019, 11:11 PM
cfeck added inline comments.
kmplot/maindlg.cpp
235 ↗(On Diff #49527)

There is no addAction(KStandardAction::StandardAction, QString, QObject, Func) prototype in KActionCollection, so it's OK.

Then it looks ok to me (well there's no need to move some of the includes to the header, with fordward declarations it would be enough, but who cares i guess :D)

Let's see if @tcanabrava has something else to say :)

kmplot/maindlg.cpp
235 ↗(On Diff #49527)

oh, someone should fix that :)

tcanabrava accepted this revision.Jan 16 2019, 8:46 AM
This revision is now accepted and ready to land.Jan 16 2019, 8:46 AM
This revision was automatically updated to reflect the committed changes.