These are alternative steps using a windows system and mingw which comes with Qt. For this example, I installed the Qt SDK to C:\QtSDK
. For these instructions, I used Qt 4.8.1.
- Download the tar.gz from http://qt.gitorious.org/qt-components/desktop/trees/master
- Unpack the components
- Add Qt's Desktop mingw bin path and Qt's mingw bin path to the PATH system variable with one of the two options:
- Option 1: (persistent) Using the control panel. (http://www.computerhope.com/issues/ch000549.htm)
- Navigate to "Control Panel" -> "System" -> "Advanced system settings"
- Select the "Advanced" tab
- Press the "Environment Variables..." button, located below the third groupbox and above the OK/Cancel button
- Under the "System variables" groupbox, scroll through the list and find the "Path" variable
- Double click or select the "Path" variable and press "Edit..."
- Go to the right-most end of the "Variable value:" field by either clicking within the field and pressing END on your keyboard or scrolling to the end with your mouse.
- Add a semicolon
;
then the path to Qt's mingw bin directory, in this case it is C:\QtSDK\mingw\bin
- Add another semicolon to the end and then Qt's Desktop mingw bin directory located in the version of Qt you are using, in this case it is 4.8.1:
;C:\QtSDK\Desktop\Qt\4.8.1\mingw\bin
- In the end, the addition to the path variable should look like this:
;C:\QtSDK\mingw\bin;C:\QtSDK\Desktop\Qt\4.8.1\mingw\bin
. Note that these paths could also be added anywhere and whichever order within the path variable.
- Press "OK" to all opened windows to close and save your changes.
- Option 2: (temporary) Using the SET command. This method only lasts within the command prompt window it was executed. If the command prompt window is closed, the SET commands must be re-entered.
- Add Qt's Desktop mingw bin directory with
SET PATH=%PATH%;C:\QtSDK\Desktop\Qt\4.8.1\mingw\bin
- Add Qt's mingw bin directory with
SET PATH=%PATH%;C:\QtSDK\mingw\bin
- Continue the steps below with this same command prompt window. The SET commands are only set for the specific command prompt window you executed them in.
- If option 1 was used, open a new command prompt and navigate to where the qt desktop components are extracted. If option 2 was used, use the same command prompt to navigate to the qt desktop components folder
- Run the following command:
qmake && mingw-make install
- This command will automatically copy the compiled component files to
C:\QtSDK\Desktop\Qt\4.8.1\mingw\imports\QtDesktop
so there is no need to manually move or create any folders.
- Make a new Qt Desktop project, and select the mingw which matches the Qt version as the toolchain.
Attempt to compile and run the following code:
import QtQuick 1.1
import QtDesktop 0.1
Rectangle {
width: 100
height: 100
Button {
id: button
text: "Push me"
onClicked: button.text = "Pressed"
}
}
- Done
At the time of these instructions, the latest version of the QtDesktop components is 0.1. To check the version you installed, navigate to C:\QtSDK\Desktop\Qt\4.8.1\mingw\imports\QtDesktop
and open the file qmldir
with a text editor and notice the version number on each line.