Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.6k Posts
  • Using Qt 5.2 on MacOSX 15.3 Sequoia - could not resolve platform name for SDK

    Solved
    6
    0 Votes
    6 Posts
    731 Views
    jsulmJ
    @cygnus23 OK, maybe there is no Qt5 because there are no ARM binaries available. You should be able to install Qt5 via offline installer.
  • [QImage/QSettings] rotate and restore a rotated image from stored data.

    Solved
    4
    0 Votes
    4 Posts
    470 Views
    ?
    I come back one last time to state that I have just been very distracted or stupid. Subsequently applying different rotation angles means adding to - or subtracting from the most recent accumulated value. END-OF-STORY. (Beats me). I do not need to store full-blown QTransform objects but can stick with my dearly loved int-values.
  • 0 Votes
    6 Posts
    695 Views
    J
    @ChrisW67 Thank you for your reply. In the end, I used QFrame instead of QWidget, and I was able to set the color of the space in the BoxLayout using the stylesheet.
  • qtvirtualkeyboard in QWidget App

    Unsolved
    2
    0 Votes
    2 Posts
    191 Views
    M
    the whole idea of integrating a Qt Virtual keyboard in a QWidget might be not a great one. I found QQuickWidget and QQuickView attempts which both deal with integrating qml code into your QWidget application. But I couldn't find a way to only use the qt virtual keyboard without rewriting the ui then. Well at this point i don't understand the documentation under: https://doc.qt.io/qt-5/qtvirtualkeyboard-index.html where it says: Supports both Qt Quick and Qt Widgets applications. How is that feature meant?
  • ¿Why is does not set the icon?

    Solved
    5
    0 Votes
    5 Posts
    414 Views
    I
    Ok so this was the cause of the problem incorrect handling of the bitmap data and improper configuration of the BITMAPINFO structure Heres is the correct code. QPixmap groups::extractPixmapFromExe(const QString &exePath) { QFileInfo fileInfo(exePath); QString fileName = fileInfo.fileName(); qDebug() << "Extracting icon from file: " << fileName; // Extract the icon from the executable HICON hIcon = ExtractIcon(NULL, exePath.toStdWString().c_str(), 0); if (hIcon == NULL) { qDebug() << "Failed to extract icon from" << exePath; return QPixmap(); // Return an empty pixmap if icon extraction fails } // Get icon information ICONINFO iconInfo; if (!GetIconInfo(hIcon, &iconInfo)) { qDebug() << "Failed to get icon info."; DestroyIcon(hIcon); return QPixmap(); } // Get the color bitmap information BITMAP bitmap; if (!GetObject(iconInfo.hbmColor, sizeof(bitmap), &bitmap)) { qDebug() << "Failed to get bitmap info."; DestroyIcon(hIcon); return QPixmap(); } // Create a device context for the bitmap HDC hdc = GetDC(NULL); HDC memDC = CreateCompatibleDC(hdc); HBITMAP hOldBitmap = (HBITMAP)SelectObject(memDC, iconInfo.hbmColor); // Prepare the BITMAPINFO structure BITMAPINFO bmi = {}; bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmi.bmiHeader.biWidth = bitmap.bmWidth; bmi.bmiHeader.biHeight = -bitmap.bmHeight; // Negative for top-down bitmap bmi.bmiHeader.biPlanes = 1; bmi.bmiHeader.biBitCount = 32; bmi.bmiHeader.biCompression = BI_RGB; // Allocate a buffer for the bitmap data QByteArray buffer(bitmap.bmWidth * bitmap.bmHeight * 4, 0); // 32-bit ARGB format // Retrieve the bitmap data if (!GetDIBits(memDC, iconInfo.hbmColor, 0, bitmap.bmHeight, buffer.data(), &bmi, DIB_RGB_COLORS)) { qDebug() << "Failed to retrieve bitmap data."; SelectObject(memDC, hOldBitmap); DeleteDC(memDC); ReleaseDC(NULL, hdc); DestroyIcon(hIcon); return QPixmap(); } // Create a QImage from the bitmap data QImage img(reinterpret_cast<const uchar*>(buffer.constData()), bitmap.bmWidth, bitmap.bmHeight, QImage::Format_ARGB32); // Clean up resources SelectObject(memDC, hOldBitmap); DeleteDC(memDC); ReleaseDC(NULL, hdc); DestroyIcon(hIcon); // Convert the QImage to a QPixmap and return it return QPixmap::fromImage(img); }
  • 1 Votes
    13 Posts
    2k Views
    SGaistS
    @Lyubov-Gencheva hi and welcome to devnet, If there's no issue raised about this on the bug tracker, then I would say highly unlikely.
  • Qt installer issue with proxy

    Unsolved
    3
    0 Votes
    3 Posts
    601 Views
    V
    Hi, I'm facing the same problem reported by Gowd. Not even set "Manual proxy configuration" seems to work. Did anyone find a solution at the end? Is it possible to have a KB with URLs to open for a successful installation through proxy?
  • App hangs in QPixmap::fromImage

    Unsolved
    25
    0 Votes
    25 Posts
    7k Views
    X
    There must be some bug in QThreadPool cause QPixmap hangs. Set setExpiryTimeout to -1 may help, just a workaround, not bug fix. QThreadPool *threadPool = QThreadPool::globalInstance(); if (threadPool) { threadPool->setExpiryTimeout(-1); }
  • CMake Creating a library of sub-components

    Unsolved
    2
    0 Votes
    2 Posts
    256 Views
    jsulmJ
    @tapsbrighton said in CMake Creating a library of sub-components: How do I call add_library() in such a case? You put add_library() in each subdirectory. In the main folder you link all these static libs to your big lib using target_link_libraries after calling add_library for the big library. Don't forget to include the subfolders.
  • 0 Votes
    25 Posts
    10k Views
    B
    @jeremy_k Wow, Awesome ! Thanks for your answer and massive props to @VRonin !
  • How to show/hide a whole docking area?

    5
    1 Votes
    5 Posts
    3k Views
    A
    Thanks @RokeJulianLockhart, but I have (hopefully!) just released the latest version of my Qt application (using Qt 5.12 because I wanted to keep on using QtWebKit, among other things) and I am now using new (more modern, IMO) technologies. I did enjoy my Qt journey though, although not some of the decisions the Qt people made these past few years.
  • QAudioBufferOutput Class - audioBufferReceived (for music visualization)

    Solved
    3
    0 Votes
    3 Posts
    299 Views
    SGaistS
    Hi, An additional suggestion: adopt the new connect style using function address rather than the macro based version. You will have compile time error rather than run-time warnings printed in case of an error.
  • QSpinBoxes take too much vertical space if an application-wide style sheet is set

    Unsolved
    3
    0 Votes
    3 Posts
    340 Views
    l3u_L
    Thanks a lot for the quick follow-up! I'll provide this info in the KDE bug. Hopefully, we'll get that fixed soon …
  • HighGUI

    Unsolved
    3
    0 Votes
    3 Posts
    298 Views
    Pl45m4P
    @PVS71 Either embed the native window as Qt Widget in a container as shown by @jsulm in the linked documentation page OR you can simply create a QImage from cv::Mat and show the image data directly through Qt using a QLabel for example. What is the reason for you to want the OCV Image output window?
  • How can I programmatically translate a QTranslator-translated string back to english?

    Unsolved
    4
    0 Votes
    4 Posts
    363 Views
    JonBJ
    @thierryhenry14 said in How can I programmatically translate a QTranslator-translated string back to english?: Now my problem is that the backend expects the configuration settings to be sent in english. So for example, if there's a config combobox with the choices ["Red", "Blue"], the spanish-translated app would show ["Rojo", "Azul"], but if the user selects the 2nd choice and presses OK, I need to send "choice=Blue" over the network. With the proviso that I have not used QTranslator/tr("..."). This specific case is easy. Every library has a way of setting a combobox/dropdown item to have a display string but also a "value", which (if absent) will default to the display string, but can be set separately. For QComboBox the value is a QVariant and can be set in a variety of ways including addItem(const QString &text, const QVariant &userData = QVariant()) and QComboBox::setItemData(int index, const QVariant &value, int role = Qt::UserRole) and retrieved via QVariant QComboBox::itemData(int index, int role = Qt::UserRole) const, or you can do same via the QAbstractItemModel *QComboBox::model() const. Since you know you always need the English word from a Spanish choice you should store the original English word as the value while allowing the translation for the text. This is what @SGaist was referring to in his reply above.
  • Why does recursion appear in QVector?

    Solved
    3
    0 Votes
    3 Posts
    323 Views
    J.HilkJ
    That's surprising, both should show recursive behaviour. Because you modify the nodes wich would trigger a copy of the vector element. ~ Actually std::vector has no implizit sharing, it does the copy directly. Probably the reason why you see different behaviour.
  • Script engine - porting from Qt5 to Qt6 issues

    Unsolved
    2
    0 Votes
    2 Posts
    305 Views
    J
    Hi Yuri, I'm one of the posters you mentioned above. Sadly the solution I eventually went with was to use quickjs as our javascript engine which gives much more control over the java script environment and allowed me to create/control the plumbing around using c++ types within the javascript environment. Sorry i dont have any other help for you.
  • 0 Votes
    1 Posts
    112 Views
    No one has replied
  • Is there a place to do feature requests?

    Unsolved
    3
    0 Votes
    3 Posts
    347 Views
    M
    @ChrisW67 Thanks
  • QNetworkAccessManager cache

    Unsolved
    3
    0 Votes
    3 Posts
    341 Views
    SGaistS
    @jsulm based on the link, I think this was an answer to an old question.