Seafood/main.cpp
author John Kern <johnk@symbian.org>
Wed, 08 Sep 2010 15:36:31 -0700
changeset 44 ca3ea89c80a3
parent 16 e26c25b72a12
permissions -rwxr-xr-x
remove obsolete dependencies
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
     1
#include <QtGui/QApplication>
13
92f7e918c7b5 display context menus
John Kern <johnk@symbian.org>
parents: 12
diff changeset
     2
#include <QWidget>
92f7e918c7b5 display context menus
John Kern <johnk@symbian.org>
parents: 12
diff changeset
     3
3
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
     4
#include "mainwindow.h"
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
     5
16
e26c25b72a12 fix the table layout looks presentable
John Kern <johnk@symbian.org>
parents: 13
diff changeset
     6
// Tech Tip: By default, Actions is added to the Options menu. The
13
92f7e918c7b5 display context menus
John Kern <johnk@symbian.org>
parents: 12
diff changeset
     7
// idea is to support context menus on non-touch mobiles.
92f7e918c7b5 display context menus
John Kern <johnk@symbian.org>
parents: 12
diff changeset
     8
void disableContextMenu()
92f7e918c7b5 display context menus
John Kern <johnk@symbian.org>
parents: 12
diff changeset
     9
{
92f7e918c7b5 display context menus
John Kern <johnk@symbian.org>
parents: 12
diff changeset
    10
    QWidgetList widgets = QApplication::allWidgets();
92f7e918c7b5 display context menus
John Kern <johnk@symbian.org>
parents: 12
diff changeset
    11
    QWidget* wid=0;
92f7e918c7b5 display context menus
John Kern <johnk@symbian.org>
parents: 12
diff changeset
    12
    foreach(wid,widgets)
92f7e918c7b5 display context menus
John Kern <johnk@symbian.org>
parents: 12
diff changeset
    13
    {
92f7e918c7b5 display context menus
John Kern <johnk@symbian.org>
parents: 12
diff changeset
    14
        wid->setContextMenuPolicy(Qt::NoContextMenu);
92f7e918c7b5 display context menus
John Kern <johnk@symbian.org>
parents: 12
diff changeset
    15
    }
92f7e918c7b5 display context menus
John Kern <johnk@symbian.org>
parents: 12
diff changeset
    16
}
92f7e918c7b5 display context menus
John Kern <johnk@symbian.org>
parents: 12
diff changeset
    17
3
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    18
int main(int argc, char *argv[])
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    19
{
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    20
    QApplication a(argc, argv);
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    21
    MainWindow w;
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    22
    w.createMenus();
13
92f7e918c7b5 display context menus
John Kern <johnk@symbian.org>
parents: 12
diff changeset
    23
    disableContextMenu();
12
60c644f011c7 fix for datebase skew
John Kern <johnk@symbian.org>
parents: 11
diff changeset
    24
    w.setWindowTitle("Seafood");
11
f3dbeee07821 instrumented with debugging output
John Kern <johnk@symbian.org>
parents: 3
diff changeset
    25
    w.setStyleSheet("* { background-color:rgb(199,147,88); padding: 7px ; color:rgb(255,255,255)}");
3
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    26
#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5)
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    27
    w.showMaximized();
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    28
#else
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    29
    w.show();
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    30
#endif
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    31
    return a.exec();
e6d1a78b6db9 wip - start of an example for my forthcoming presentation
John Kern <johnk@symbian.org>
parents:
diff changeset
    32
}