Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, March 2002
Small window positioning problem (QT 2.30NC on Win2000)


Message 1 in thread

Hi.

I have a very little problem with my Qt application under Windows
(2000 if that matters):

When I set the main window position to (0,0), the window always
positions at the very top left edge of the screen, not at the very top
left edge of the usable workspace. Let me explain a little further:
When I maximize the window, it correctly only takes up the usable
workspace, which is constraint not only by the taskbar (which is
sticking to the foreground, always visible), but also by a shortcut
bar at the top of the screen (also sticking to the foreground, always
visible). However, I would like my application to position itself at
the top left corner of the usable workspace.
Is there a (more or less easy) way for me to get the dimensions
(position and size) of the usable workspace, or on a different
approach, the positions, sizes and flags (sticky, always on top) of
(visible) shortcut bars?

cu,
sven

PS: Great list, already gave me a few good ideas after only 3 days of
reading it. Couldn't find a solution to my above problem in the
archive though.
-- 
 [ signature omitted ] 

Message 2 in thread

On Wed, 6 Mar 2002 13:08:55 -0500, you ("Sean Murphy"
<sean.murphy@veridian.com>) wrote:

I included the mailinglist in Cc: because this seems to be a more
general problem than I thought, and I'm hoping to get some more help
off the list.

> I don't an answer for you, but I do have a question!
> 
> When you set the position to (0,0), how are you doing it?  With my
> application, I do this:
>   Pilot_DisplayImpl *pilot_display=new Pilot_DisplayImpl();
>   pilot_display->setGeometry(0,0,pilot_display->width(),
> pilot_display->height());
>   a.setMainWidget(pilot_display);
> 
> But when I run my application under Windows 2000 and Windows 98, I can't
> see the title bar of my application (the bar with the application's
> name, minimize, maximize, and close buttons).  So the top thing I can
> see is the menu bar (with File, Help, etc...).  Do you see this too?

Yup, same effect here. I just hadn't noticed so far because of the
more obvious reason with the shortcut bar.
However, if I set the "automatically hide if inactive" flag on the
shortcut bar, and set it again, the Qt application window gets moved
below the shortcut bar automatically, also revealing the window title
bar (that bar with the system menu and the minimize,maximize,close
buttons).

Anybody have a hint what we two are doing wrong?

I set the geometry using QMainWindow.setGeometry(0,0,600,400) (on a
1024x768 screen with shortcut bars/taskbars at the top and bottom
edges of the screen). 

cu,
sven
-- 
 [ signature omitted ] 

Message 3 in thread

> Anybody have a hint what we two are doing wrong?
>
> I set the geometry using QMainWindow.setGeometry(0,0,600,400) (on a
> 1024x768 screen with shortcut bars/taskbars at the top and bottom
> edges of the screen).

Use QWidget::move() instead.

As specified in the docs, setGeometry does not care for the window frame, it moves the upper left corner of the interior to the
given point.
If you see different behavior with some X11 window managers, that is explained here:
http://doc.trolltech.com/3.0/geometry.html


- Soeren