How can I use Linguist in Qt without .pro file? - c++

I'm trying to translate my language to another arbitary language.
but in my case, i generated project by using vs2013->Qt5 project->Qt Application.
so i don't have ".pro" file or qmake.exe file.
but when i search about the method to use linguist tool, all of them says i have to use .pro file.
Is there any ways to use qt linguist tool without .pro file?
(I tried to make it by using exe file in QT 5.7.0, but it has failed to complie. )
if it is impossible, how can i create ".pro" file in current project?
please share your ideas!

A Qt project file is not necessary. You can load your .ts files into Linguist, either from the File/Open menu item or as command-line arguments.
You'll want to run lupdate first, to generate initial TS files. It's normally sufficient to pass your source directory as argument:
lupdate -recursive '.' -ts MyApp_en_US.ts
That will generate an empty translations file for US English which can now be edited in Linguist.
You can generate the QM compiled translations interactively from Linguist's menu; I prefer to produce it as part of my projects' build with a simple Make rule that invokes qrelease.

Related

Can a project created with qmake be compiled without using qmake?

I have some source code that was built with qmake. Compiling it is supposed to be done with qmake qmakefile.pro.
I'd like to compile it without using qmake. Is that even possible? What would the steps be?
Edit: Here's the .pro file.
Yes, you can compile files without qmake.
You need to get any specific compiler settings from qmake and convert them to the other compiler as necessary.
Or you can convert the contents of the qmake.pro file into a makefile or your IDE's project settings.
If the qmake.pro is not a human readable text file, you will have to launch qmake and retrieve the settings. Otherwise search for a conversion tool.
While it is technically possible to translate the .pro file into something else, I would not advise it.
Why?
QMake does a lot of work behind the scenes.
In the case of the .pro file you referenced (http://pastebin.com/viv204Fv), QMake is invoking meta-tools (uic, moc) to create the code for the UI and adding build rules to compile it. You will need to manually code those in your build script.
-. QMake also solves issues of choosing the right compiler and linker options (including the right include files). You will need to determine them yourself and add them to your build script.
The project is already using Qt, so why not use Qt's build script generating tool, QMake? If you have installed a Qt development environment, you should already have qmake installed.

QMediaPlayer, QSound class - unable to #Include files (files are there)

I have been trying to play a simple audio file using:
http://qt-project.org/doc/qt-5/qmediaplayer.html and
http://qt-project.org/doc/qt-5/QSound.html
I am using Qt 5.3 but the problem is, when I type #include QMediaPlayer or QSound, QtCreator keeps underlining them with red because it can't find them. The thing is, the files are there. They are located in QtMultimedia/ and I have seen them. When I try to prefix QtMultimedia/QMediaPlayer or QtMultimedia/qmediaplayer.h it still can't find them.
If I type #include "QtMultimedia/" the auto-complete drop down in the text editor only shows QtMultimedia/QtMultimediaDepends. Normally you get a list of all the files in the folder but not with this one.
Looks like there is something wrong with the paths. How do I fix them? I am using a Windows machine.
Edit: I have included project settings - see screenshots.
I think, after you modified your .pro file, You didn't run the qmake.
build-> run qmake
qmake will generate the makefile you need to build the src code.
if you only change the .pro file, but didn't run it. Nothing is changed.
and that is reason, you create a new project and it is working.
Ok I figured it out. It's a problem with my Qt version.
My Qt 5.3 version is a custom compiled one. When I select the included version that came with the installer, QSound is found. When I change the kit to the custom compiled one, the file cannot be found. I must have forgotten to include some sort of multimedia option to the configure script during compilation.
Now the question is what is the missing option, I will need to do more reading...
Of course, comments and suggestions are welcome :)
You have to add the word 'multimedia' in your .pro file:
QT += core GUI
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets multimedia

Opening Qt c++ project

I got a c++ gui project, but I only have .exe and .dll files. Is it possible to use Qt to modify this project? I suppose I'll need to get the .cpp and .h files in order to modify the project. Am I right? Thank you.
You need source files, i.e., .cpp and .h files to modify the project. You cannot directly modify executables or DLLs using Qt.
Is it possible to use Qt to modify this project?
Qt is a GUI framework, or C++ GUI library, not an IDE or editor. You can't use Qt to modify something.
You can do the following things with any IDE or editor:
modify the project configuration file .pro to change project
settings.
modify the use interface file .ui(with Qt designer for
convenience) to change UI.
modify the source file .cpp .h to change the logic of your
program.
with only .exe and .dll, you can add source file with code
directly accessing .dll with Windows API.

Qt ui file does not compile in to C++ header

I've created a Qt Application project in Visual Studio 2010. It contains the following files
Form Files
mainwindow.ui
Header Files
mainwindow.h
Source Files
mainwindow.cpp
It also uses a generated codefile called ui_mainwindow.h. From what I've been able to discern, this file should be regenerated in response to changes made to the .ui file. However if I open the ui file in Designer and make a change, no change appears in the application.
I have to go to Form -> View Code -> Save As in Qt Designer and save the ui_mainwindow.h file manually.
.ui file should have custom build tool defined to use uic on it and produce appropriate ui_*.h file.
Custom build tool command line may look like this:
uic.exe "$(InputPath)" -o "ui_$(InputName).h"
Also, in order to properly detect dependencies and to Clean command remove generated file, add ui_$(InputName).h to Custom Build Tool Outputs.
Don't forget to make the changes for all Configurations and Platforms.
Although, the right way to do this would be to create appropriate .pro file and then generate Visual Studio project with qmake -tp vc project.pro. All compiler and linker settings should be adjusted in .pro file, not in Visual Studio project that should be regenerated after each change of .pro file.
i mean no offense but have you saved the .ui file before running the project?
when i need to edit the ui files, i change them with the designer and when i want to run it, it will recompile/moc/whatever the changed ui file and their .h/.cpp file as well.

Qt on Mac: add an existing UI file without rebuilding the whole project

I have a Qt project in XCode on Mac. I want to add an existing .UI file to it. When I do that by listing in the .pri file, the XCode project itself is rebuilt by qmake, and all my post-qmake settings are lost. Is there a way to insert a UI file without listing in the .pri? It's doable in a very straightforward way on Visual Studio...
There are two custom steps in the target - both call make over files in the project bundle (xcodeproj). The first one invokes qmake. The second invokes the Qt proprocessors - uic, moc. So the answer is - comment out or delete the first step, modify the makefile of the second one by hand. Add generated files (once they're generated at least once) to the project as necessary.