PDA

View Full Version : Menubar in mainwindow form



Draximillian
12th April 2006, 04:06
.. put simply i don't have one..
I open up designer, choose the "Main Window" form and i get a completely blank window, i'd assumed the menubar was part of the template form but even if it isn't i can't find a way to add one to the form from the preset tool list.


Information that may or may not be relevant: i'm using version 4.0.1 and on windows.

Any help'd be greatly appreciated!

Also.. while i'm here, any know why this is not producing an executable?


#include "ui_test.h"
#include <QApplication>

int main(int argc, char *argv[]){
QApplication app(argc, argv);
QDialog *window = new QDialog;
Ui::Test ui;
ui.setupUi(window);

window->show();
return app.exec();
}


Having used qmake to make the project file and the makefile, i then set Dev-C++ to use said makefile... it seems to be compiling as no highlights or debug messages jump out at me... but in when i view the compiler readout window there's loads of random messages (like:
27 C:\Qt\4.0.1\include\QtCore\qatomic.h:1, from C:\Qt\4.0.1\src\corelib\kernel\qvariant.h In file included from C:/Qt/4.0.1/include/QtCore/qatomic.h:1, from C:/Qt/4.0.1/include/QtCore/../../src/corelib/kernel/qvariant.h
)

Cheers Max

bashamehboob
12th April 2006, 08:55
in the given line 7 of your program
Ui::Test ui;


instead of this, you write Ui::Dialog ui; and test it.
:)

Draximillian
12th April 2006, 12:18
in the given line 7 of your program
Ui::Test ui;


instead of this, you write Ui::Dialog ui; and test it.
:)

Originally i did.. but that failed even more miserably (Claimed Dialog was not a member of Ui)... occured to me that it was the object name of the form, which i had changed to Test, hence Test i believe is correct where it is.....

Thanks anyway, appreciate the help.

jacek
12th April 2006, 14:08
Try this:
#include <QApplication>
#include <QMainWindow>

#include "ui_test.h"

int main(int argc, char *argv[]){
QApplication app(argc, argv);
QMainWindow *window = new QMainWindow();
Ui::Test ui;
ui.setupUi(window);

window->show();
return app.exec();
}but first check whether you have set the objectName property of your form to "Test".

Draximillian
12th April 2006, 18:52
but first check whether you have set the objectName property of your form to "Test".
It is.. as mentioned in the previous post... (albeit not very clearly.. sorry about that)

Cheers anyway

Draximillian
13th April 2006, 03:26
I've solved the problems.. i reinstalled qt and the menubar appeared... no idea what happened to mess it up in the first place.. and as for the second problem.. put simply i'm a moron... i'd set my environment variables badly.. they were looking in the wrong folder :P, not my brightest moment..


Thanks for all the help anyway.

Max