Results 1 to 20 of 71

Thread: Application crashes at launch-time

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Application crashes at launch-time

    does the program crash every time, or just some times - this should crash every time.
    Pardon me - this should not even compile!
    I see you use 'ui' variable, yet you access GUI elements (which are not declered in the scope of your class) directly.
    Look, I don't like answering like that, but you are really an extreme case.
    Stop posting such questions.
    You don't know C++, which is nothing to be ashamed of, but you can't expect us to waist our time to see the trivial mistakes you are making, and then teach you why they are a mistake.
    Lern C++ first, then post your questions here.
    This forum is NOT a C++ learning forum, there are many others on the net that do that.
    Last edited by high_flyer; 12th June 2007 at 16:09.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

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

    Default Re: Application crashes at launch-time

    does the program crash every time, or just some times - this should crash every time.
    Pardon me - this should not even compile!
    I see you use 'ui' variable, yet you access GUI elements (which are not declered in the scope of your class) directly.
    Look, I don't like answering like that, but you are really an extreme case.
    Stop posting such questions.
    You don't know C++, which is nothing to be ashamed of, but you can't expect us to waist our time to see the trivial mistakes you are making, and then teach you why they are a mistake.
    Lern C++ first, then post your questions here.
    This forum is NOT a C++ learning forum, there are many others on the net that do that.
    Syntax error on "waist" - verb expected
    Syntax error on "Lern" - unknown token

  3. #3
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Application crashes at launch-time

    hehe... I stand corrected.
    But only two typos is not that bad, relative to other posts....
    The problem is, that my fingers often type what they want, specially if I type fast.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  4. #4
    Join Date
    May 2007
    Posts
    315
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Application crashes at launch-time

    Quote Originally Posted by high_flyer View Post
    does the program crash every time, or just some times - this should crash every time.
    Pardon me - this should not even compile!
    I see you use 'ui' variable, yet you access GUI elements (which are not declered in the scope of your class) directly.
    ?? I've got Dialog class which inherits ui:ialog, where are those declarations! And the function where are they used is part of this class!

  5. #5
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Application crashes at launch-time

    Yes you are confused becasue you don't know C++.
    But we can't help you with that, or at least, I don't have the time for it.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  6. #6
    Join Date
    May 2007
    Posts
    315
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Application crashes at launch-time

    So I have to work at classes subject in my book...Maybe I'll understand...

  7. #7
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Application crashes at launch-time

    That is a good way to go about it.
    You can ask specifc C++ questions that you don't understand in the General Programming section in this forum.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  8. #8
    Join Date
    May 2007
    Posts
    315
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Application crashes at launch-time

    And one more thing, in one of examples in C++ GUI Programming book, form was created by designer and one of command was groupBox->hide(); and it worked

  9. #9
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Application crashes at launch-time

    what is the question?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  10. #10
    Join Date
    May 2007
    Posts
    315
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Application crashes at launch-time

    This is access to GUI element, as you said. My code (subclassing) looks almost the same, and it doesn't work, because I have wrong GUI element access.
    p.s.
    I changed contents of my main.cpp file (it was wrong code in it) and it works.
    edit. I mean that it doesn't crash, window is displayed but with no functionality. If I added ui. prefix in refering to GUI element would it be ok?

  11. #11
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Application crashes at launch-time

    yes - but then you will stumble on the next error, and you wont understand why.
    This is no way to learn C++.
    Do it properly from the start.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  12. #12
    Join Date
    May 2007
    Posts
    315
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Application crashes at launch-time

    Sure, I'll read classes chapter in C++ Symphony (Symfonia C++)

  13. #13
    Join Date
    May 2007
    Posts
    315
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Application crashes at launch-time

    But there still is a problem. I added .ui prefix in every reference to gui element e.g. ui.convertButton->hide(); instead of convertButton->hide(); But it still doesn't have functionality. Did I miss something?

  14. #14
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Application crashes at launch-time

    But there still is a problem.
    Which is exactlxy what I said in my last post:
    yes - but then you will stumble on the next error, and you wont understand why.
    This is no way to learn C++.
    Do it properly from the start.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  15. #15
    Join Date
    Jun 2007
    Location
    Louisiana
    Posts
    77
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Application crashes at launch-time

    Debugging an application that crashes on startup is more difficult with designer ui modules than when you make the forms yourself. The designer generates a lot of MOC able code that gets compiled.

    When you are just starting to learn Qt (or C++ for that matter) you may be better off learning how to manually construct the form first (using the examples and tutorials in Qt). Make the smallest runnable code changes that compile clean. For instance, just make a form that has a group box or frame on it. When you get that small amount of code to work, then add other controls to the working code one at a time.

    In this way you narrow the search for the bugs to just the code you added. It is much easier to debug a few lines of code than several hundred generated by the designer. Especially when you don't understand what it all does.

    Hope this helps.

  16. #16
    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: Application crashes at launch-time

    Quote Originally Posted by ad5xj View Post
    It is much easier to debug a few lines of code than several hundred generated by the designer.
    Sure, but one can safely assume that the code generated by the Designer is OK (which in fact means that you have less code to debug, if you use Designer). Although one shouldn't use a code generator, if he doesn't understand the generated code, so you are right, that it's better to start with learning how to create GUI in code.

Similar Threads

  1. Replies: 5
    Last Post: 27th May 2006, 13:44

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
  •  
Qt is a trademark of The Qt Company.