//*.h file
{
Q_OBJECT
public:
MainWindow
(QWidget *parent
=0,
const char *name
="MainWindow" );
~MainWindow(){}
private:
QPopupMenu* file;
QDockWindow* dockWindow;
QScrollView* scrollView;
};
//*.cpp file
MainWindow
::MainWindow(QWidget *parent,
const char *name
){
file = new QPopupMenu(this);
menuBar()->insertItem( tr("&File"), file);
file->insertItem( tr("E&xit"), qApp, SLOT(quit()),
tr("Ctrl+Q", "Quit") );
dockWindow = new QDockWindow(this);
moveDockWindow( dockWindow, Left );
dockWindow->setHorizontallyStretchable( true );
dockWindow->setVerticallyStretchable( true );
dockWindow->setResizeEnabled( true );
dockWindow->setOrientation( Qt::Vertical );
dockWindow->setCaption( tr("Routes") );
scrollView = new QScrollView(splitter);
scrollView->setMinimumSize( 200, 200 );
setCentralWidget(splitter);
label
= new QLabel( statusBar
() );
statusBar()->addWidget( label, 2, TRUE );
statusBar()->addWidget( progressbar, 1, TRUE );
resize( 800, 600 );
}
//main.cpp
int main( int argc, char **argv )
{
MainWindow mw;
app.setMainWidget( &mw );
mw.show();
return app.exec();
}
//*.h file
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent=0, const char *name="MainWindow" );
~MainWindow(){}
private:
QPopupMenu* file;
QDockWindow* dockWindow;
QSplitter* splitter;
QScrollView* scrollView;
QLabel* label;
QProgressBar* progressbar;
};
//*.cpp file
MainWindow::MainWindow(QWidget *parent, const char *name)
:QMainWindow(parent, name)
{
file = new QPopupMenu(this);
menuBar()->insertItem( tr("&File"), file);
file->insertItem( tr("E&xit"), qApp, SLOT(quit()),
tr("Ctrl+Q", "Quit") );
dockWindow = new QDockWindow(this);
moveDockWindow( dockWindow, Left );
dockWindow->setHorizontallyStretchable( true );
dockWindow->setVerticallyStretchable( true );
dockWindow->setResizeEnabled( true );
dockWindow->setOrientation( Qt::Vertical );
dockWindow->setCaption( tr("Routes") );
splitter = new QSplitter(this);
scrollView = new QScrollView(splitter);
scrollView->setFrameStyle( QFrame::Box | QFrame::Raised );
scrollView->setMinimumSize( 200, 200 );
setCentralWidget(splitter);
label = new QLabel( statusBar() );
statusBar()->addWidget( label, 2, TRUE );
progressbar = new QProgressBar(statusBar());
statusBar()->addWidget( progressbar, 1, TRUE );
resize( 800, 600 );
}
//main.cpp
int main( int argc, char **argv )
{
QApplication app( argc, argv );
MainWindow mw;
app.setMainWidget( &mw );
mw.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks