Page 2 of 4 FirstFirst 1234 LastLast
Results 21 to 40 of 71

Thread: Application crashes at launch-time

  1. #21
    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?

  2. #22
    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.

  3. #23
    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++)

  4. #24
    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?

  5. #25
    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.

  6. #26
    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

    Of course, you're right

  7. #27
    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

    Now I understand why do we have to use .ui prefix. Because in main cpp before creating dialog we define Ui:ialog ui; where ui is a variable of the class in which is setupUi so that we have to call ui prefix to refer content of setupUi class. Is that right?

  8. #28
    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

    Well, yes and no.
    Yes - but its not a "prefix".
    Its an object, which has elements, and that is the way you reference elements of objects in C++.
    But as you see, once you started reading a bit, things get much clearer.
    Continue so.

    You don't have to post here each time you learn a new C++ concept, we know them already

    You are welcome to ask specific question in the General Programming sections any time though.
    ==========================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.

  9. #29
    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

    I read classes chapter of my book and I think that there's something wrong with calling just e.g. hide():
    Qt Code:
    1. ui.convertButton->hide();
    To copy to clipboard, switch view to plain text mode 
    But I don't know what.
    edit:
    or maybe no. In docs it was something like this:
    Qt Code:
    1. ui.colorDepthCombo->addItem(tr("2 colors (1 bit per pixel)"));
    To copy to clipboard, switch view to plain text mode 
    Could you tell me, what's wrong? I understand classes, but don't know why application doesn't have any functionality (the only working thing is exit button which closes dialog. But connection was made in designer)
    Last edited by Salazaar; 12th June 2007 at 19:42.

  10. #30
    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

    provided that 'ui' is a valid member variable, that has accessible member pointer 'convertButton' that has an accessible member function 'hide()' - your code is correct.
    With correct syntax your code will compile.
    But correct systax is not enough for correct functionality.
    Why your program does not function the way you expect it is another question, which has to do with your programs design.
    But that is another story, which I suggest you leave at the moment.
    Concentrate on C++ first.
    Do some simple example programs and learn the concept.
    Just readin one chapter in the book, does not make you REALLY know object oriented programming.
    ==========================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.

  11. #31
    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

    Do you really think that all I know about C++ is how to access class member?? I know C++ quite well, but I didn't use classes in my problem, that's the reason why I didn't understand "accessing GUI elements", and it doesn't mean that I don't know C++. What is wrong in my code? I really don't know... Regards

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

    Quote Originally Posted by Salazaar View Post
    I know C++ quite well, but I didn't use classes in my problem,
    If you didn't use classes, what did you use then? Is the code of any of your programs available for download? I'd like to take a look at it.

  13. #33
    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

    I used combination of functions. No, the code isn't availible because as I said once my console programs are histroy. I'll ask you once more, why my application doesn't have functionality? Regards

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

    Quote Originally Posted by Salazaar View Post
    I used combination of functions.
    So where was C++ in that? Maybe it was C then?

    No, the code isn't availible because as I said once my console programs are histroy.
    That's a pitty... Were they some school projects or something you did for fun?

    I'll ask you once more, why my application doesn't have functionality?
    Define "functionality". Does it contain widgets? Are they connected using signals and slots? Give us more details (be warned though, we'll still be assuming you know what you're doing regarding C++ syntax and semantics).

  15. #35
    Join Date
    May 2007
    Posts
    301
    Thanks
    46
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Application crashes at launch-time

    You are being very forceful and expecting the good people on here just to fix your problem.

    You have been told to read more on C++ and I believe you should do. The best way to learn and fix your problems is by sitting down and trying to do it yourself first.

    I'm sorry to sound hard, but having read lots of your posts, it seems you are just expecting to post your code on here and expect it to be fixed for you.

  16. #36
    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

    I'll ask you once more, why my application doesn't have functionality?
    We don't even know what functionality you are talking about.
    Do you know how to use signals and slots?
    ==========================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.

  17. #37
    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
    We don't even know what functionality you are talking about.
    Objects on which I was doing:
    Qt Code:
    1. ui.element->hide();
    To copy to clipboard, switch view to plain text mode 
    doesn't work, nextStepButton does nothing and so on. Maybe It'll b e better if you can see my code. I'll attach dialog.cpp

    Quote Originally Posted by high_flyer View Post
    Do you know how to use signals and slots?
    Your kidding me? Of course, I know.
    edit:
    The problem isn't that I don't know how to connect signals to slots, I have functions which do something, connected to something and all should work, but it doesn't. Look at my file
    Attached Files Attached Files
    Last edited by Salazaar; 13th June 2007 at 20:06.

  18. #38
    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

    well, settingUp() is a bunch of if() clauses.
    Probably none of them gets to be true, so nothing happens.
    Put a debug statement in and see if its being printed:
    Qt Code:
    1. bool Dialog::settingUp()
    2. {
    3. qDebug()<<"Dialog::settingUp()";
    4. //the rest of your code.
    5. }
    To copy to clipboard, switch view to plain text mode 

    In addition make sure you get no signal/slot warnings when you execute the application.
    ==========================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.

  19. #39
    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
    well, settingUp() is a bunch of if() clauses.
    Probably none of them gets to be true, so nothing happens.
    None?? If I, let's say' check checkbox in one group, and second in second grop and if nextStep Button is clicked one if() clause sure returns true and all instructions in if() should be done. But even if is a problem (which I think it isn't a problem) some widgets should be hidden, and we can type any value (even string) to lineEdit, although I have a validator.

    Quote Originally Posted by high_flyer View Post
    In addition make sure you get no signal/slot warnings when you execute the application.
    No, I don't have any signal/slots warning when executing application.
    Last edited by Salazaar; 14th June 2007 at 12:13.

  20. #40
    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

    did you try the code I gave you in the last post?
    ==========================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.

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.