Skip to content

Qt 6

This is where all Qt 6 related questions belong

875 Topics 4.3k Posts
  • Windows11 native appearance question

    Unsolved
    2
    1 Votes
    2 Posts
    1k Views
    I
    I also have the same issue, and cannot find anyone else complaining. I don't have a solution for you though. I recently transitioned from 6.6.1 to 6.7.2. And the "windows11" style in light mode looks hideous. There is less contrast throughout the application, making it difficult to navigate. Some bits are nice, but most are bad. The silver lining is that dark mode is better than the previous Fusion style, especially checkboxes. In light mode, I'm setting the style to "windowsvista" to achieve 6.6.1 look for now.
  • Qt to Sql connection

    Unsolved
    3
    0 Votes
    3 Posts
    406 Views
    JonBJ
    @Chakravarthi-N Same as it has always been. Have you started by reading SQL Programming and Connecting to Databases?
  • Bluetooth not working In Qt 6

    Unsolved
    6
    0 Votes
    6 Posts
    794 Views
    M
    @JonB @Q-Master @Qt-Enthusiast @Qt-embedded-developer I have this configuration use for msvc compiler and i have run different project that perfectly run with this configuration [image: 71f58376-a3e2-447d-a237-7ebd23d6662e.png]
  • Question for Qt6.2 - Qt.labs.platform Dialog

    Unsolved
    6
    0 Votes
    6 Posts
    1k Views
    J
    because the qt.labs.platform has the Dialog as well, need to specifically use Dialog control in QtQuick.Controls
  • Is there any change in the licensing from qt5 to qt6?

    Unsolved
    2
    0 Votes
    2 Posts
    531 Views
    jsulmJ
    @Vishal-Kumar said in Is there any change in the licensing from qt5 to qt6?: Is there any change happened to qt6 opensource licensing which might cause an issue later ? As far as I know there are no changes since Qt 5.6 (where LGPL was changes to v3).
  • [Custom Background for a widget]

    Unsolved
    12
    0 Votes
    12 Posts
    2k Views
    B
    I am also having the same behavior: If this is my custom widget that is derived from QWidget: CCustomWidget.h namespace Ui { class CCustomWidget; } class CCustomWidget : public QWidget { Q_OBJECT public: explicit CCustomWidget(QWidget* pParent = nullptr); ~CCustomWidget(); private: Ui::CCustomWidget* ui; }; CCustomWidget.cpp #include "CCustomWidget.h" #include "ui_CCustomWidget.h" CCustomWidget::CCustomWidget(QWidget* pParent) : QWidget(pParent), ui(new Ui::CCustomWidget) { ui->setupUi(this); } CCustomWidget::~CCustomWidget() { delete ui; } main.cpp #include <QApplication> #include "CCustomWidget.h" int main(int argc, char* argv[]) { QApplication App(argc,argv); // this does not load the image CCustomWidget CW; CW.setStyleSheet(QStringLiteral("background-image: url(:/background.png);")); CW.show(); // this does load the image // QWidget W; // W.setStyleSheet(QStringLiteral("background-image: url(:/background.png);")); // W.show(); return App.exec(); } When I am in the Designer tab of QtCreator, the background image for my custom widget displays correctly. But as soon as I compile/run the program. The custom widget no longer has a background image. I have tried: Programmatically setting the style sheet (as above) Setting the style sheet in the Designer of QtCreator Specifying my custom widget in the style sheet definition, where myCustomWidget is the QObject name that I set for my class in the constructor. CW.setStyleSheet("#myCustomWidget{ background-image: url(:/background.png); }"); I finally resorted to adding a QWidget on the Designer tab of QtCreator. Setting its style sheet to the background image by setting it in the properties section, and then moving the widget to the back so that it is behind everything else on the custom widget. There is clearly something fundamental that I am missing but I do know know what it is or what even to ask. If someone could point me in the right direction, I would greatly appreciate it. It seems like setting a custom background image for your custom widget should be something that is very easy to do, but it is eluding me. Thanks
  • Seeking Information about Qt Modules that I can't understand from the docs

    Unsolved
    2
    0 Votes
    2 Posts
    432 Views
    A
    Hi, The answer is pretty simple: only use the templates for property declaration. If you don't, you may get the incompatible type error. The templates are also used to implement themes like Material or Universal theme. Instead of doing import QtQuick import QtQuick.Controls Item { id: root property Button myButton: Button {} } You must use the Button type provided by the Templates import QtQuick import QtQuick.Controls import QtQuick.Templates as T Item { id: root property T.Button myButton: Button {} And they're used to defining the visual types // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only import QtQuick import QtQuick.Templates as T import QtQuick.Controls.impl import QtQuick.Controls.Material import QtQuick.Controls.Material.impl T.Button { id: control implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, implicitContentWidth + leftPadding + rightPadding) implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, implicitContentHeight + topPadding + bottomPadding) topInset: 6 bottomInset: 6 verticalPadding: Material.buttonVerticalPadding leftPadding: Material.buttonLeftPadding(flat, hasIcon && (display !== AbstractButton.TextOnly)) rightPadding: Material.buttonRightPadding(flat, hasIcon && (display !== AbstractButton.TextOnly), (text !== "") && (display !== AbstractButton.IconOnly)) spacing: 8 icon.width: 24 icon.height: 24 icon.color: !enabled ? Material.hintTextColor : (control.flat && control.highlighted) || (control.checked && !control.highlighted) ? Material.accentColor : highlighted ? Material.primaryHighlightedTextColor : Material.foreground ... https://github.com/qt/qtdeclarative/blob/dev/src/quickcontrols/material/Button.qml And make sure to read this section. It explains why you must use templates when declaring properties: https://doc.qt.io/qt-6/qtquick-controls-qmlmodule.html#using-qt-quick-controls-types-in-property-declarations
  • Seeking plugin information

    Solved
    3
    0 Votes
    3 Posts
    464 Views
    Ash VA
    @jsulm Hi. Could you please name the specific one in that list of Qt Quick? :) Or I need to turn on all of them?
  • Allocation of incomplete type "Ui::MainWindow"

    Solved error uimainwindow.h incomplete type mainwindow
    9
    0 Votes
    9 Posts
    13k Views
    SGaistS
    @TrahdBoy hi, It's all explained here.
  • Access to my camera not granted.

    Solved
    4
    0 Votes
    4 Posts
    1k Views
    W
    Hello, Here I answer this question by myself, hope my answer can help someone who also meets this issue. Set QMAKE_INFO_PLIST in your pro file. Please refer https://doc.qt.io/qt-6/ios-platform-notes.html#info-plist-with-qmake Make one function to check camera permission. For example, void MainWindow::checkCameraPermission(void) { // please refer https://code.qt.io/cgit/qt/qtmultimedia.git/tree/examples/multimedia/camera?h=6.7 #if QT_CONFIG(permissions) QCameraPermission cameraPermission; switch (qApp->checkPermission(cameraPermission)) { case Qt::PermissionStatus::Undetermined: qApp->requestPermission(cameraPermission, this, &MainWindow::checkCameraPermission); return; case Qt::PermissionStatus::Denied: std::cout << "Camera permission is not granted!" << std::endl; return; case Qt::PermissionStatus::Granted: std::cout << "Camera permission is granted!" << std::endl; break; } #endif } Make one function to check camera permission status. For example, void MainWindow::checkAuthorizationStatus(void) { #if QT_CONFIG(permissions) QCameraPermission cameraPermission; Qt::PermissionStatus auth_status = Qt::PermissionStatus::Undetermined; while(true) { QThread::msleep(1); auth_status = qApp->checkPermission(cameraPermission); if(auth_status == Qt::PermissionStatus::Undetermined) continue; break; } #endif // if QT_CONFIG } Before searching your camera, call the following functions, checkCameraPermission(); checkAuthorizationStatus(); At my side, this issue had been solved. Thanks. Have a nice day.
  • how can I deploy my own static library?

    Solved
    7
    0 Votes
    7 Posts
    828 Views
    W
    @SimonSchroeder This is a good idea. I will try it. Thanks. Have a nice day.
  • Missing shared objects while using system Qt

    Unsolved
    8
    0 Votes
    8 Posts
    854 Views
    jsulmJ
    @Ash-V What is your Linux distribution?
  • How can I connect my QT cmake project to LibXL

    Unsolved
    9
    0 Votes
    9 Posts
    1k Views
    Christian EhrlicherC
    @Mihil-Ranasinghe said in How can I connect my QT cmake project to LibXL: was using QXlsx library it was shown in project tree. You did not - you just added the sources to your project instead linking to an external library - these are two completely different things.
  • Can't find QT6 inserts to satisfy Wayland

    Unsolved
    4
    0 Votes
    4 Posts
    2k Views
    SGaistS
    Start the application with the QT_DEBUG_PLUGINS environment variable set to 1 to see why it fails to load.
  • 0 Votes
    2 Posts
    587 Views
    M
    Delete the qbs build directory in your project after exiting QtCreator and build it again
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    10 Views
    No one has replied
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    3 Views
    No one has replied
  • SIGSEGV QtPrivate::QMetaTypeInterfaceWrapper<QFlagsQt::WindowState >::metaType ()

    Unsolved
    4
    0 Votes
    4 Posts
    550 Views
    Axel SpoerlA
    When you post code, please use the code formatting tags. It makes reading much easier for those who help you. I have never bumped into an error like that. Probably there is something wrong in how this QAIM is instantiated and d is either stale or nullptr.
  • Could you please help me with some modifications to my Qt6 code?

    Unsolved
    8
    0 Votes
    8 Posts
    1k Views
    T
    Have you solved this problem yet? I'm having the same problem trying QT6!
  • QT6 run the .exe but point out "lack of libwinpthread-1.dll"

    Solved
    6
    0 Votes
    6 Posts
    1k Views
    pedisChenP
    @jsulm I understand now,thank you