Results 1 to 14 of 14

Thread: Creating a Main Window Application

  1. #1
    Join Date
    Jan 2009
    Posts
    78
    Thanks
    21
    Thanked 1 Time in 1 Post

    Default Creating a Main Window Application

    Hi
    His the a recent version of http://developer.kde.org/language-bi...-manual-3.html for me to learn how to create main windows?
    I am looking for an example using QT Designer or even better .... Qt Creator.
    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Creating a Main Window Application

    Ok, first let's make one thing straight - Qt Creator uses Qt Designer internally so everything that goes with Designer, goes with Creator as well.

    Second of all QMainWindow docs will give you all you need to create a main window and its subcomponents.

    How to use them and Designer itself is described here: Qt Designer Manual. Pay special attention to "Using Qt Designer" and "Using Forms and Components" sections.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jan 2009
    Posts
    78
    Thanks
    21
    Thanked 1 Time in 1 Post

    Default Re: Creating a Main Window Application

    I've been here already.
    Has i pointed out in the link above, what i am looking for i more like an how to complete example, and then use the links you gave me as source for understanding some specific specific situations.
    Most of the documentation found on the web assumes that everyone is a great programmer with deep Knowledge of Qt classes ...
    I guess Qt comunity could start investing more in that area.
    Simple an small examples for those o are thinking of using Qt ... or send them back to VB or other stuff like that
    Just a sugestion.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Creating a Main Window Application

    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. The following user says thank you to wysota for this useful post:

    gt.beta2 (21st February 2009)

  6. #5
    Join Date
    Jan 2009
    Posts
    78
    Thanks
    21
    Thanked 1 Time in 1 Post

    Default Re: Creating a Main Window Application

    That's more like it

  7. #6
    Join Date
    Jan 2009
    Posts
    78
    Thanks
    21
    Thanked 1 Time in 1 Post

    Default Re: Creating a Main Window Application

    In the examples the commented lines like ...

    //! [35]

    ... are for?

  8. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Creating a Main Window Application

    These are internal placeholders used by Qt developers.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #8
    Join Date
    Jan 2009
    Posts
    78
    Thanks
    21
    Thanked 1 Time in 1 Post

    Default Re: Creating a Main Window Application

    Hello,

    I've been reading this example: http://doc.trolltech.com/4.4/mainwin...plication.html.

    What if i wanted to use Qt Designer with Qt Creator MainWindow template!

    When we go to Project > Qt4 GUI Application > create a MainWindow project we get some thing like this:

    main.cpp
    Qt Code:
    1. #include <QtGui/QApplication>
    2. #include "mainwindow.h"
    3.  
    4. int main(int argc, char *argv[])
    5. {
    6. QApplication a(argc, argv);
    7. MainWindow w;
    8. w.show();
    9. return a.exec();
    10. }
    To copy to clipboard, switch view to plain text mode 
    mainwindow.h
    Qt Code:
    1. #ifndef MAINWINDOW_H
    2. #define MAINWINDOW_H
    3.  
    4. #include <QtGui/QMainWindow>
    5.  
    6. namespace Ui
    7. {
    8. class MainWindowClass;
    9. }
    10.  
    11. class MainWindow : public QMainWindow
    12. {
    13. Q_OBJECT
    14.  
    15. public:
    16. MainWindow(QWidget *parent = 0);
    17. ~MainWindow();
    18.  
    19. private:
    20. Ui::MainWindowClass *ui;
    21. };
    22.  
    23. #endif // MAINWINDOW_H
    To copy to clipboard, switch view to plain text mode 
    mainwindow.cpp
    Qt Code:
    1. #include "mainwindow.h"
    2. #include "ui_mainwindow.h"
    3.  
    4. MainWindow::MainWindow(QWidget *parent)
    5. : QMainWindow(parent), ui(new Ui::MainWindowClass)
    6. {
    7. ui->setupUi(this);
    8. }
    9.  
    10. MainWindow::~MainWindow()
    11. {
    12. delete ui;
    13. }
    To copy to clipboard, switch view to plain text mode 

    If now i want to reuse the code of the example without the Qt Designer ... where showld i start?!
    Guess this is a more complex inheritance scheme ... but i would like to use it.

    Thaks for the more patient ones

  10. #9
    Join Date
    Jan 2009
    Posts
    78
    Thanks
    21
    Thanked 1 Time in 1 Post

    Default Re: Creating a Main Window Application

    found this ...
    http://doc.trolltech.com/qtcreator-0...g-program.html

    Looks like a starting point.

  11. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Creating a Main Window Application

    Let's make one thing straight. A "main window" is by no means different than a "regular" window/dialog/widget. It just has additional capabilities in regards to what is inside the window, so everything that applies to a "regular" widget, applies to a "main window" widget as well.

    Designer reads and writes UI files that have a .ui extension. Now try guessing which files from the ones created by Creator or whatever else tool anyone might have been using might be opened with Designer.

    Have you read the "Using Forms and Components" section of Designer docs or did you only have a glimpse of it? If the latter then go back and read with understanding what is written there. All your questions can be answered just by reading and understanding the first part of that section of documentation.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  12. #11
    Join Date
    Mar 2006
    Posts
    140
    Thanks
    8
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Creating a Main Window Application

    When I started on Qt, I found that I didn't need to stray any further than the Qt Assistant doco to learn how things work. You need to spend time reading the doco, it's VERY important. Work through the tutorials contained in the doco as well.

  13. #12
    Join Date
    Jan 2009
    Posts
    78
    Thanks
    21
    Thanked 1 Time in 1 Post

    Default Re: Creating a Main Window Application

    Yes ... you are right.
    I was in "kind of a hurry" but i guess i definitely need some reading
    Thanks all .... "I'll be back"

  14. #13
    Join Date
    Jan 2009
    Posts
    78
    Thanks
    21
    Thanked 1 Time in 1 Post

    Default Re: Creating a Main Window Application

    Ok then.

    I've been trough the The Direct Approach, The Single Inheritance Approach and The Multiple Inheritance Approach.

    Guess that each one as it's own application filed.

    The third one seems more comfortable to use, although it says that "...but does not conveniently support composition of multiple user interfaces".

    When i use Qt Creator to start a project based on QDialog class (for instance) it uses single inheritance ... right!

    Can i ask why? Is it because of what i said above, and this way the template will cover all situations?

    Hope this is not another stupid question

  15. #14
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Creating a Main Window Application

    Quote Originally Posted by gt.beta2 View Post
    Can i ask why?
    Because if they chose multiple inheritance, you could have asked the same question

    Probably the person who was writing this piece of code preferrs single over multiple inheritance.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. minimizing main window
    By eric in forum Qt Programming
    Replies: 4
    Last Post: 28th November 2007, 16:54
  2. accessing my main application window widget
    By jayw710 in forum Newbie
    Replies: 8
    Last Post: 15th November 2007, 19:33
  3. Independant window in an application
    By titoo in forum Qt Programming
    Replies: 4
    Last Post: 28th February 2007, 11:07
  4. Replies: 3
    Last Post: 31st March 2006, 18:38
  5. cannot make a main window modal
    By Dark_Tower in forum Qt Programming
    Replies: 12
    Last Post: 23rd March 2006, 10:21

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.