Dialog position feature

Based on the request by @slspencer during today’s Seamly meeting, I put together a new feature. You will now be able to set a preference for the posistion of where you want tool dialogs to open up on the screen… Top Left, Top Right, Center, Bottom Left, and Bottom Right. The Graphics->Appearance->Dialogs->Position pref can be set by selecting a radio button.

image

The corner options will open with about a 10 pixel margin from the screen edge.

image

There’s a few dialogs that may not be positionable, as they are more or less message boxes that don’t use the base dialog tool class where the postion routine resides.

5 Likes

I changed the radio button text to read Top and Bottom instead of Upper and Lower. Just to be consistent with the Qt terms for QRect’s.

image

BTW… the default Position will be Center for users until they change the position.

I should also note that this will not affect some of the dialogs such as the Variables and History. Those are non modal dialogs which will still open in the center, can be minimized, and the geometry is saved in the settings so they should open at whatever state you last opened them in.

4 Likes

As long as I can still move the dialog window out of my way when I need to see what’s behind it! On computers where I can’t do that, I don’t know what setting I’ll end up using, but it will be nice to have the option.

:unicorn:

2 Likes

Is there also an option on which screen it pops up? I am working with two screens usually. Laptop + bigger screen. Right now it always pops up on the laptop. For the Fx pop up it is a bit unhandy to work.

2 Likes

Yes you can still move the dialog. If you leave the setting set to center there will be no difference than what it does now. Susan asked if we could have it open in the Top left corner so it’s not always covering what you’re trying to see. I figured I’d just add all 4 corners - although the Top left is probably the most likely choice

I looked into it… and it’s pretty simple to have dialogs open on the second monitor. I did a quick test and it works. I just have to add a checkbox to the prefs, and some code to check if a second monitor exists, and if those conditions are true, with some offset code the dialog will open on the second monitor. :slight_smile:

5 Likes

Well that was almost too easy. There’s now an option to open the dialogs on a second monitor… if one is available - in the position selected.

image

4 Likes

I made one last addition… You can select an x:y offset to position the top left corner of the dialog box anywhere on the screen. If the offsets entered are greater than width or height of the screen - dialog, then the width or height of the screen - dialog is used to keep it on the screen. To enable the offset spinboxes you just select the Offset radio button.

image

6 Likes

@Douglas Thanks for adding this option. It will approve the workflow.

2 Likes

You’re welcome. I thought it was going to be difficult to implement. Turns out it was quite easy. Instead of just referencing the primary screen, I was able to use a Qt function to grab a list of available screens (monitors)… and depending on if the checkbox is checked, just use screen 1 or 2… nothing else in the code need to be changed. Qt handles figuring out the corner or center coordinates regardless of screen size. :slight_smile:

3 Likes

U are my hero? Even I do not understand what you are talking about.
Many many thanks. It works for a old white man :smiling_face:

3 Likes

Hallo,

Hallo Douglas, all pops up open in the 2nd screen, unfortunatley if the fx panel still opens in the 1st screen. Possible to change this? Gr Michael

2 Likes

Sure. I must have missed this dialog. Oops.

1 Like

@MG2024

Update: I found (and fixed) the issue. The FX editor dialog is one of the ones that remembers the size of the dialog if you uresize it. There’s an overriding method showEvent() that will size AND center the dialog when the dialog is shown AFTER it’s constructed. So even if in the constructor the default position is being set, once the dialog opens it is RE positioned to the center. :roll_eyes:

Just needed to replace the centering code in showEvent() with the setDialogPosition() routine. There’s also a few other dialogs at the present that I can’t set the position on - like the Label Template editor. The base class for them is only QDialog where they lack the base class DialogTool that all the tools are based on, and as such lacks access to the setDialogPosition() routine.

2 Likes

Hallo Douglas, thanks for Ur effort.

2 Likes