Skip to content

Qt Development

Everything development. From desktop and mobile to cloud. Games, tools, 3rd party libraries. Everything.
144.2k Topics 721.0k Posts

Subcategories


  • This is where all the desktop OS and general Qt questions belong.
    83k 456k
    83k Topics
    456k Posts
    Lab7L
    Hi I experience a problem when changing from Qt 6.9.0 to 6.9.1 I'm using QTextToSpeech class and it worked before changing to 6.9.1. Using Qt Creator 17.0.0 and Windows 11 (on Android it doesn't produce the same error) It compiles for both versions without errors, but it fails running when calling say(). Application Output shows QAudioSink::start: QAudioFormat not supported by QAudioDevice I wrote a simple demo to illustrate the problem. It works in 6.9.0, but fails for 6.9.1 #include <QCoreApplication> #include <QDebug> #include <QTimer> #include <QtTextToSpeech> int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QTextToSpeech tts; tts.say("Hello world! Anyone? Is there anyone out there?"); QTimer::singleShot(10000, &a, &QCoreApplication::quit); return a.exec(); } Any idea on how to fix this? Or is it a bug in Qt 6.9.1?
  • The forum for developing everything embedded: Linux, WinCE, Symbian, MeeGo... you name it.
    14k 62k
    14k Topics
    62k Posts
    aha_1980A
    @houyawei It may sound silly, but can you try to run the project from a shorter file path?
  • Looking for The Bling Thing(tm)? Post here!
    20k 77k
    20k Topics
    77k Posts
    G
    Hi, I am trying to customize a Menu and I am getting a weird behaviour that I do not understand... Using a plain Menu { id: root function getMenuWidth() { var result = 0; var padding = 15; for (var i = 0; i < count; ++i) { var item = itemAt(i); if (!(item instanceof MenuSeparator)) { result = Math.max(item.contentItem.implicitWidth, result); padding = Math.max(item.padding, padding); } } return Math.max(125, result + padding * 2 + 10); } Component.onCompleted: { root.width = getMenuWidth(); } } yields me this result: [image: 5f1c8e4d-6e84-447a-9fde-a042cac5cd3c.png] When trying to assign the menu-popup a different background color or radius, I thought, I could do it like that: Menu { id: root background: Rectangle { id: testRect color: "black" radius: 10 } ... } However, I get this result: [image: 6dbffb04-20bb-49eb-947d-f0a365e2981d.png] I don't understand, where those massive margins come from or how do make them smaller. Decreasing the Menu width, just decreases the width of the content, but the margins remain huge. Anyone have an idea how to solve this?
  • Have a question about Qt Creator, our cross-platform IDE, or any of the other tools? Ask here!
    8k 35k
    8k Topics
    35k Posts
    J
    Good morning everyone! I have a folder of images, and I'm looking to load one in QML based on the corresponding file name in a JSON file. Let's say I would like to load a file named 1.png. In the JSON file, I would need to add the file name {"imageFile": "1.png"} and from my handler.cpp I would need to parse the file: QJsonDocument Document = QJsonDocument::fromJson(Bytes, &SyntaxError); if (SyntaxError.error != QJsonParseError::NoError){ qDebug() << SyntaxError.errorString() << "JSON PARSE ERROR"; } if (Document.isObject()){ m_imageFilePath = QUrl::fromLocalFile(imFolderDir.path()).toString()+ "/" + Document.object().value("imageFile").toString(); This returns the full file path: "file:///C:/Users/xxx/Documents/xxx/build/Desktop_Qt_6_8_3_llvm_mingw_64_bit-Debug/xxx/images/1.png" m_imageFilePath is a variable exposed to QML, so I should be able to load it Image { source: handler.imageFilePath anchors.centerIn: parent.Center width: parent.width height: parent.height } But I receive a "Cannot open" error. I believe this is because the image file doesn't get generated in the build location of the project (when I check /build/Desktop_Qt_6_8_3_llvm_mingw_64_bit-Debug/xxxx/Images/1.png in file explorer, the file doesn't exist.) To have Qt generate the file, I can specify the location of the file in CMake RESOURCES Images/1.png Here's the problem: I would need to manually do this for every file in the folder, and if I expand the folder with more images, I would need a more-dynamic way of generating loading them. Is there a way to get the images in my debug directory to be generated in the build directory, without manually inputting the file paths in CMake? Thanks!
  • Your Qt just doesn't want to build? Your compiler can't find the libs? Here's where you find comfort and understanding. And help.
    10k 51k
    10k Topics
    51k Posts
    V
    I tried building a video player like this: example.pro: QT += core gui widgets multimedia multimediawidgets CONFIG += c++17 SOURCES += main.cpp main.cpp: #include <QApplication> #include <QWidget> #include <QPushButton> #include <QVBoxLayout> #include <QMediaPlayer> #include <QVideoWidget> #include <QUrl> int main(int argc, char *argv[]) { QApplication app(argc, argv); QWidget window; window.resize(640, 480); QVideoWidget *videoWidget = new QVideoWidget; QMediaPlayer *player = new QMediaPlayer; player->setVideoOutput(videoWidget); //player->setMedia(QUrl::fromLocalFile("/home/user/Downloads/sample-5s.mp4")); // also works player->setMedia(QUrl("https://file-examples.com/storage/feaa6a7f0468517af9bc02d/2017/04/file_example_MP4_480_1_5MG.mp4")); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(videoWidget); window.setLayout(layout); window.show(); player->play(); return app.exec(); } If I build and run this under ArchLinux with the packages qt5-base and qt5-multimedia installed, it works fine (except for a segmentation fault on exit, but that is a different topic). If however, I build and run this in nixos with nix-shell -p qt5Full libsForQt5.qt5.qtmultimedia I get an empty window, with nothing in stdout or stderr. If I run it with QT_DEBUG_PLUGINS=1 I cannot spot anything suspicious in the output. Any idea how to make progress here? Is that a bug in the nixos package of Qt?
  • What can we say - we like games. And you can use Qt to write some. Questions? Ask here.
    869 4k
    869 Topics
    4k Posts
    BondrusiekB
    @EndrII-0 , sure! you can.(will be very great if you also share a source code)
  • Questions about Qt WebKit and related topics? Post here!
    2k 6k
    2k Topics
    6k Posts
    JonBJ
    @Vbrg So in a word Qt only offers integrated browser with chromium/Qt web engine.
  • Discussions and questions on QtWebEngine
    1k 4k
    1k Topics
    4k Posts
    P
    You either have to build QWebEngine (or WebEngineWidgets) from source if you want it for Qt 6.7.2. QWebEngine is available through the Qt Maintenance Tool only in certain versions. For example 6.6.2. I just upgraded from 6.6.2 to 6.9.0 but faced the same problem. Luckily, 6.9.1 (downloaded via Maintenance Tool) Includes Qt WebEngine Module for msvc2022_64, so I upgraded directly to 6.9.1.
  • You're using Qt with other languages than C++, eh? Post here!
    864 3k
    864 Topics
    3k Posts
    PedromixP
    Brand new release QtJambi 6.9.1 is out now🥂. Create sophisticated Java apps for Desktop and Mobile or refactor your legacy code using Qt as UI framework! https://www.qtjambi.io [image: cb78556c-b761-467b-b005-119e3643175c.png]
  • Combining Qt with 3rd party libraries or components? Ask here!
    1k 6k
    1k Topics
    6k Posts
    Axel SpoerlA
    @Dream_Helium said in Using Qt Program as a Module, but constantly get critical message: using GModule to load a Qt module just that thought scares me! Which Qt module are you loading and why with GModule? What is the expected result? g_main_context_pop_thread_default: assertion 'stack != NULL' failed As rightfully said: That error message comes from glib, not from Qt. Maybe consult the gtk forum.
  • For discussion and questions about Qt for Python (PySide & Shiboken)

    3k 15k
    3k Topics
    15k Posts
    SGaistS
    The chart example is an interesting starting point.
  • Specific issues when using Qt for WebAssembly

    454 2k
    454 Topics
    2k Posts
    S
    I think I might have a similar problem. Any update on your original issue?
  • Discussions and questions about Qt Quick Ultralite and using Qt on microcontrollers in general

    141 441
    141 Topics
    441 Posts
    S
    Hi again, This is a follow-up to my earlier post regarding the Spark font engine integration with complexTextRendering enabled. I’ve resolved all the build-time errors related to Spark integration, and both the platform and application layers build successfully. However, after flashing the final binary onto the hardware, all the text has disappeared from the screen — only images are visible. It seems like text rendering is completely missing at runtime. Regarding the previous suggestion to use the ldd tool to check for library dependencies — thank you for the recommendation. Since I'm working on different OS and building with MinGW, I wasn’t able to use ldd directly but did try some alternative tools available for Windows that perform similar dependency checks. Has anyone experienced a similar issue where the text doesn't appear on hardware after enabling Spark font engine with complexTextRendering = true? Any insights on what could be going wrong or how to debug this would be greatly appreciated. Thanks in advance!
  • The forum for discussing the Qt Digital Advertising Platform

    17 41
    17 Topics
    41 Posts
    E
    @nayka Can I use QtDigitalAdvertising on PC applications? Or is it only allowed for use on Android or iOS mobile devices?
  • For discussion and questions about Qt Insight

    10 19
    10 Topics
    19 Posts
    jsulmJ
    @Alejandro_qt_ Here is an example how to build qtbase module: https://stackoverflow.com/questions/50022325/building-qt-module-from-source