summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-04-23 04:55:40 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-04-23 04:55:40 (GMT)
commit4b3526fe1793beb6f40aa64ed7f8caa8813c58bc (patch)
treebc5b07d994ec5afd00842b260ccf02efda8f27b8
parent81f6165b369ae07b0c70cd2684e2313491b6b2f4 (diff)
downloadQt-4b3526fe1793beb6f40aa64ed7f8caa8813c58bc.zip
Qt-4b3526fe1793beb6f40aa64ed7f8caa8813c58bc.tar.gz
Qt-4b3526fe1793beb6f40aa64ed7f8caa8813c58bc.tar.bz2
Fix hidden menu on embedded.
Menu strangely still produces hits on embedded. Don't create it if frameless.
-rw-r--r--tools/qml/qmlruntime.cpp23
-rw-r--r--tools/qml/qmlruntime.h1
2 files changed, 17 insertions, 7 deletions
diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp
index 87a4d21..a715de9 100644
--- a/tools/qml/qmlruntime.cpp
+++ b/tools/qml/qmlruntime.cpp
@@ -537,6 +537,14 @@ QDeclarativeViewer::~QDeclarativeViewer()
delete namFactory;
}
+int QDeclarativeViewer::menuBarHeight() const
+{
+ if (!(windowFlags() & Qt::FramelessWindowHint))
+ return menuBar()->height();
+ else
+ return 0; // don't create menu
+}
+
QMenuBar *QDeclarativeViewer::menuBar() const
{
#if !defined(Q_OS_SYMBIAN)
@@ -916,7 +924,7 @@ void QDeclarativeViewer::statusChanged()
initialSize = canvas->sizeHint();
if (canvas->resizeMode() == QDeclarativeView::SizeRootObjectToView) {
QSize newWindowSize = initialSize;
- newWindowSize.setHeight(newWindowSize.height()+menuBar()->height());
+ newWindowSize.setHeight(newWindowSize.height()+menuBarHeight());
updateSizeHints();
resize(newWindowSize);
}
@@ -1065,8 +1073,10 @@ void QDeclarativeViewer::setSkin(const QString& skinDirOrName)
} else if (skin) {
skin = 0;
clearMask();
- menuBar()->clear();
- createMenu(menuBar(),0);
+ if ((windowFlags() & Qt::FramelessWindowHint)) {
+ menuBar()->clear();
+ createMenu(menuBar(),0);
+ }
canvas->setParent(this, Qt::SubWindow);
setParent(0,windowFlags()); // recreate
mb->show();
@@ -1079,7 +1089,7 @@ void QDeclarativeViewer::setSkin(const QString& skinDirOrName)
canvas->setFixedSize(initialSize);
}
QSize newWindowSize = canvas->size();
- newWindowSize.setHeight(newWindowSize.height()+menuBar()->height());
+ newWindowSize.setHeight(newWindowSize.height()+menuBarHeight());
resize(newWindowSize);
show();
}
@@ -1401,9 +1411,8 @@ void QDeclarativeViewer::updateSizeHints()
{
if (canvas->resizeMode() == QDeclarativeView::SizeViewToRootObject) {
QSize newWindowSize = canvas->sizeHint();
- if (!skin) {
- newWindowSize.setHeight(newWindowSize.height()+menuBar()->height());
- }
+ if (!skin)
+ newWindowSize.setHeight(newWindowSize.height()+menuBarHeight());
if (!isFullScreen() && !isMaximized()) {
resize(newWindowSize);
setFixedSize(newWindowSize);
diff --git a/tools/qml/qmlruntime.h b/tools/qml/qmlruntime.h
index a00a703..2a0a07d 100644
--- a/tools/qml/qmlruntime.h
+++ b/tools/qml/qmlruntime.h
@@ -146,6 +146,7 @@ private slots:
private:
QString getVideoFileName();
+ int menuBarHeight() const;
PreviewDeviceSkin *skin;
QSize skinscreensize;