Re: [Interest] download a file form http
Am 07.07.12 10:32, schrieb Sivan Greenberg: On Fri, Jul 6, 2012 at 5:44 PM, Till Oliver Knoll till.oliver.kn...@gmail.com wrote: Sivan, it seems to me that you're stumbling over the most basic steps ... So, as stated before, I somewhat believed that Qt can be used even when when you just know parts of it and do not master all of its mechanics and internals . That's true: me for my part never touched the database modules or the QML modules, nor any of the mobile APIs - simply because I don't need them. However, as is the case with /any/ framework or language, you do need to understand the *basics* (or the design philosophy) behind such a tool. I'd say for Qt that certainly is the Qt Object Model (how memory is managed by the parent-child paradigm), Signal and Slots (callbacks) and to some extend the Qt Meta Information System (for more advanced topics such as properties and type-tests). That's not rocket science, a day or two with the excellent (!) Qt documentation (e.g. http://qt-project.org/doc/qt-4.8/gettingstarted-develop.html) should get you started very quickly. Once you have learned and understood these concepts, the rest is simply applying your knowledge from other frameworks to this one, or basically learning what does the API offer me. I now realize that the MOC mandates this understanding. Let me just say that in your daily work with Qt you won't actually realise that the Meta Object Compiler (MOC) actually exists! Once you have understood its purpose you can almost immediatelly forget about the moc and that it does it's work almost magically - assuming that you're either using a project based on qmake (*.pro and *.pri include files), or better yet, are using Qt Creator. There are also integration tools for MS Visual Studio and Eclipse which render the moc build step almost invisible! So all you need to know in your daily work is that as soon as properties or signals/slots are involved in your class and/or you want to make use of the Qt Meta Information System, you just need to make sure that you 1. Inherit from QObject 2. Have the Q_OBJECT macro in your class declaration That's it! Honestly! It's that easy! qmake/Qt Creator/integration tools will make sure that the appropriate build steps are done automagially for you (which will create a moc_yourclass.cpp file and compile/link that with your project) and you can forget about them! QML and the Qt creator made me think I could actually drop that file download snippet as is and use as I do in Perl, C, Python- I now realize this is an unreal expectation. I urge you to give Qt a second try ;) Especially since you mentioned C you will quickly learn that Qt offers you so much more power of abstration. [Lots of different projects and experience] Given that, I mistakenly thought I could apply this over 12 years of knowledge (including the creation of a soft float toolchain and debian based OS for MIPSel from scratch) when implementing this very simple file download. I was wrong and I apologize for the noise. To be honest I am a bit surprised that you didn't succeed in building a simple file downloader in Qt, given all your experience! But I'd attribute that to you having wrong expectations of what the Qt framework is. I am just saying that because you made the impression to me that you're expecting a given toolkit to quickly make you a wizard - when you're not. Do you imply that in order to achieve what should otherwise be a dead simple task [...] I must become a wizard first? Then I'm really on the wrong mailing list...:/ I said that to me you appeared to *expect* that a given toolkit *makes you* a wizard - concluding that you have to *be* a wizard in the first place would be wrong and that was by no means my intent to make such an impression. Yes, you have to have experience in C++. And yes, you have to understand some design principles such as MVC. Plus more experience in design patterns is a plus if you want to understand why Qt implemented a given thing in some way (but really just a plus - you can always simply accept the fact how the API solves things for you and don't necessarily need to understand the design principle behind it). And having experience in another (GUI) framework certainly helps. But given all that you will quickly realise how much *easier* Qt actually makes it for you to solve things quickly! So you've asked how to download a file in a single line (or so I remember). I'll give you a few more: QNetworkAccessManager *manager = new QNetworkAccessManager(this); ... Right, so attaching QFile to that did not come to mind. Qt provides you with the *building blocks* to achieve your goals, not necessarily with ready-made custom solutions for a concrete scenario. I agree that downloading from an URL into a file might be a very common scenario, but some Qt applications might want to have greater control about that process, or prefer not to store
Re: [Interest] download a file form http
On Fri, Jul 6, 2012 at 5:44 PM, Till Oliver Knoll till.oliver.kn...@gmail.com wrote: Sivan, it seems to me that you're stumbling over the most basic steps in developing a Qt application, all of which could've been resolved by reading the docs and spending a fine day or so with the tutorials. So, as stated before, I somewhat believed that Qt can be used even when when you just know parts of it and do not master all of its mechanics and internals . I now realize that the MOC mandates this understanding. QML and the Qt creator made me think I could actually drop that file download snippet as is and use as I do in Perl, C, Python- I now realize this is an unreal expectation. And it takes off course a decent education in programming, plus if you bring along experience in other frameworks you should be able to apply that knowledge to Qt in no time! I have been programming since I was about 6 yo, going from Basic to assembly to Pascal to C/GTK then even C++ for around 2 years, and since 2004 I have been developing both professionally and as a hobby in Python. I think I have decent education in programming (how would that be defined anyways?) and I know my way quite thoroughly in the realms of object oriented methodology and design and the processes around it. Given that, I mistakenly thought I could apply this over 12 years of knowledge (including the creation of a soft float toolchain and debian based OS for MIPSel from scratch) when implementing this very simple file download. I was wrong and I apologize for the noise. I am just saying that because you made the impression to me that you're expecting a given toolkit to quickly make you a wizard - when you're not. Do you imply that in order to achieve what should otherwise be a dead simple task (again, I want to concentrate on the business logic and not have to care of the HTTP RFC) using Qt I must become a wizard first? Then I'm really on the wrong mailing list...:/ So you've asked how to download a file in a single line (or so I remember). I'll give you a few more: QNetworkAccessManager *manager = new QNetworkAccessManager(this); connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*))); manager-get(QNetworkRequest(QUrl(http://qt.nokia.com;))); And yes, that's taken straight from the Qt docs! I am aware of those docs, in fact I used them here: http://projects.developer.nokia.com/qactus/browser/Qactus/mainwindow.cpp Off courses it doesn't deal with error conditions, aborting/resuming/pausing a download, handle the received data (hint: QFile! Just in case...)... Right, so attaching QFile to that did not come to mind. More over, asking around more than several times some expert qt wizards did not yield one coherent answer showing this could be assisted by an stdlib function to handle. I'll see about connecting this with QFile, thanks for the tip. So if you're unfamiliar with Qt signals/slots (and it seems very likely, given your questions about moc/qmake), there's a chapter about that as well. And while you're at it, read the chapter about qmake as well. The Qt Object Model won't hurt either. I'll set to become a qmake expert before I attempt any further Qt development, but I am quite familiar with signal and slots as the previous code link would prove. After that, if you have conceptional questions or still stumble over a particular problem, you're welcome to ask. I kind of feel myself welcome to ask anyways :) At least we have a nice community to compensate of confusing docs and API incompleteness ;) But don't try to convince people that rapid prototyping was the way to go and every toolkit should start implementing doWhatIMean(iHaveNoClueWhatsoever) methods. Because for me that had a taste of I don't want/am unable to learn! Take a look at what I've done over the years so far in open source (debian / ubuntu / gnome included) . I assure you I have more clue than most of the people you'd meet randomly in an conference. It is really not about doing what I want when I do not have a clue but having API completeness. Network stack is severely low leveled and limited in Qt and I have some Nokia experts vouching for that that I won't disclose their names :) That being said, I will not expect Qt to be my compiled Python anymore. Thanks for your reply! -Sivan ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] download a file form http
Am 05.07.2012 um 10:03 schrieb Sivan Greenberg si...@omniqueue.com: Thanks for all of the replies, how do I then make the MOC step happen before everything else in Qt creator or by plainly using qmake? Sivan, it seems to me that you're stumbling over the most basic steps in developing a Qt application, all of which could've been resolved by reading the docs and spending a fine day or so with the tutorials. And it takes off course a decent education in programming, plus if you bring along experience in other frameworks you should be able to apply that knowledge to Qt in no time! I am just saying that because you made the impression to me that you're expecting a given toolkit to quickly make you a wizard - when you're not. So you've asked how to download a file in a single line (or so I remember). I'll give you a few more: QNetworkAccessManager *manager = new QNetworkAccessManager(this); connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*))); manager-get(QNetworkRequest(QUrl(http://qt.nokia.com;))); And yes, that's taken straight from the Qt docs! Off courses it doesn't deal with error conditions, aborting/resuming/pausing a download, handle the received data (hint: QFile! Just in case...)... So if you're unfamiliar with Qt signals/slots (and it seems very likely, given your questions about moc/qmake), there's a chapter about that as well. And while you're at it, read the chapter about qmake as well. The Qt Object Model won't hurt either. After that, if you have conceptional questions or still stumble over a particular problem, you're welcome to ask. But don't try to convince people that rapid prototyping was the way to go and every toolkit should start implementing doWhatIMean(iHaveNoClueWhatsoever) methods. Because for me that had a taste of I don't want/am unable to learn! Best of luck! Oliver p.s. Sorry for the HTML formatting, my current device doesn't let me otherwise... :/ ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] download a file form http
QtSDK/Examples/4.7/network/download On 07/05/2012 08:54 AM, Sivan Greenberg wrote: Hello, I'm trying to use this: http://doc.qt.nokia.com/4.7-snapshot/network-download-main-cpp.html As a base point for downloading files over the network (surprisingly, there's no such support in built to Qt) I merely found this piece of html file. Could someone show me to the whole example? or otherwise, even better , provide a snippet that'd do that without strange things like include moc.h at the end of the file? :) THanks! ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] download a file form http
Sent: Thursday, 5 July 2012 4:54 PM Hello, I'm trying to use this: http://doc.qt.nokia.com/4.7-snapshot/network-download-main-cpp.html As a base point for downloading files over the network (surprisingly, there's no such support in built to Qt) I merely found this piece of html file. Could someone show me to the whole example? or otherwise, even better , provide a snippet that'd do that without strange things like include moc.h at the end of the file? :) THanks! -Sivan Including the moc output in the cpp file is common practise, as it saves qmake generating an extra step to compile the moc separately. Of course, it relies on the moc step preceding the cpp compile in the build! Hope that helps, Tony. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] download a file form http
Thanks for all of the replies, how do I then make the MOC step happen before everything else in Qt creator or by plainly using qmake? (letting qmake do the right thing did not work). Thanks again! -Sivan On Thu, Jul 5, 2012 at 10:23 AM, Tony Rietwyk t...@rightsoft.com.au wrote: Sent: Thursday, 5 July 2012 4:54 PM Hello, I'm trying to use this: http://doc.qt.nokia.com/4.7-snapshot/network-download-main-cpp.html As a base point for downloading files over the network (surprisingly, there's no such support in built to Qt) I merely found this piece of html file. Could someone show me to the whole example? or otherwise, even better , provide a snippet that'd do that without strange things like include moc.h at the end of the file? :) THanks! -Sivan Including the moc output in the cpp file is common practise, as it saves qmake generating an extra step to compile the moc separately. Of course, it relies on the moc step preceding the cpp compile in the build! Hope that helps, Tony. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest -- -Sivan ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] download a file form http
Sent: Thursday, 5 July 2012 6:03 PM Thanks for all of the replies, how do I then make the MOC step happen before everything else in Qt creator or by plainly using qmake? (letting qmake do the right thing did not work). Thanks again! -Sivan It depends on your tool-chain, and how you created the build scripts. I use hand-edited .pro (and .pri) files, and run qmake to generate Visual Studio and Xcode project files. There is an option for qmake to create a .pro file, but I've never used it. Tony. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest