Results 1 to 8 of 8

Thread: how do can I use my C++ code in qt and can it be translated into QT code

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: how do can I use my C++ code in qt and can it be translated into QT code

    Qt is a library not a language. Qt is written in C++ and designed to be used from C++ programs (although there are bindings for Python). All you require is a knowledge of C++ to learn how to use the Qt library. There are plenty of tutorials, examples and demos in the Qt documentation. That documentation is installed with the Qt library: run "assistant" or look at the Help in Qt Creator (if you have that).

    Your program is not designed for a GUI, whether it is Qt or any other kind, so you will need to think about how your GUI program should work.

    (I also suspect your program does not do what you expect)

  2. #2
    Join Date
    Sep 2012
    Posts
    4
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: how do can I use my C++ code in qt and can it be translated into QT code

    thanks for the reply
    Qt Code:
    1. (I also suspect your program does not do what you expect)
    To copy to clipboard, switch view to plain text mode 
    My program works perfectly

    Qt Code:
    1. Your program is not designed for a GUI, whether it is Qt or any other kind, so you will need to think about how your GUI program should work.
    To copy to clipboard, switch view to plain text mode 

    what I want it to do as far as it working with the GUI is I want the DNA sequence typed in a text field and then press a button and the RNA complement to print out in a second text field.

    How should my program be set up?

  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: how do can I use my C++ code in qt and can it be translated into QT code

    With two QLineEdits (or a QLineEdit and a QLabel) and a QPushButton. You will need to put them into a parent QWidget with a layout. The QPushButton::clicked() signal can be used to trigger a slot that does your DNA->RNA translation on the text of the input widget and places the result into the result widget. You can use a QValidator to ensure only the character TAGC are accepted and upper case is forced. You use QString instead of your fixed C-style char arrays.

    Take a look at the Line Edits Example and the Address Book tutorial.


    Your current code assumes that DNA and RNA have been zeroed. This is not a safe assumption: the array contents are undefined. Here is what the array contents were immediately after declaring the arrays:
    Qt Code:
    1. DNA d8 20 60 00 00 00 00 00 24 23 60 00 00 00 00 00 a0 0e 40 00 00 00 00 00 44 a6 4b 06 c8 7f 00 00 00 00 00 00 00 00 00 00 f0 f7 20 51 ff 7f 00 00 c0 1d
    2. RNA 00 a3 01 07 c8 7f 00 00 00 00 00 00 00 00 00 00 f0 f7 20 51 ff 7f 00 00 c0 1d 60 00 00 00 00 00 01 00 00 00 00 00 00 00 c5 b0 04 07 c8 7f 00 00 a0 0e
    To copy to clipboard, switch view to plain text mode 
    Reading in from the file will put a zero terminator after the input data. However, since you do not limit yourself to the valid characters in the input string, or zero-terminate the RNA string after you build it you sometimes get rubbish characters in the output. Never mind, using either std::string or QString will make this problem go away.

  4. #4
    Join Date
    Sep 2012
    Posts
    4
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: how do can I use my C++ code in qt and can it be translated into QT code

    Thanks Chris & Stereo
    I'm going through the learn QT documentation and I'm really like WOW you can do alot with QT, more than I expected. the QT quick is awesome to it looks like you can design with QML and program with QT C++

    Thanks for the help you guys are really inspiring me right now!!!!

    Chris it looks like you turned the transcription portion of my code into the translation portion howd you do that???

  5. #5
    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: how do can I use my C++ code in qt and can it be translated into QT code

    Chris it looks like you turned the transcription portion of my code into the translation portion howd you do that???
    By having an MSc is astronomy, not genetics, I free myself from the need to understand that transcription and translation have specific meaning in genetics. I meant translation in the computing sense of T translates (or maps) to A, G to C etc. I was not proposing determine the entire gene expression and protein folding result for a given DNA sequence

Similar Threads

  1. how to use C code in qt?
    By shakthi in forum Qt Programming
    Replies: 5
    Last Post: 24th July 2011, 17:46
  2. need help in qt code
    By doforumda in forum Qt Programming
    Replies: 5
    Last Post: 27th August 2010, 13:27
  3. GUI Code
    By waynew in forum Newbie
    Replies: 2
    Last Post: 12th October 2009, 12:12
  4. Pasting code from code tag in emacs
    By Gopala Krishna in forum General Discussion
    Replies: 0
    Last Post: 16th February 2007, 05:47
  5. Need help with C++ code!
    By therealjag in forum Qt Programming
    Replies: 4
    Last Post: 20th March 2006, 21:37

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.