Skip to content

Qt Creator and other tools

Have a question about Qt Creator, our cross-platform IDE, or any of the other tools? Ask here!
7.6k Topics 35.5k Posts
  • Disable --COMMAND— and --INSERT— mode in QtCreator's texteditor

    Solved
    8
    1 Votes
    8 Posts
    15k Views
    D
    @alexisdm Thanks I had that issue as well.
  • How to fast move between my projects opened in Qt Creator

    Moved Unsolved
    4
    0 Votes
    4 Posts
    485 Views
    S
    @JacobNovitsky said in How to fast move between my projects opened in Qt Creator: I dont want to open all projects in one Window This part confuses me. Do you want to open App1 through App5 in a single Qt Creator (window) or not? If you open several projects inside the same session the currently active one can be selected at the bottom left (usually just used to select between release and debug builds). You can quickly get there by hitting Ctrl+T (using arrow keys to select what you actually want). The downside is that the files from all projects are open and it can get messy quite quickly (especially if the different projects are not related to one another). Otherwise you need to create sessions. Each session will have open projects assigned (most likely just a single project in your case) and currently open files. You can switch session through the menu File->Sessions->(Pick a session). I don't know any real shortcut for that, but you can use Alt+F to open the file menu and then 'e' to select the sessions submenu. The individual sessions have numbers assigned. (The documentation https://doc.qt.io/qtcreator/creator-project-managing-sessions.html says that you can use Ctrl+Alt+<Number> to quickly switch between sessions. It also mentions Ctrl+K -> t to locate sessions (I guess 't' will list all menu entries). The documentation https://doc.qt.io/qtcreator/creator-editor-locator.html further explains that you need to type "t sess <session name>" to switch to a session by name inside the locator. I guess I also learned something today 😊.)
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    15 Views
    No one has replied
  • How to change default C++ version for Creator projects

    Solved
    4
    0 Votes
    4 Posts
    2k Views
    JonBJ
    @jsulm said in How to change default C++ version for Creator projects: For example I found /usr/share/qtcreator/templates/wizards/projects/consoleapp/file.pro for QtCreator packaged by Ubuntu. OK, since that's clearly a literal .pro file and it has hard-coded CONFIG += c++11 console that is clearly the correct answer! I had thought the c++11 would be "generated" from somewhere during project creation, but looks like it was set in whenever Qt was generated/released. Ho hum. Prefer not to alter the system files, will live with having to alter it in generated .pro file. At least I know!
  • What is this... how to get rid of it ?

    Moved Unsolved
    7
    0 Votes
    7 Posts
    630 Views
    V
    @AnneRanch A walk is a very good idea.
  • Qt Creator displays Ctrl-L instead of executing

    Moved Unsolved
    13
    0 Votes
    13 Posts
    2k Views
    aha_1980A
    https://bugreports.qt.io/browse/QTCREATORBUG-30300
  • Main menu not showing on windows10

    Moved Solved
    2
    0 Votes
    2 Posts
    621 Views
    cristian-adamC
    For some reason the action is not executed when you press Ctrl+Alt+M. I was not able to reproduce this issue. See https://bugreports.qt.io/browse/QTCREATORBUG-30114 for a similar report. In the above bug report you have two solutions: As a workaround the "Show Menu Bar" Action can also be triggered via the action filter of the locator. Just open the locator via ctr+shift+k or us the 't' prefix before searching for the action. Alternatively you can edit "%appdata%\QtProject\QtCreator.ini" and remove the MenubarVisible line from the [MainWindow] section.
  • 0 Votes
    5 Posts
    502 Views
    T
    @SGaist Thank you. I re-downloaded the arm version of Qt and it worked normally.
  • No luck beautifying code

    Moved Unsolved
    2
    0 Votes
    2 Posts
    281 Views
    cristian-adamC
    I've enabled the Beautifier plugin, set the path to clang-format that comes with Qt 12.0.1 on macOS Sonoma, in my case was: /Users/cristian/Qt/Qt Creator.app/Contents/Resources/libexec/clang/bin/clang-format Set the Use predifined style: File in order to pick up the .clang-format configuration file. It worked just fine.
  • Where I could get more details and examples about API functions?

    Solved
    6
    0 Votes
    6 Posts
    659 Views
    Pl45m4P
    @Qtcpp_User said in Where I could get more details and examples about API functions?: with the same name of what? of directory or QString path like "example"? With the same name of QDir?! What else?! Btw: example is the name of the "to-be-tested" directory. It can be a full path, it can be just a directory name relative to the current directory. If I set group using beginGruop(),what I supposed to fill in 'key'? The key you want to check, maybe?! Asking those questions is the same as asking, what the ampersand in const QString &key does and why it's there... Even when there is a documentation, it's expected to have a certain level of knowledge and maybe some experience from using other frameworks / libraries. Also the context where it's used is important and might help to understand what the text means.
  • Setting up MSVC 2017 kit using Qt Creator

    Moved Unsolved
    4
    0 Votes
    4 Posts
    636 Views
    cristian-adamC
    @viniltc Qt SDK doesn't install the MSVC compiler, just the MinGW one. You can use a package manager like choco to install the compiler. Try: $ choco install visualstudio2017buildtools Afterwards then select Visual Studio Installer from Start Menu to actually install the compiler.
  • "make arguments" via qmake?

    Solved
    12
    0 Votes
    12 Posts
    12k Views
    T
    If you set the environment variable MAKEFLAGS, the Make program will pass it to any sub-make call. But nmake does no such thing, hence QMake redirects MAKEFLAGS to each of sub-nmakes, like: @set MAKEFLAGS=$(MAKEFLAGS) $(MAKE) Also, the XD framework's QMake supports SUBMAKE_FLAGS, which just appends to command line (without changing MAKEFLAGS environement-variable).
  • Clang Format and Qt Creator

    Unsolved
    6
    0 Votes
    6 Posts
    6k Views
    B
    @jsulm yes and I asked what was meant by that, because when I previously tried putting a .clang-format in my project root directory (where my top-level .pro file is), it didn't appear to have any effect. Having tried it again and set a ridiculous indent, I can now see that it does in fact appear to be using it. I think what was confusing me was that I expected to be able to see the effect previewed in the Settings dialog. At the very least, it would have been good to see some indication somewhere that Qt Creator has read my .clang-format file and is using it. (As I said, the dialog says "The current project has its own .clang-format file..." whether or not I have a .clang-format file in my "base source directory".) I maintain that the way this is presented in the Qt Creator UI is confusing. For example: In Project Setting | Code Style, if I click "Use Global Settings" and go to the Global Settings, it shows me Clang Format settings that do not correspond to my file. And yet, if I edit my code, it applies the indentation I have applied in my local .clang-format. So, in what sense am I using Global Settings here? In Project Settings | Code Style, if I don't click on the "Override .clang-format file" can I assume that the "Current settings" below is completely ignored? As I asked in my previous post, why then is this not disabled in that case? I guess if I could be sure that my .clang-format files is being read, and I could be sure that there are no interactions with any other Qt formatting mechanisms that are going to mess with my settings I would be happy.
  • How to search partial text?

    Moved Unsolved
    4
    0 Votes
    4 Posts
    339 Views
    JonBJ
    @AnneRanch It depends precisely what you mean by " test plus anything ". As @Christian-Ehrlicher said, if you really mean test plus anything, including nothing (i.e. at end of line), you might as well just search for test like that, doesn't matter whether regular expression or not. If your test* is supposed to be a regular expression, be aware that this does not search for test necessarily. It would search for tes followed by any number of ts, 0 or more. This pattern would be right if you are wanting to access a filename from a terminal/command prompt, but that is not a regular expression, as used in the Creator text editor or others. The equivalent as a regular expression would be test.*. Note the "dot"/"period", meaning any character. But then you might just as well search for plain test. If you wanted test followed by something (i.e. not at end of line), that would be test.+. That is a "plus" instead of a "star". If you stipulate exactly what you want to match/not match there are other constructs in regular expressions which may do precisely what you want (e.g. you can search for just a "word" of test, or start of a word, or a non-word, or others).
  • 0 Votes
    5 Posts
    3k Views
    S
    @Crag_Hack that is the actual answer. Thanks
  • QT Debugging fails on Windows

    Moved Solved
    17
    0 Votes
    17 Posts
    3k Views
    A
    @cristian-adam As I reported earlier, I believed the problem had to do with the code that uses sqlite3_create_function to create a sqlit3 function which means that my cpp file needs to include "sqlite3.h". Furthermore, this file needs to be the same as that used in the particular Qt version. Here is my code to do this: void distanceFunc(sqlite3_context* ctx, int argc, sqlite3_value **argv) { double Lat1, Lon1, Lat2, Lon2; Lat1 = sqlite3_value_double(argv[0]); Lon1 = sqlite3_value_double(argv[1]); Lat2 = sqlite3_value_double(argv[2]); Lon2 = sqlite3_value_double(argv[3]); // sqlite3_result_value(distance(LatLng(a1,a2),LatLng(a3,a4))); if (Lat1 == Lat2 && Lon1 == Lon2) sqlite3_result_double(ctx,0); double R = 6371; // RADIUS OF THE EARTH IN KM double dToRad = 0.0174532925; double lat1 = Lat1 * dToRad; //double lon1 = Lon1 * dToRad; double lat2 = Lat2 * dToRad; //double lon2 = Lon2 * dToRad; double dLat = dToRad * (Lat2 - Lat1); double dLon = dToRad * (Lon2 - Lon1); double a = qSin(dLat / 2) * qSin(dLat / 2) + qCos(lat1) * qCos(lat2) * qSin(dLon / 2) * qSin(dLon / 2); double c = 2 * qAtan2(qSqrt(a), qSqrt(1 - a)); double d = R * c; sqlite3_result_double(ctx,d); // distance in kilometers } bool SQL::loadSqlite3Functions(QSqlDatabase db) { QVariant v = db.driver()->handle(); sqlite3 *db_handle = NULL; if (v.isValid() && strcmp(v.typeName(), "sqlite3*") == 0) { // v.data() returns a pointer to the handle db_handle = *static_cast<sqlite3 **>(v.data()); if (!db_handle) { qCritical() <<"Cannot get a sqlite3 handler."; return false; } sqlite3_initialize(); if(sqlite3_create_function(db_handle, "distance", 4, SQLITE_ANY, 0, &distanceFunc, 0, 0)) { qCritical() << "Cannot create SQLite functions: sqlite3_create_function failed."; return false; } return true; } qCritical() << "Cannot get a sqlite3 handle to the driver."; return false; } code_text including this file, sqlite3.pri in my .pro file appears to have solved my problem as the compiled program now runs in release mode as well as debug mode! SOURCES += $$(QTDIR)/../Src/qtbase/src/3rdparty/sqlite/sqlite3.c HEADERS += $$(QTDIR)/../Src/qtbase/src/3rdparty/sqlite/sqlite3.h win32:QMAKE_POST_LINK += $$QMAKE_COPY $$shell_quote( $$(QTDIR)\\..\\Src\\qtbase\\src\\3rdparty\\sqlite\\sqlite3.h) $$shell_path($$PWD) $$escape_expand(\\n\\t) else:unix:QMAKE_POST_LINK += $$QMAKE_COPY $$shell_quote( $$(QTDIR)/../Src/qtbase/src/3rdparty/sqlite/sqlite3.h) $$shell_quote($$PWD) $$escape_expand(\\n\\t) message($$QMAKE_POST_LINK) `` Now, to insure that the MacOS version has no problem with the change.
  • How to share Qt Creator settings across team members?

    Unsolved
    4
    0 Votes
    4 Posts
    381 Views
    jsulmJ
    @Andreas-Schacherbauer I guess it can contain same settings as .user file. Don't know whether there is documentation for these settings.
  • How to silently save new files then have been sent to Qt Creator C++ Project

    Moved Unsolved
    1
    0 Votes
    1 Posts
    159 Views
    No one has replied
  • Qt Designer/Creator plugin XML access

    Unsolved
    1
    0 Votes
    1 Posts
    224 Views
    No one has replied
  • QPointerEvent throws error

    Solved
    56
    0 Votes
    56 Posts
    16k Views
    jsulmJ
    @curiosity said in QPointerEvent throws error: in which context do we use lambda for connect statements For example if you want to pass additional parameters to the slot which do not exist in the signal.