Making the status pane disappear, but not the control pane. (softkeys?)
-
Okay! So I have kind of hit a road bump in my app, I've been trying to make the Statuspane disappear, while keeping the control pane. I simply can't seem to make it work. I've been trying to follow and understand this example: http://doc.qt.nokia.com/latest/widgets-softkeys.html but with limited C++ knowledge and even less with the Qt Creator, I have found myself at a bit of a road bump. I have tried various things for hours, but what I'm currently sitting with is:
mainwindow.h:
@
#include "mainwindow.h"#include <QtGui/QApplication>
#include <QtGui>int main(int argc, char *argv[])
{
QApplication app(argc, argv);MainWindow mainWindow; mainWindow.setOrientation(MainWindow::ScreenOrientationAuto);
// mainWindow.showExpanded();
mainWindow.showMaximized();return app.exec();
}
@and in my mainwindow.cpp I’ve added a void like this, nothing else related to what I want:
@#include "mainwindow.h"
#include "ui_mainwindow.h"#include <QtCore/QCoreApplication>
#include <QtGui>
#include <Qt>
#include <QFlags>MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow)
{
ui->setupUi(this);}
MainWindow::~MainWindow()
{
delete ui;
}void MainWindow::setOrientation(ScreenOrientation orientation)
{
#if defined(Q_OS_SYMBIAN)
// If the version of Qt on the device is < 4.7.2, that attribute won't work
if (orientation != ScreenOrientationAuto) {
const QStringList v = QString::fromAscii(qVersion()).split(QLatin1Char('.'));
if (v.count() == 3 && (v.at(0).toInt() << 16 | v.at(1).toInt() << 8 | v.at(2).toInt()) < 0x040702) {
qWarning("Screen orientation locking only supported with Qt 4.7.2 and above");
return;
}
}
#endif // Q_OS_SYMBIANQt::WidgetAttribute attribute; switch (orientation) {
#if QT_VERSION < 0x040702
// Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes
case ScreenOrientationLockPortrait:
attribute = static_castQt::WidgetAttribute(128);
break;
case ScreenOrientationLockLandscape:
attribute = static_castQt::WidgetAttribute(129);
break;
default:
case ScreenOrientationAuto:
attribute = static_castQt::WidgetAttribute(130);
break;
#else // QT_VERSION < 0x040702
case ScreenOrientationLockPortrait:
attribute = Qt::WA_LockPortraitOrientation;
break;
case ScreenOrientationLockLandscape:
attribute = Qt::WA_LockLandscapeOrientation;
break;
default:
case ScreenOrientationAuto:
attribute = Qt::WA_AutoOrientation;
break;
#endif // QT_VERSION < 0x040702
};
setAttribute(attribute, true);
}void MainWindow::showExpanded()
{
#ifdef Q_OS_SYMBIAN
showFullScreen();
#elif defined(Q_WS_MAEMO_5)
showMaximized();
#else
show();
#endif
}void MainWindow::setMode()
{
Qt::WindowFlags flags = windowFlags();
flags |= Qt::WindowSoftkeysVisibleHint;
flags &= ~Qt::WindowSoftkeysRespondHint;
setWindowFlags(flags); // Hides visible window
showFullScreen();}
@
I've tried switching the flags around, I've tried switching the second if a bit, but I can't seem to make it work. All I want is to remove the status pane, while keeping the softkeys, but this is sooo frustrating. I hope someone has had to deal with this before.Edit: I forgot to mention, this is a Mobile Application, specifically made for Symbian^3, at this stage at least. I have tried endless times to make this work by various means, I have searched the web over and over in an attempt of finding another answer or someone who knew what to do. But it usually comes back to the softkeys example.
-
According to the code you supplied, where are you calling setMode(). What you are doing in setMode should serve the purpose.