Results 1 to 6 of 6

Thread: Menubar in mainwindow form

  1. #1
    Join Date
    Apr 2006
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Menubar in mainwindow form

    .. 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?
    Qt Code:
    1. #include "ui_test.h"
    2. #include <QApplication>
    3.  
    4. int main(int argc, char *argv[]){
    5. QApplication app(argc, argv);
    6. QDialog *window = new QDialog;
    7. Ui::Test ui;
    8. ui.setupUi(window);
    9.  
    10. window->show();
    11. return app.exec();
    12. }
    To copy to clipboard, switch view to plain text mode 

    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

  2. #2
    Join Date
    Apr 2006
    Posts
    10
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: Menubar in mainwindow form

    in the given line 7 of your program
    Ui::Test ui;


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

  3. #3
    Join Date
    Apr 2006
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Menubar in mainwindow form

    Quote Originally Posted by bashamehboob
    in the given line 7 of your program
    Ui::Test ui;


    instead of this, you write Ui:ialog 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.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Menubar in mainwindow form

    Try this:
    Qt Code:
    1. #include <QApplication>
    2. #include <QMainWindow>
    3.  
    4. #include "ui_test.h"
    5.  
    6. int main(int argc, char *argv[]){
    7. QApplication app(argc, argv);
    8. QMainWindow *window = new QMainWindow();
    9. Ui::Test ui;
    10. ui.setupUi(window);
    11.  
    12. window->show();
    13. return app.exec();
    14. }
    To copy to clipboard, switch view to plain text mode 
    but first check whether you have set the objectName property of your form to "Test".

  5. #5
    Join Date
    Apr 2006
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Menubar in mainwindow form

    Quote Originally Posted by jacek
    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

  6. #6
    Join Date
    Apr 2006
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Menubar in mainwindow form

    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

Similar Threads

  1. visible main form?
    By triperzonak in forum Newbie
    Replies: 1
    Last Post: 12th June 2008, 09:00
  2. mainwindow menubar setChecked
    By hvw59601 in forum Qt Programming
    Replies: 1
    Last Post: 31st October 2007, 18:11
  3. Replies: 1
    Last Post: 11th September 2007, 13:34
  4. What's the best way to implement a MainWindow
    By darkadept in forum Qt Programming
    Replies: 5
    Last Post: 5th February 2007, 17:46

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.