Results 1 to 20 of 24

Thread: Question on QLineEdit Style

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Question on QLineEdit Style

    Quote Originally Posted by d_stranz View Post
    Yes, point taken. I thought about that as well - a good number of the posts here are programming errors that are essentially equivalent to that example - allocate something on the stack, pass it to another QObject as a child or parent by dereferencing it, then it goes out of scope, and either it goes BOOM! or nothing happens as expected.
    Just let's be clear again -- the code I posted is correct. For instance:

    Qt Code:
    1. QDialog loginDialog(&mw);
    2. if(loginDialog.exec()) {
    3. // ...
    4. }
    To copy to clipboard, switch view to plain text mode 

    or more explicitly to avoid problems with broken compilers:
    Qt Code:
    1. {
    2. QDialog loginDialog(&mw);
    3. if(loginDialog.exec()) ...
    4. }
    To copy to clipboard, switch view to plain text mode 



    Then they haven't discovered boost::shared_ptr<> yet.
    Unfortunately using smart pointers is not possible in every situation. I personally don't have any issues with memory management in C++ (even without using smart pointers).

    I'm not sure that LGPL has all that much to do with it.
    It's easy to explain. In the "pre-LGPL" era of Qt, you had to either pay for Qt (which was quite expensive, especially for people living in developing countries) or make your program open source (when using the GPL variant of the licence). Either way Qt was usually not the first choice for people wanting to write their first program but were rather used by companies and programming enthusiasts with a decent knowledge of C++. When LGPL came, Qt became accessible for virtually anyone in the world to use for pretty much anything. This caused a flood of would-be programmers from China and India as well as other Middle East countries. You can see that most of issues brought up here or on other forums related to Qt has nothing to do with Qt but rather with compilers, operating systems, low-level system API and of course C++.
    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.


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

    Default Re: Question on QLineEdit Style

    @d_stranz
    All is well and good - however, my point from the start didn't change, nor anything you say will change its validity:
    The decision of allocating an object on the stack or heap does not depend on its type - which is what you rule essentially says.
    Even if you found the rule helpful, it doesn't make it correct - and if you are a beginner reading your post, and you get used to that way of thinking, you will have hard time understanding why all of the sudden your application crashed, due to the fact you allocated something on the stack and not on the heap due to your rules, which lets say - due to scope issued was nonsense.
    And having hard time to understand what the problem is was basically what you set to avoid from the start.
    Making your life easier by using a principally wrong rule just shifts your problem to another time and complexity domain.
    I too am not programming since yesterday, and I found out, that it pays more to start slow hard and correct, then fast easy and incorrect.
    ==========================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. Empty style sheet changes QLineEdit
    By mpi in forum Qt Programming
    Replies: 3
    Last Post: 15th June 2009, 20:13
  2. Replies: 5
    Last Post: 8th June 2009, 22:16
  3. QLineEdit question
    By MarkoSan in forum Qt Programming
    Replies: 4
    Last Post: 29th June 2008, 09:58
  4. question about the mac style
    By billconan in forum Newbie
    Replies: 3
    Last Post: 31st August 2006, 11:40
  5. pen style question
    By impeteperry in forum Qt Programming
    Replies: 4
    Last Post: 21st July 2006, 20:49

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.