Results 1 to 13 of 13

Thread: Creating a TcpServer listener class for MainWindow to use

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Creating a TcpServer listener class for MainWindow to use

    Quote Originally Posted by TheVirus View Post
    I got it working somehow,
    Guessing and just pushing buttons until it "works somehow" is not a recipe for a reliable result.

    In my other program (C), I used 'extern' to share the struct between files, let's hope Qt acts the same.
    Qt is not a programming language. Why do you believe that using a library of routines, like Qt, is going to change the fundamental behaviour of the programming language (C/C++)?

  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: Creating a TcpServer listener class for MainWindow to use

    Not that using a public global variable for sharing data is a good concept...
    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
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Creating a TcpServer listener class for MainWindow to use

    Quote Originally Posted by wysota View Post
    Not that using a public global variable for sharing data is a good concept...
    Indeed not, and even worse if you are talking about multiple threads accessing said global structure.

  4. #4
    Join Date
    Apr 2011
    Posts
    11
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Creating a TcpServer listener class for MainWindow to use

    Quote Originally Posted by ChrisW67 View Post
    Guessing and just pushing buttons until it "works somehow" is not a recipe for a reliable result.


    Qt is not a programming language. Why do you believe that using a library of routines, like Qt, is going to change the fundamental behaviour of the programming language (C/C++)?
    I was reorganizing the .h files and removed some #includes and it worked after that. I think it was due to either a conflict or ordering of the includes.

    I'm not hoping that Qt will change the way C++ works, I'm just unfamiliar with it. It's been years since I've done C++ programming and even when I was, I hardly used anything this advanced (never got into sockets, never got into data sharing). I don't claim to be a great programmer, in fact, I think I'm pretty basic, but I do have motivation and a willingness to learn. The way I learn is by doing. I can't read a book and then go work on some simple programs, because I'll get bored and not bother with it. I learn by giving myself a task and doing what it takes to complete it. Once it's completed, I then work on making it better and more efficient and try to use the more advanced features of the language than hacking something together as a band-aid.

    Quote Originally Posted by wysota View Post
    Not that using a public global variable for sharing data is a good concept...
    I'm just trying to follow what already works in a different method. I know I have a lot to learn of C++/Qt and I know that doing things just to get them to work is a poor excuse for bad coding practices and also leads to bad habits and a lack of learning, but it's what I'm used to and I'm trying to overcome it. Old habits die hard, and all that jazz. I thank you guys for your help and wouldn't have been able to get this far without this forum and IRC channel having me look at things in a different light.

    Quote Originally Posted by ChrisW67 View Post
    Indeed not, and even worse if you are talking about multiple threads accessing said global structure.
    Yeah, that's one challenge that I was putting off and was going to be "I'll cross that bridge when I get to it." but I realize that it would probably involve a rewrite of everything done up to that point. I know I need to do things right from the beginning and I know that the project I am undertaking is probably not one for a beginner, especially one with rusty C++ skills and no Qt knowledge. I've rarely used libraries in the past and did things in a really, really poor manner, but I always managed to get things done (college classes). I'm purely self-taught and if something worked then I'd never question it. I've never developed anything for use outside of my own personal needs or for anything major.

    I realize my bad habits and poor style is causing more work for the people I'm asking for help and also realize that it will, potentially, lead to unanswered questions or the standard 'RTFM'. I may be new here but I can already tell this is a community that is about sharing knowledge and attention to detail. I plan on reading the documentation some more and start an outline of what I want to do and any roadblocks I'll run into. I'm not a coding perfectionist, as you can probably tell, but I do have an unquenchable thirst for knowledge. I must know why things work and how they work. I also hate it when people think poorly of me, even if it is over an anonymous forum.

    I hope I can fix my issues and make the community proud.

    <end of Mea Culpa>

Similar Threads

  1. Replies: 3
    Last Post: 12th April 2011, 10:58
  2. Replies: 4
    Last Post: 17th January 2011, 14:05
  3. Replies: 2
    Last Post: 21st April 2010, 08:07
  4. Problem with Listener and QPixmap
    By thiagotrss in forum Qt Programming
    Replies: 2
    Last Post: 13th October 2009, 18:24
  5. Phone call listener
    By raulftang in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 25th April 2007, 19:09

Tags for this Thread

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.