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)
{
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);
}
#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);
}
To copy to clipboard, switch view to plain text mode
Client1
#include "client1.h"
Client1::Client1(int argc, char **argv)
{
m_mainWindow.showMaximized();
}
#include "client1.h"
Client1::Client1(int argc, char **argv)
: QApplication(argc, argv, QApplication::GuiClient)
{
m_mainWindow.showMaximized();
}
To copy to clipboard, switch view to plain text mode
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?
Bookmarks