Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QtCreator redundant for GUI development?

QtCreator redundant for GUI development?

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 3.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jimbo
    wrote on last edited by
    #1

    Hello,

    I am new to Qt and have been teaching myself from the tutorials and examples on this site and from the book C++ GUI Programming with Qt 4 by Blanchette and Summerfield.

    I notice that both mainly code the GUIs as opposed to developing the GUI part using QtDesigner/QtCreator.

    I felt that I should be able to save myself a lot of code writing by having a go at one of the tutorials but developing all of the GUI using Qt Creator and just filling in the functions in code.

    However I find that as soon as I try to build the project I get errors saying things like 'nameLineEdit was not declared in this scope" and the only way to get rid of the errors seems to be to write in all the code that I was trying to avoid writing in the first place! At the moment QtCreator seems a bit redundant - am I missing something?

    For example I am having a go at this tutorial: http://doc.qt.nokia.com/4.7/tutorials-addressbook-part2.html

    I made my GUI using QtCreator and then tried adding in the addContact function:

    @void AddressBook::addContact()
    {
    oldName = nameLineEdit->text();
    oldAddress = addressTextEdit->toPlainText();

     nameLineEdit->clear();
     addressTextEdit->clear();
    
     nameLineEdit->setReadOnly(false);
     nameLineEdit->setFocus(Qt::OtherFocusReason);
     addressTextEdit->setReadOnly(false);
    
     addPushButton->setEnabled(false);
     submitPushButton->show();
     cancelPushButton->show();
    

    }
    @

    When I build it complains that it doesn't recognise any of the widgets - I would of expected that as I drop them onto the form it would edit the code so that it does recognise them?

    Should I just be doing everything in code and forgetting about QtCreator?

    Sorry for the long winded first post! Any guidance would be much appreciated!

    Jimbo

    1 Reply Last reply
    0
    • ZlatomirZ Offline
      ZlatomirZ Offline
      Zlatomir
      wrote on last edited by
      #2

      Am i missing something? But as i see that tutorial doesn't use UI file (designer).

      So if you added a UI file you will have a class which contain an ui member pointer or object (you need to initialize that member) and then access the Widgets (you added in Designer) something like:
      @
      ui->NameOfWidget; //if ui is pointer
      //or
      ui.NameOfWidget; //if ui is object
      @
      You can read "this":http://doc.qt.nokia.com/4.7/designer-using-a-ui-file.html page to see the ways ui file can be integrated with C++ code.

      https://forum.qt.io/category/41/romanian

      1 Reply Last reply
      0
      • J Offline
        J Offline
        Jimbo
        wrote on last edited by
        #3

        Aha! That's it!

        Nope you weren't missing something - I was! :)

        It makes more sense now. I'll have a read of the page you mention too.

        Out of interest do many Qt developers use QtCreator or do they go for just the code approach? Most things I see online are all coded.

        Thanks Zlatomir

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          Qt Creator is an IDE. You can write your C++ code, compile it and you can use it to graphically design the forms. You probably mean Qt Designer, which is the stand alone GUI designer. Qt Creator has an embedded Designer version.

          There is no general rule on how to design the forms. Test both (manual and graphical) and take that one that you feel more comfortable with.

          I personally use both approaches simultaneously (and so do many others, too). I prefer the Designer for the more complicated forms (eg. many widgtes, sophisticated layout, etc.) and take the manual way only for small/simple forms. You can achieve practically everything with either approach (in fact the designer forms are translated to some C++ code that gets included to your project).

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • ZlatomirZ Offline
            ZlatomirZ Offline
            Zlatomir
            wrote on last edited by
            #5

            In both cases (Ui Designer file or coded by you in C++) the interface end-up as C++ code, you can have a look in some ui_UIFILENAME.h (the generated code).

            So i say you get comfortable with both methods and then choose the one you like the most ;) you will get a "hunch" when you should use one method or another.

            https://forum.qt.io/category/41/romanian

            1 Reply Last reply
            0
            • J Offline
              J Offline
              Jimbo
              wrote on last edited by
              #6

              Thanks for your help guys!

              I will keep on exploring both methods

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved