Skip to content

Qt Development

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

Subcategories


  • This is where all the desktop OS and general Qt questions belong.
    84k 457k
    84k Topics
    457k Posts
    Esmaeil_SooanE
    Hi, You can also check out this library: 👉 QAudioTagReader It’s a Qt-friendly wrapper around TagLib for exporting audio tags.
  • The forum for developing everything embedded: Linux, WinCE, Symbian, MeeGo... you name it.
    14k 63k
    14k Topics
    63k Posts
    D
    @ekkescorner In Qt Maintenance Tool I do not see 6.9.3. The newest options available to me are 6.9.2 and 6.10.0-rc. Would 6.9.2 be sufficient? How could I get 6.9.3 in another way?
  • Looking for The Bling Thing(tm)? Post here!
    20k 78k
    20k Topics
    78k Posts
    A
    Hi, We are using qt6.9.1 on windows. We are trying to use svg image in our project but we get below error:- error: qt.svg: <use> element image0_2845_461 in wrong context! This is my qml code where i am trying to include the svg file Image { id: name source: "cctv_camera.svg" anchors.fill: parent fillMode: Image.PreserveAspectFit } Note: We are using SVGs because when the application is scaled, PNG images appear blurry. I saw Qt only supports the SVG Tiny format. Is there a way to convert my existing SVGs to this format, or is there an alternative approach to use images that won’t become blurry when the resolution changes? Regards, Adnan
  • This is a discussion space for

    • for audio / video playback and recording
    • media formats and codecs
    • camera and screen sharing functionality
    44 184
    44 Topics
    184 Posts
    L
    Yes, on further investigation. Dolphin and the 'browse' function of Gwenview all give a basic sort of pop-up window to enter the smb credentials, and then don't seem to be able to pass those credentials to ffmpeg to play videos. BUT, if I enter the credentials in Thunar or PCManFM (which has a different style credentials popup) and then double click the file, gwenview opens and can play the files. So I do not know the difference between how the credentials are being saved/stored/shared between the 2 apps, but I do know that one works, and the other broke with the recent update. It's very odd that gwenview cannot do it itself by 'browsing' to the file location, but an external file manager can do it and then send the credentials to the right place for video playback (reminder that basic photo viewing works, it's just the video playback which has broken). I appreciate your time and help, even if it doesn't seem to be qt.multimedia related. Do you know the different methods of how ffmpeg can get permission from other processes?
  • Have a question about Qt Creator, our cross-platform IDE, or any of the other tools? Ask here!
    8k 35k
    8k Topics
    35k Posts
    8Observer88
    Thanks you very much! I moved source code two src folder but I forgot to change it in the qt_add_executable section like this: qt_add_executable(app WIN32 MACOSX_BUNDLE src/debug-drawer.h src/debug-drawer.cpp src/main.cpp src/mainwindow.cpp src/mainwindow.h ) Solved: https://github.com/8Observer8/debug-drawer-qpainter-box2dv3-qt6-cpp [image: 505009b2-2615-4569-b2c7-a9cbaa254558.png]
  • 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
    N
    thanks for the suggestion. switching to cmake 3.22.6, which is the minimum recommended, I get the same problem exactly. I even tried the 6.9.2 branch from git, but got the same result. I will be having a go with 6.10 RC to see if I have the same issue.
  • What can we say - we like games. And you can use Qt to write some. Questions? Ask here.
    875 4k
    875 Topics
    4k Posts
    8Observer88
    Debug drawer for Box2D v3 using QPainter It uses b2World_Draw to draw Box2D objects for debugging. You can just download and run it without compiling libs because it include libs for Windows (MinGW) and Android. Source: https://github.com/8Observer8/debug-drawer-qpainter-box2dv3-qt6-cpp [image: 2a9af153-b7d2-40a0-9702-5fdfb79ccf52.png]
  • Discussions and questions on QtWebEngine
    1k 4k
    1k Topics
    4k Posts
    V
    I have x86_64 host with 500GB RAM, on this I spinned up a podman continer for arm64 using qemu-user-static emulator. I couldn't use cross-compilers because of this issue(https://forum.qt.io/topic/163096/qt-6.8.3-build-fails-for-arm64-when-compiled-using-gcc-cross-compiler-x86_64-aarch64-toolchain./4). After Qtwebengine built almost, while compiling evaluate_prg_hwy file, it is failing with "g++: fatal error: Killed signal terminated program cc1plus". Even with 500GB RAM I couln't make progress with this. What exactly is this file. I am using cmake file to configure options (QT_CONFIGURE_OPTS = -DCMAKE_BUILD_TYPE=Release -DQT_BUILD_EXAMPLES=OFF -DQT_BUILD_TESTS=OFF \ etc) Can we disable this file/component which compiles from webengine. I need qtwebengine, can we disable compilation of evaluate_prg_hwy or its module from webengine alone? Can someone please help here
  • You're using Qt with other languages than C++, eh? Post here!
    866 3k
    866 Topics
    3k Posts
    PedromixP
    [image: 94cc5d4f-301e-4ed0-811e-cd145096a707.png] New version QtJambi 6.9.2 is available now 🎉. For all who want to create smart UIs🚀 in Java or Kotlin based upon the latest Qt release. https://www.qtjambi.io
  • Combining Qt with 3rd party libraries or components? Ask here!
    1k 6k
    1k Topics
    6k Posts
    B
    I completed the code by adding a couple of new functions, taking into account the output of images from the camera and video, and also added logs and improved the display of the detected object self.busy = False self.moves_enabled = False self.cls2cat = { "adjustable_wrench": "Box1", "gear": "Box2", "hammer": "Box3", "screwdriver": "Брак" } self.BtCamera.clicked.connect(self.Camera) self.BtVideo.clicked.connect(self.Video) self.BtDetectObject.clicked.connect(self.toggle_objects) self.BtDetectPeople.clicked.connect(self.toggle_people) self.BtMoveObjects.clicked.connect(self.toggle_moves) self.yolo = YOLO('best.pt') self.cap = None self.videoActive = False self.cameraActive = False self.det_objects = False self.det_was_active = False self.people_present = False self._seen, self._ttl = {}, 2000 self.frame_timer = QtCore.QTimer(self) self.frame_timer.timeout.connect(self.tick) self.people_timer = QtCore.QTimer(self) self.people_timer.timeout.connect(self.tick_people) def Camera(self): if not self.cameraActive: if self.cap: try: self.cap.release() except: pass self.cap = cv2.VideoCapture(0) if not self.cap.isOpened(): self.add_log('Камера: не удалось открыть 0'); return self.videoActive, self.cameraActive = False, True if not self.frame_timer.isActive(): self.frame_timer.start(33) self.add_log('Камера: старт') else: if self.frame_timer.isActive(): self.frame_timer.stop() if self.cap: try: self.cap.release() except: pass self.cap = None self.videoActive = self.cameraActive = False if hasattr(self, 'LCamera1'): self.LCamera1.clear() if hasattr(self, 'LCamera2'): self.LCamera2.clear() self.add_log('Камера: стоп') def Video(self): if not self.videoActive: src = 'Video2.mp4' if self.cap: try: self.cap.release() except: pass self.cap = cv2.VideoCapture(src) if not self.cap.isOpened(): self.add_log(f'Видео: не удалось открыть {src}'); return self.videoActive, self.cameraActive = True, False if not self.frame_timer.isActive(): self.frame_timer.start(33) self.add_log(f'Видео: старт {src}') else: if self.frame_timer.isActive(): self.frame_timer.stop() if self.cap: try: self.cap.release() except: pass self.cap = None self.videoActive = self.cameraActive = False if hasattr(self, 'LCamera1'): self.LCamera1.clear() if hasattr(self, 'LCamera2'): self.LCamera2.clear() self.add_log('Видео: стоп') def toggle_objects(self): self.det_objects = not self.det_objects if hasattr(self, 'BtDetectObject'): self.BtDetectObject.setText("Stop detection" if self.det_objects else "Detect objects") self.add_log("Детекция объектов: ON" if self.det_objects else "Детекция объектов: OFF") def toggle_people(self): if self.people_timer.isActive(): self.people_timer.stop() self.add_log('Мониторинг человека: OFF') else: self.people_timer.start(200) self.add_log('Мониторинг человека: ON') def _dedup(self, name, cx, cy): k, now = (name, cx//10, cy//10), int(time.time()*1000) if now - self._seen.get(k, 0) < self._ttl: return False self._seen[k] = now; return True def _ok(self, name: str) -> bool: name = name.lower() mapping = { 'adjustable_wrench': getattr(self, 'CBBox1', None), 'gear': getattr(self, 'CBBox2', None), 'hammer': getattr(self, 'CBBox3', None), 'screwdriver': getattr(self, 'CBReject', None) } w = mapping.get(name) return bool(w and w.isChecked()) def _to_label(self, label: QtWidgets.QLabel, bgr): if label is None: return rgb = cv2.cvtColor(bgr, cv2.COLOR_BGR2RGB) h, w, c = rgb.shape qimg = QtGui.QImage(rgb.data, w, h, w * c, QtGui.QImage.Format_RGB888) label.setPixmap(QtGui.QPixmap.fromImage(qimg).scaled(label.width(), label.height(), QtCore.Qt.KeepAspectRatio)) def tick_people(self): try: if self.smart_camera.getPerson(): self.lamp.setLamp('0001') if self.det_objects: self.det_was_active = True self.det_objects = False if self.frame_timer.isActive(): self.frame_timer.stop() if not self.people_present: self.people_present = True self.add_log('Человек в рабочей зоне! Детекция остановлена') else: self.lamp.setLamp('1000') if self.people_present: self.people_present = False self.add_log('Зона свободна') if not self.frame_timer.isActive() and (self.videoActive or self.cameraActive) and self.cap: self.frame_timer.start(33) if self.det_was_active and not self.det_objects: self.det_objects = True self.det_was_active = False self.add_log('Детекция объектов возобновлена') except Exception as e: self.add_log(f'getPerson() error: {e}') def tick(self): if not self.cap: return ok, frame = self.cap.read() if not ok: if self.videoActive: self.add_log("Видео: конец файла") if self.frame_timer.isActive(): self.frame_timer.stop() if self.cap: try: self.cap.release() except: pass self.cap = None self.videoActive = self.cameraActive = False if hasattr(self, 'LCamera1'): self.LCamera1.clear() if hasattr(self, 'LCamera2'): self.LCamera2.clear() return img2 = frame img1 = frame.copy() if self.det_objects: try: r = self.yolo(frame, verbose=False, device='cpu')[0] if hasattr(r, 'boxes') and r.boxes is not None: keep = [self._ok(str(self.yolo.names[int(b.cls[0])]).lower()) for b in r.boxes] if any(keep): import numpy as np r.boxes = r.boxes[np.array(keep, dtype=bool)] else: r.boxes = r.boxes[:0] for b in r.boxes: cls_id = int(b.cls[0]) name = str(self.yolo.names[cls_id]).lower() x1, y1, x2, y2 = map(int, b.xyxy[0]) cx, cy = (x1 + x2) // 2, (y1 + y2) // 2 if self._dedup(name, cx, cy): self.add_log(f"Detected {name}") if self.moves_enabled and not self.people_present: self.run_session_yolo(name) else: self.add_log("Перемещение отключено" if not self.moves_enabled else "Ожидание: человек в зоне") img1 = r.plot() except Exception as e: self.add_log(f"YOLO error: {e}") if hasattr(self, 'LCamera1'): self._to_label(self.LCamera1, img1) if hasattr(self, 'LCamera2'): self._to_label(self.LCamera2, img2) def run_session_yolo(self, name: str): cat = self.cls2cat.get(name.lower()) if not cat: self.add_log(f"Нет маппинга для класса: {name}") return try: if cat == 'Брак': self._pick_and_place(self.rejectCell, self.rejectTrack) else: slot = self._choose_slot(cat) if slot is None: self.add_log(f"Нет свободных ячеек для {cat}") return self._pick_and_place(self.cells[slot], self.cellTrack[slot]) self.robot.play() while self.robot.getActualStateOut() != InterpreterStates.PROGRAM_IS_DONE.value: QtWidgets.QApplication.processEvents() time.sleep(0.05) self.add_log(f"Перемещено: {name} -> {cat}") except Exception as e: self.add_log(f"Ошибка перемещения: {e}") QtWidgets.QMessageBox.warning(self, "Ошибка", str(e)) def toggle_moves(self): self.moves_enabled = not self.moves_enabled try: self.BtMoveObjects.setText("Moves: ON" if self.moves_enabled else "Moves: OFF") except Exception: pass self.add_log("Перемещения: ON" if self.moves_enabled else "Перемещения: OFF")
  • For discussion and questions about Qt for Python (PySide & Shiboken)

    3k 15k
    3k Topics
    15k Posts
    M
    Hello I want to make a drag and drop system with .exe application. The application look like this for now : [image: b8383ce3-62cb-4b22-9fb6-50bdb7067503.png] So, I want to take application in the left scroll area and drag it in the scroll area of the different detected screens. The system of drag and drop and receive my application object, that contains the icon in QIcon, works. But, when I drop my application in a QScrollArea(), the icon is cropping like in the picture below: [image: 343b35d3-a12f-4e17-a1fa-caf90666baa3.png] I tried some little things to avoid that but the same weird crop. How can I solve it ? The part of the code of a screen area : class QScreenApplication(QWidget): def __init__(self, screen: QScreen): super().__init__() self.setAcceptDrops(True) self.applications: List[Application] = [] # Store all the applications drag in the screen self.init_UI(screen) def init_UI(self, screen: QScreen): main_layout = QVBoxLayout() # Scrollable area for application icons self.scroll_area = QScrollArea() self.scroll_area.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff) self.scroll_area.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAsNeeded) # Container widget for icons to have the layout left-aligned self.icons_widget = QWidget() self.icons_layout = QHBoxLayout() self.icons_layout.setAlignment(Qt.AlignmentFlag.AlignLeft) self.icons_widget.setLayout(self.icons_layout) self.scroll_area.setWidget(self.icons_widget) main_layout.addWidget(self.scroll_area, 85) screen_name = screen.name() # Detect if the screen is a laptop screen (name starts with \\) if screen_name.startswith(r"\\"): screen_name = "Laptop Screen" screen_name_label = QLabel(f"Screen: {screen_name}") main_layout.addWidget(screen_name_label, 15) self.setLayout(main_layout) def add_application_icon(self, application: Application): """ Add the icon of the application to the scroll area :param application: Application received from the drag and drop """ icon_label = QLabel() icon_label.setFixedSize(32, 32) icon_label.setToolTip(application.name) # Show the name on hover # Prevent icon cropping icon_label.setScaledContents(True) # Allow the image to fit the label size icon_label.setAlignment(Qt.AlignmentFlag.AlignCenter) # Center the icon if application.icon: pixmap = application.icon.pixmap(32, 32) if not pixmap.isNull(): # Resize the pixmap to fit in the QLabel scaled_pixmap = pixmap.scaled(32, 32, Qt.AspectRatioMode.KeepAspectRatio, Qt.TransformationMode.SmoothTransformation) icon_label.setPixmap(scaled_pixmap) else: QMessageBox.warning( self, "Icon Error", f"The application {application.name} does not have a valid icon." ) self.applications.remove(application) return icon_label.setPixmap(application.icon.pixmap(32, 32)) else: QMessageBox.warning( self, "Icon Error", f"The application {application.name} does not have a valid icon." ) self.applications.remove(application) # Remove the application if it has no icon return # Add the icon to the layout of the scroll area self.icons_layout.addWidget(icon_label) #region Drag and Drop Events
  • Specific issues when using Qt for WebAssembly

    459 2k
    459 Topics
    2k Posts
    M
    Hi, this might be covered by the linked to post, but to answer here as well: This was changed in 6.9, the entry/constructor function name is not hardcoded to "createQtAppInstance" any more but is now named after the application, with an "_entry" suffix. For example If you have myapp.js (and load that using e.g. a <script> tag) then you should find the constructor function at window.myapp_entry. This enables support for loading multiple wasm modules (with separate constructor functions) into a single web page, at the cost of having to name the entry function in the html code.
  • Discussions and questions about Qt Quick Ultralite and using Qt on microcontrollers in general

    146 456
    146 Topics
    456 Posts
    Axel SpoerlA
    So to recap, this is not about disabling Qt and forcing a full repaint, as the title would suggest. It's about closing the application altogether when the system enters sleep mode, and restarting it upon wakeup. The only way to achieve that in my view is the following: Re-write your application to listen the sleep mode signal as per the description above. Exit the application, when sleep mode is entered. Write a wrapper for your application. If in Qt, use QProcess to start the application. In the wrapper listen to the system specific wakeup signal. Upon receipt, restart the application.
  • The forum for discussing the Qt Digital Advertising Platform

    16 39
    16 Topics
    39 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