PDA

View Full Version : Desktop environment for mobile devices



zuck
17th December 2009, 10:05
Hi, I need to implement a simple custom desktop environment for a mobile device (it's a learning exercise). I'm using Qt Embedded for Linux. I want to realize the classic structure of a mobile desktop:

- A top-level status bar.
- An active area where windows are painted.

The status bar and active area management are implemented in a server application, other windows are part of separated applications. I want that each window is painted maximized (only one window per time) only in the active area.

Currently I've written this code snippet:

Server


#include "server.h"
#include <QtGui/QDesktopWidget>
#include <QtGui/QWSServer>

Server::Server(int argc, char **argv)
: QApplication(argc, argv, QApplication::GuiServer)
{
QRect screen_rect = this->desktop()->screenGeometry();
QRect active_rect = screen_rect.adjusted(0, m_statusBar.height(), 0, 0);

m_statusBar.show();

qwsServer->setMaxWindowRect(active_rect);
}


Client1


#include "client1.h"

Client1::Client1(int argc, char **argv)
: QApplication(argc, argv, QApplication::GuiClient)
{
m_mainWindow.showMaximized();
}


It works but if a client application shows a window not maximized, the window overlaps the status bar and I don't want this.

Another question: how can I do this with QGraphicsView instead?

high_flyer
17th December 2009, 10:31
It works but if a client application shows a window not maximized, the window overlaps the status bar and I don't want this.
you can use the Qt::WindowStaysOnTopHint flag for the status bar

zuck
17th December 2009, 10:55
Thanks, it works. But how can I force the window's region to the active area?

high_flyer
17th December 2009, 17:16
you can set a widget to be a desktop widget also with a window flag.

zuck
17th December 2009, 18:47
And after that?

I've tried to create a custom widget with Qt::Desktop flag set, but windows seem to ignore it.