Example #1
0
/*
 *  Constructs a TextViewer which is a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'
 */
    TextViewer::TextViewer( QWidget *parent, Qt::WFlags f )
: QMainWindow( parent, f )
{
    textArea = new QTextEdit(this);
    textArea->setReadOnly(true);
    setCentralWidget(textArea);
    docSelector = new QDocumentSelector();

    QAction *actionOpen = new QAction(tr("Open Document"), this );
    connect(actionOpen, SIGNAL(triggered()), this, SLOT(openDocument()));
#ifdef QTOPIA_PHONE
    QMenu* menu = QSoftMenuBar::menuFor(textArea);
    menu->addAction(actionOpen);
#else
    ToolBar *toolbar = new QToolBar(this);
    toolbar->setMovable(false);
    addToolBar(toolbar);
    toolbar->addAction(actionOpen);
#endif
    connect(docSelector, SIGNAL(documentSelected(QContent)), this, SLOT(documentSelected(QContent)));
}