Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.6k Posts
  • FramelessWindowHint window not responding with qml Widget

    Unsolved
    1
    0 Votes
    1 Posts
    221 Views
    No one has replied
  • ISO C99 and later do not support implicit function declarations on MacOS. How to fix?

    Unsolved
    5
    0 Votes
    5 Posts
    19k Views
    B
    @Christian-Ehrlicher This kind of troubles not happening if there XCode 13.3.1 with Qt 6.2.8 Anything higher - means troubles. It looks like Apple changed C-standard restriction with XCode.
  • This topic is deleted!

    Solved
    3
    0 Votes
    3 Posts
    33 Views
  • Eclipse Indexation Moc Files

    Unsolved
    1
    0 Votes
    1 Posts
    195 Views
    No one has replied
  • QNetworkAccessManager HTTP(S) upload failure

    Solved
    4
    0 Votes
    4 Posts
    292 Views
    Axel SpoerlA
    @warped-rudi The only change from Qt5 to At6, that comes to my mind right away, is an internal change of the proxy authentication on MacOS. A few other things might also have changed in QNetworkAccessManager, but I don't know from the top of my head. In any case, QNetworkAccessManagershould handle proxy buffering just as well as nginx does. And if Qt6 succeeds in doing the job, solution number 2 is probably the best way to go.
  • Empty space shown next to progress bar in QProgressDialog

    Solved
    5
    0 Votes
    5 Posts
    667 Views
    ScleaverZer0neS
    I created a clean project and used the same code, and there was no empty space on the right. Then I checked if my project had a stylesheet set for the QProgressBar in general in the ".qss" file. Turns out someone before me had set there a margin on the right side of the progress bar. Removing that resolved my problem. Only if I checked that a little sooner.
  • Problem with xkb

    Unsolved
    4
    0 Votes
    4 Posts
    763 Views
    jsulmJ
    @panther1980 Can you try with Qt provided by your Linux distribution? Just to see whether it behaves differently.
  • QOpenGlWidget - why would a if-else in a fragment shader cause QPainter to fail?

    Solved
    16
    0 Votes
    16 Posts
    3k Views
    W
    @NightShadeI Just make sure you've read the OpenGL Wiki's page on gotchas with mixing RAII/OO/ and OpenGL https://www.khronos.org/opengl/wiki/Common_Mistakes#The_Object_Oriented_Language_Problem
  • 0 Votes
    37 Posts
    8k Views
    C
    Here is what I had to do to compile the SimpleMail library statically: Load SimpleMail into Qt Creator by opening CMakeLists.txt from the SimpleMail directory In Qt Creator set the BUILD_SHARED_LIBS option to OFF in Project settings for SimpleMail (see post 6) Remove SHARED from the end of the add_library(SimpleMail2Qt${QT_VERSION_MAJOR} command in CMakeLists.txt in the src subdir (it will then default to SHARED or STATIC based on the BUILD_SHARED_LIBS setting) Add the following commands to the end of CMakeLists.txt in the src subdir (at the end so they override any previous compiler flags set) set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd") These tell CMake to use the static version of the MSVC run-time library. Turn off demo compilation with option(BUILD_DEMOS "Build the demos" OFF) SimpleMail was not configured to support static build by default so I had to change some code in smtpexports.h to change functions from being linked for DLL usage to static usage: #define SMTP_EXPORT /#if defined(SimpleMail2Qt5_EXPORTS) #define SMTP_EXPORT Q_DECL_EXPORT #else #define SMTP_EXPORT Q_DECL_IMPORT #endif/ For any library that is not built for static builds by default like SimpleMail you have to do the same. Q_DECL_EXPORT and Q_DECL_IMPORT are Qt macros for __declspec(dllexport) and __declspec(dllimport) respectively so if your library uses those you'll have to do the same for those guys in the library. By doing a #define for the macro without a value it will be empty and therefore avoid adding those __declspec guys to the library. Make sure to build the library using a static build of Qt.
  • Creating add/delete buttons that modify a list

    Unsolved
    7
    0 Votes
    7 Posts
    1k Views
    Pl45m4P
    @Patrick_Li said in Creating add/delete buttons that modify a list: I haven't been using any code for this, instead I've only been dragging-and-dropping widgets and such onto the UI After I wrote my comment, I thought so :) Is there a way to modify the code of the UI at this point? Unfortunately not. The Qt Designer is just an auxiliary tool to create simple UI's or help you with designing more complex ones. Therefore QtDesigner is limited and there are many many things, which are simply not possible to do using the Design Mode only. You can make direct widget-2-widget connections, when the signal and the slot are compatible, e.g. a connection for clear()'ing the whole list on button click() would be possible to establish just from your UI Designer. But deleting specific items from that list or adding a new item, wont work this way. Because I've said, it is easy, I made some tests myself to see if it's really that easy and I came up with this: Feel free to use it or ask, if something's not clear :) connect(ui->pushButton_add, &QPushButton::clicked, [this](){ bool ok; QString text = QInputDialog::getText(this, tr("Create new list item"), tr("Insert item name:"), QLineEdit::Normal, "New item", &ok); if(ok && !text.isEmpty()) ui->listWidget->addItem(text); }); connect(ui->pushButton_delete, &QPushButton::clicked, [this](){ for(auto item: ui->listWidget->selectedItems()){ int takeAtRow = ui->listWidget->row(item); auto removedItem = ui->listWidget->takeItem(takeAtRow); delete removedItem; } });
  • How to customize the QScrollBar "corner" area?

    Unsolved
    3
    0 Votes
    3 Posts
    671 Views
    D
    @Pl45m4 said in How to customize the QScrollBar "corner" area?: @Daniella said in How to customize the QScrollBar "corner" area?: How i could customize this same area in a QScrollBar? This is actually part of QAbstractScrollArea (the background area on which the scrollBars are) You can customize it with // w = your widget which provides the scrollBars w->setStyleSheet("QAbstractScrollArea::corner { background: black;}"); I have tried "hide" it setting QAbstractScrollArea::corner { width: 0px; height: 0px;} also max-height: 0; but its space continue there. I think the corner area can be edited by handling the subElementRect or maybe subControlRect, i found this: PE_PanelScrollAreaCorner I tried setting a proxy style into the treeview, its viewport and its scrollbar but none of them is calling these elements. class ProxyStyle : public QProxyStyle { public: ProxyStyle(QStyle *style = nullptr) : QProxyStyle(style){} QRect subElementRect(QStyle::SubElement element, const QStyleOption* option, const QWidget* widget = nullptr) const override { qDebug() << "#e:" << element; qDebug() << QProxyStyle::subElementRect(element, option, widget); return QProxyStyle::subElementRect(element, option, widget); } void drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget = nullptr) const override { qDebug() << "pe:" << element; return QProxyStyle::drawPrimitive(element, option, painter, widget); } }; QTreeView* treeView = new QTreeView(this); treeView->viewport()->setStyle(new ProxyStyle(treeView->viewport()->style())); treeView->setStyle(new ProxyStyle(treeView->style()));
  • How to draw an SVG with a custom opacity

    Solved
    12
    0 Votes
    12 Posts
    1k Views
    additional-pumpkinA
    @Chris-Kawa Thank you so much!! This works great!
  • 0 Votes
    4 Posts
    421 Views
    SGaistS
    Then isn't QRemoteObjectNode::remoteObjectAdded what you are looking for ?
  • How to draw a rect with only the bottom left border rounded?

    Solved
    3
    0 Votes
    3 Posts
    583 Views
    Y
    I got it working, only the bottom left corner rounded: path.moveTo(mrect.bottomLeft() + QPointF(borderRadius, 0)); path.lineTo(mrect.bottomRight()); path.lineTo(mrect.topRight()); path.lineTo(mrect.topLeft()); path.lineTo(mrect.bottomLeft() + QPointF(0, -borderRadius)); path.quadTo(mrect.bottomLeft(), mrect.bottomLeft() + QPointF(borderRadius, 0));
  • 0 Votes
    8 Posts
    1k Views
    SGaistS
    If you use exec to show your dialog, you know it has ended when the method returns. As for your other question, depending on what you want to do, you can use the close method to emit a custom signal for example but you don't give enough context to answer properly.
  • memory leak issue (WebPDecodeRGBA)

    Solved
    4
    0 Votes
    4 Posts
    415 Views
    M
    @MyNameIsQt I solved the problem by creating it by copy rather than by reference. Of course, this caused the image not to show full size, but this will be fixed soon. thank you uint8_t* decodedData = WebPDecodeRGBA(reinterpret_cast<uchar*>(imageData.data()), imageSize, &width, &height); if (!decodedData) { throw std::runtime_error("Failed to decode WebP image"); return false; } m_pBkgndImage = new QImage(width, height, QImage::Format_RGBA8888); memcpy(m_pBkgndImage->bits(), decodedData, width * height * 4); WebPFree(decodedData);
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    8 Views
    No one has replied
  • 0 Votes
    7 Posts
    653 Views
    K
    Thank you all for the immediate response, with the change in QtService (QSettings::systemscope to QSettingS("OrgID", QtSoftware) able to generate QtSoftware.conf in user scope .config folder.
  • Call to member function 'arg' is ambiguous.

    Solved
    7
    0 Votes
    7 Posts
    4k Views
    Atr0p0sA
    @J-Hilk It turns out that I thought so :) @JonB @ChrisW67 Thanks for the help, I should be more thoughtful...
  • Qt-6.5.1: Enabling/Disabling unknown feature 'webp'

    Unsolved
    2
    0 Votes
    2 Posts
    405 Views
    D
    Ok, I was found workaround user@37f324a80f53:/tmp/firmware$ mkdir /tmp/firmware/build-sh-sti7105/qtimageformats-everywhere-src-6.5.1_build user@37f324a80f53:/tmp/firmware$ cd /tmp/firmware/build-sh-sti7105/qtimageformats-everywhere-src-6.5.1 user@37f324a80f53:/tmp/firmware/build-sh-sti7105/qtimageformats-everywhere-src-6.5.1$ /tmp/firmware/staging_sml7105/qt6_sti7105/bin/qt-configure-module ../qtimageformats-everywhere-src-6.5.1 -feature-webp -no-feature-tiff -- -DCMAKE_STAGING_PREFIX=/tmp/firmware/staging_sml7105/qt6_sti7105 Overriding option 'webp' with 'yes' (was: 'undefined') Overriding option 'tiff' with 'no' (was: 'undefined') '/tmp/firmware/staging_sml7105/qt6_sti7105/bin/../libexec/qt-cmake-private' '-DCMAKE_STAGING_PREFIX=/tmp/firmware/staging_sml7105/qt6_sti7105' '-DINPUT_webp=yes' '-DINPUT_tiff=no' '/tmp/firmware/build-sh-sti7105/qtimageformats-everywhere-src-6.5.1' -- The CXX compiler identification is GNU 11.2.0 -- The C compiler identification is GNU 11.2.0 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /tmp/firmware/toolchain/sh4-rtk-linux-uclibc/bin/sh4-rtk-linux-uclibc-g++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /tmp/firmware/toolchain/sh4-rtk-linux-uclibc/bin/sh4-rtk-linux-uclibc-gcc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE -- Performing Test HAVE_STDATOMIC -- Performing Test HAVE_STDATOMIC - Failed -- Performing Test HAVE_STDATOMIC_WITH_LIB -- Performing Test HAVE_STDATOMIC_WITH_LIB - Success -- Found WrapAtomic: TRUE -- Configuration summary shown below. It has also been written to /tmp/firmware/build-sh-sti7105/qtimageformats-everywhere-src-6.5.1/config.summary -- Configure with --log-level=STATUS or higher to increase CMake's message verbosity. The log level does not persist across reconfigurations. -- Configure summary: Further Image Formats: JasPer ................................. no MNG .................................... no TIFF ................................... no Using system libtiff ................. no WEBP ................................... yes Using system libwebp ................. no Note: Due to CMAKE_STAGING_PREFIX usage and an unfixed CMake bug, to ensure correct build time rpaths, directory-level install rules like ninja src/gui/install will not work. Check QTBUG-102592 for further details. -- Configuring done -- Generating done -- Build files have been written to: /tmp/firmware/build-sh-sti7105/qtimageformats-everywhere-src-6.5.1 out-off-tree is a mandatory?