Print orientation in ksnapshot cannot be selected. #8

已关闭
MicheleC5 年前创建 · 8 条评论
MicheleC 评论于 5 年前
所有者

From user ML:

Trinity 14.0.6 preliminary.
Don't know if it is a feature of ksnapshot or a misconfiguration
somewhere from me, but it is getting absolutely annoying what happens.
I have a website, a document or whatsoever on my screen in full
A4-papersize. Now I want a printout of a small part of it. Call
ksnapshot, choose "region" "new snapshot" and then draw a border around
the desired part. Press "print" and then print it. Bull... I get a
print in landscape, useless and even worse not even the original layout
reappears.
Stop ksnapshot, restart it and same procedure with again the same
miserable result.
Stop, restart, same procedure but no actual printing, instead I look
into the printer properties. And there, big surprise, landscape was
marked as to be printed BUT all 4 orientations were grayed out, so I
couldn't change that.
Checked in tdeprint the printersettings, nothing wrong, in "instances"
"settings" all 4 orientations were available and portrait was marked as
to be applied in the default printer.
Checked kprinter and of course the settings of tdeprint were there also
valid.
But then I had an idea. If I selected in ksnapshot a larger part of the
screen, say more than half A4, what would happen?
Yes, some ugly words from me and there it was: portrait was marked but
still all 4 possibilities grayed out. 
So ksnapshot decides how it wants to print and doesn't leave the user a
chance to get a result, that he wants. Utterly bull....
Any suggestion, where I could look to alter this behaviour?
Phiebie.

Problem is confirmed.

From user ML: ``` Trinity 14.0.6 preliminary. Don't know if it is a feature of ksnapshot or a misconfiguration somewhere from me, but it is getting absolutely annoying what happens. I have a website, a document or whatsoever on my screen in full A4-papersize. Now I want a printout of a small part of it. Call ksnapshot, choose "region" "new snapshot" and then draw a border around the desired part. Press "print" and then print it. Bull... I get a print in landscape, useless and even worse not even the original layout reappears. Stop ksnapshot, restart it and same procedure with again the same miserable result. Stop, restart, same procedure but no actual printing, instead I look into the printer properties. And there, big surprise, landscape was marked as to be printed BUT all 4 orientations were grayed out, so I couldn't change that. Checked in tdeprint the printersettings, nothing wrong, in "instances" "settings" all 4 orientations were available and portrait was marked as to be applied in the default printer. Checked kprinter and of course the settings of tdeprint were there also valid. But then I had an idea. If I selected in ksnapshot a larger part of the screen, say more than half A4, what would happen? Yes, some ugly words from me and there it was: portrait was marked but still all 4 possibilities grayed out. So ksnapshot decides how it wants to print and doesn't leave the user a chance to get a result, that he wants. Utterly bull.... Any suggestion, where I could look to alter this behaviour? Phiebie. ``` Problem is confirmed.
MicheleC5 年前 添加了里程碑 R14.2.0 release
deloptes 评论于 1年前
协作者

Hi Michele,
when looking into the code recently, I noticed that the orientation is automatically selected based on the size/ratio of the image snapped. It compares width/height and sets the orientation (see here). So it works more or less as designed.

Do you think it is relevant to keep this open or to fix it?

Hi Michele, when looking into the code recently, I noticed that the orientation is automatically selected based on the size/ratio of the image snapped. It compares width/height and sets the orientation ([see here](https://mirror.git.trinitydesktop.org/gitea/TDE/tdegraphics/src/commit/db379a2f50774d6ab871507356e95715cbf68a7b/ksnapshot/ksnapshot.cpp#L311)). So it works more or less as designed. Do you think it is relevant to keep this open or to fix it?
blu.256 评论于 1年前
协作者

Looks like the bug is actually about not being given an option to change (for whatever reason) the automatically picked orientation.

Looks like the bug is actually about not being given an option to change (for whatever reason) the automatically picked orientation.
MicheleC 评论于 1年前
发布者
所有者

I agree with Philippe, the user should be given the choice to select a specific orientation if he wants. Auto selection is a good initial choice, but there should be a way tooverwrite that if wanted.

I agree with Philippe, the user should be given the choice to select a specific orientation if he wants. Auto selection is a good initial choice, but there should be a way tooverwrite that if wanted.
deloptes 评论于 1年前
协作者

Looks like the bug is actually about not being given an option to change (for whatever reason) the automatically picked orientation.

I think it is the setOrientation() here. But I do not understand why.
Perhaps due to

605  d->m_impl->broadcastOption( "kde-orientation-fixed", "1" );

in kprinter.cpp

> Looks like the bug is actually about not being given an option to change (for whatever reason) the automatically picked orientation. I think it is the setOrientation() [here](https://mirror.git.trinitydesktop.org/gitea/TDE/tdegraphics/src/commit/db379a2f50774d6ab871507356e95715cbf68a7b/ksnapshot/ksnapshot.cpp#L300). But I do not understand why. Perhaps due to ``` 605 d->m_impl->broadcastOption( "kde-orientation-fixed", "1" ); ``` in kprinter.cpp
MicheleC 评论于 1年前
发布者
所有者

I think it is the setOrientation() here. But I do not understand why.
Perhaps due to

605  d->m_impl->broadcastOption( "kde-orientation-fixed", "1" );

in kprinter.cpp

That seems the place where the orientation is selected automatically. But we need to find out why the orientation choice is grayed out in the printer dialog. If we can enable that again, then the user should be able to select a different orientation.

> I think it is the setOrientation() [here](https://mirror.git.trinitydesktop.org/gitea/TDE/tdegraphics/src/commit/db379a2f50774d6ab871507356e95715cbf68a7b/ksnapshot/ksnapshot.cpp#L300). But I do not understand why. > Perhaps due to > > ``` > 605 d->m_impl->broadcastOption( "kde-orientation-fixed", "1" ); > ``` > in kprinter.cpp > That seems the place where the orientation is selected automatically. But we need to find out why the orientation choice is grayed out in the printer dialog. If we can enable that again, then the user should be able to select a different orientation.
deloptes 评论于 1年前
协作者

It is set in

    if (snapshot.width() > snapshot.height())
        printer.setOrientation(KPrinter::Landscape);
    else
        printer.setOrientation(KPrinter::Portrait);

and then it uses the printer to get the sizes and scale if needed

    TQPainter painter(&printer);
    TQPaintDeviceMetrics metrics(painter.device());

So the code is optimizing the image for printing, but after this the user can not change.

I think if we remove the automatic orientation, it would work.
I will test and post result later.

It is set in ``` if (snapshot.width() > snapshot.height()) printer.setOrientation(KPrinter::Landscape); else printer.setOrientation(KPrinter::Portrait); ``` and then it uses the printer to get the sizes and scale if needed TQPainter painter(&printer); TQPaintDeviceMetrics metrics(painter.device()); So the code is optimizing the image for printing, but after this the user can not change. I think if we remove the automatic orientation, it would work. I will test and post result later.
deloptes 评论于 1年前
协作者

Commenting out the following and the orientation can be set manually

if (snapshot.width() > snapshot.height())
    printer.setOrientation(KPrinter::Landscape);
else
    printer.setOrientation(KPrinter::Portrait);

I tested now the default "Portrait" and then with "Landscape". It seems OK.

It also scales the image properly.

I will create PR.

Commenting out the following and the orientation can be set manually ``` if (snapshot.width() > snapshot.height()) printer.setOrientation(KPrinter::Landscape); else printer.setOrientation(KPrinter::Portrait); ``` I tested now the default "Portrait" and then with "Landscape". It seems OK. It also scales the image properly. I will create PR.
MicheleC 1年前 修改了里程碑从 R14.2.0 releaseR14.1.0 release
MicheleC 添加了一个新的依赖项 1年前
MicheleC 评论于 1年前
发布者
所有者

Fixed by PR #54

Fixed by PR #54
MicheleC1年前 关闭此工单
登录 并参与到对话中。
未选择里程碑
未指派成员
3 名参与者
通知
到期时间

未设置到期时间。

依赖于
#54 issue/8/ksnapshot
TDE/tdegraphics
参考:TDE/tdegraphics#8
正在加载...
这个人很懒,什么都没留下。