Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [Request] [IDE Configuration] QT Config to go onto the Main Site  (Read 1263 times)

0 Members and 1 Guest are viewing this topic.

JamesYeoman

  • Newbie
  • *
  • Posts: 17
    • View Profile
[Request] [IDE Configuration] QT Config to go onto the Main Site
« on: February 18, 2018, 09:14:22 pm »
After spending a day working through and trying (and eventually succeeding) to get QT to work with SFML, I wouldn't wish the frustration I have had today upon anyone. Hence, I wish to provide the configuration steps for QT so that it can be put onto a page on the main SFML website alongside the configuration for MinGW and MSVC.

Here goes



  • Download the Source for the SFML version you intend to use and extract it to a folder
    • Open QT Creator
    • Go to: Tools->Options->Build & Run->CMake and make sure that CMake has been either Autodetected or manually set
  • Go to the Welcome tab and click the "Open Project..." button
  • Look for the CMakelists.txt file in the SFML source folder
  • Click on the Projects icon on the left hand side of the IDE. Choose Build Settings from the Build And Run menu. Scroll down to and expand the Build Environment roll-out in order to look for the PATH variable. Make sure that the following exists in the Path variable: C:\QtSDK\mingw\bin;C:\qtsdk\qt\bin;
  • Set the CMake parameters that you need (for me, BUILD_SHARED_LIBS=False and SFML_USE_STATIC_STD_LIBS=True) and click Apply Configuration Changes (Make sure to set the Build Directory to something like "<SFML_Source_Root>..\SFML-Build\<Build_Configuration>" to make the Project Configuration later easier)
  • Click the Hammer in the bottom-left corner to build the current Build Configuration (Do this for both Debug and Release)
  • Go to File->New File Or Project->Non-Qt Project->Plain C++ Application->Choose
  • Click Choose. Name your project. The rest of the Project Setup can be left as the default
  • Open the Project's .pro file and replace the contents with the following (Variables have been used so you only need to replace 2 paths with your paths)
    (click to show/hide)

Replace the contents of main.cpp with the following

#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
    sf::CircleShape shape(100.f);
    shape.setFillColor(sf::Color::Green);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear();
        window.draw(shape);
        window.display();
    }

    return 0;
}
 

And compile.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: [Request] [IDE Configuration] QT Config to go onto the Main Site
« Reply #1 on: February 18, 2018, 09:48:35 pm »
Great that you figured it out! I think this explanation would be much better published on the community wiki alongside similar topics.

For the website we'd need a French translation, a proper formatting, more in-depth point plus screenshots and the guarantee that you're going to maintain it as long as possible (at least multiple years). If you can bring all this to the table, then feel free to provide a pull request on our website repository. :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

JamesYeoman

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: [Request] [IDE Configuration] QT Config to go onto the Main Site
« Reply #2 on: February 18, 2018, 10:20:12 pm »
Great that you figured it out! I think this explanation would be much better published on the community wiki alongside similar topics.

For the website we'd need a French translation, a proper formatting, more in-depth point plus screenshots and the guarantee that you're going to maintain it as long as possible (at least multiple years). If you can bring all this to the table, then feel free to provide a pull request on our website repository. :)

You will be pleased to know that the Windows section of Compile And Link SFML With Qt Creator now has my findings on there.

 

anything