Some Advice Ubuntu



  • I'm looking to make a few simple programs for Ubuntu, they will just be used by myself and given free to anyone who wants them.

    They won't be require a great deal of speed/power.

    The main functionality is simply opening, writing text files and sending emails.

    Qt seems to have a lot of options...

    I know JavaScript well, I've done c#.

    I did C++ for a few months but found it too difficult and gave up, so would sooner avoid C++ although I did look at C++ with QT examples and it does look far easier.

    I'm really looking for where should I be looking to start based on what I know? can a QT program be written in just javascript that gives then functionality I need? and where can I start learning how to do that?

    I also noticed the HTML5 option, if I use this where can I find the functions I need for sending email and opening/writing text files?


  • Moderators

    File operations and sending emails is best handled by the C++ part. HTML5 and QML (the new UI framework) is focused on the GUI. I'm not saying it can't be done in JS, though.

    As usual, I recommend 2 books: the old-but-great "link":https://qt-project.org/books/view/c_gui_programming_with_qt_4_2nd_edition_the_official_c_qt_book and a new one "link":http://qmlbook.org/. Also, Qt documentation is superb, so I advise to take a look into it. Don't be afraid of the C++ in Qt, it is made much easier by various enhancements that Qt brings with itself.



  • Hi,

    While I understand C++ would be far faster and better, I'm really just trying to make a few simple applications for my own use because they don't exist on Ubuntu so I have to switch to windows.

    I would really sooner have a worse version made with JavaScript, than a good version made in C++ that times me time to learn.

    It really doesn't matter if the application is less efficient.

    Does anyone know of examples using JavaScript as the logic etc rarther than C++


  • Moderators

    Check out the SameGame example: it does everything in JS, or at least it used to.



  • Thanks, that helps a lot, but what would I write in javascript to for example write to a file?


  • Moderators

    I do not know, my knowledge about JS is very limited. You sounded like JavaScript was what you wanted, so I thought you have the know-how there ;-)

    Qt and QML definitely add PersistentStorage that can be used from JavaScript. But I am certain that JS itself also has some file-saving capabilities.



  • JavaScript doesn't have file saving, has to send to server for server to write files.


  • Moderators

    Hi,

    JavaScript was designed for web scripting, so it doesn't have built-in file storage support.

    You might be able to import "Node.js":http://nodejs.org/docs/latest/api/fs.html to do this, but I've never tried it with QML. Give it a shot, and let us know how you go :)

    Anyway, to write to a text file in C++:

    @
    QFile myFile("/home/Jackiechann/Desktop/a_little_file.txt");
    myFile.open(QFile::WriteOnly | QFile::Text);
    myFile.write("Hello world!");
    myFile.close();
    @



  • You are right that is very easy, maybe I could use C++ with Qt when I tried to learn C++ all the memory stuff was just too hard.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.