Trying to implement QMainWindow...
I made a custom widget called MovieTabPane, which eventually will be inside a QTabWidget. But I've been testing it using this:
Code:
MovieTabPane *m = new MovieTabPane();
m->show();
Which has worked fine. But now, I'm adding the QMainWindow, and trying to put the MovieTabPane on as the central widget with a QMenuBar. The entire window comes out empty except the menu bar and widget, which are cramped into the top left corner.
Here's the code:
Code:
ApplicationWindow()
{
// Create MenuBar and Connection Menu
mConnectionMenu
= new QMenu( tr
("&Connection"), mMenuBar
);
mMenuBar->addMenu( mConnectionMenu );
// Create Connect Action, and connect triggered() signal to message() <== temporary
mConnectAction
= new QAction( tr
("Co&nnect"), mConnectionMenu
);
connect( mConnectAction, SIGNAL( triggered() ), this, SLOT( message() ) );
// Create Custom Widget
mMovieTabPane = new MovieTabPane( this );
// Create Grid Layout and add mMovieTabPane
mGridLayout->addWidget( mMovieTabPane );
// Tell AppWindow to use mGridLayout
setLayout( mGridLayout );
// Scale
resize( 905, 495 );
// Show
show();
}
I'll be back in a few hours to check replies... gotta go write a Physics mid term ;)
Re: Trying to implement QMainWindow...
try this code
Code:
ApplicationWindow
::ApplicationWindow(QWidget *parent
) {
// Create MenuBar and Connection Menu
QMenu *connectMenu
= menuBar
()->addMenu
(tr
("&Connection"));
// Create Connect Action, and connect triggered() signal to message() <== temporary
mConnectAction
= new QAction( tr
("Co&nnect"),
this );
connectMenu->addAction(mConnectAction);
connect( mConnectAction, SIGNAL( triggered() ), this, SLOT( message() ) );
// Create Custom Widget
mMovieTabPane = new MovieTabPane( this );
// Scale
resize( 905, 495 );
setCentralWidget(mMovieTabPane);
}
Re: Trying to implement QMainWindow...
Thanks! That works perfectly. :D