Handling drag’n’drop of files in Qt under OS X

If you ever tried to handle drag’n’drop files in your Qt application, you would usually come up with the code like the following.
First of all you will need a Drop Area somewhere in your application, which will handle drops

DropArea {
  anchors.fill: parent
  onDropped: {
    if (drop.hasUrls) {
      var filesCount = yourCppModel.dropFiles(drop.urls)
      console.log(filesCount + ' files added via drag&drop')
    }
 }
}

Where yourCppModel is a model exposed to Qml in main.cpp or wherever like this:

QQmlContext *rootContext = engine.rootContext();
rootContext->setContextProperty("yourCppModel", &myCppModel);

and int dropFiles(const QList<QUrl> &urls) is just an ordinary method exposed to QML via Q_INVOKABLE attribute.

You will sure notice everything works fine unless you’re working under OS X. In OS X instead of QUrls to local files you will get something like this: file:///.file/id=6571367.2773272/. There’s a bug in Qt for that and it even looks closed, but it still doesn’t work for me that’s why I’ve implemented my own helper using mixing of Objective-C and Qt-C++ code.

Continue reading Handling drag’n’drop of files in Qt under OS X

How to keyword and upload photos/illustrations to microstocks

If you’re a photographer new to microstock photography, I highly reccomend you to embark this wonderful way of passive earning using your artworks. But I will suppose that you know what is this about and how basically use it. I would even suppose you’ve passed an exam on some stock agency and uploaded your first artworks. But did you know there’re plenty of stocks? And did you know it’s better to work with all major players of this industry? Shutterstock, iStock, Fotolia, Depositphotos to name just a few. And there is a lot more.

Keywording and uploading your photos to stocks can be fairly considered as the most boring part of this business. It’s quite a long way to upload your files to 10 different websites, keyword them and submit. For such a purpose I’m working on a keywording and uploading tool, called Xpiks. It’s main objective is to help you to dramatically reduce time you spend on keywording and uploading and enable you to upload to more stocks simultaneously. For that reason I added features like parallel editing of several files, keywords suggestion, spell checking, automatic FTP uploading, stock requirements checking and others.

You can see screenshots or read more on how to use it on the official website.

This program is open source and free and available through all major platforms: OS X, Windows and Linux. There’s a support section and you’re welcome to file your bug or post a question there.

Don’t waste more time than needed, download Xpiks and enjoy!