Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.4k Posts
  • Windows 10x64 debug not printing to Application output qtCreator

    Unsolved qtcreator
    1
    0 Votes
    1 Posts
    248 Views
    No one has replied
  • Detect power change event / UPS state

    Unsolved
    10
    0 Votes
    10 Posts
    2k Views
    Cobra91151C
    I have found that I need to use the HID API to get some values for the UPS. Updated code: QString devicePath = "\\\\?\\HID#VID_...."; HANDLE fileHandle = CreateFileA(devicePath.toStdString().c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL); if (fileHandle != INVALID_HANDLE_VALUE) { std::cout << "Success. Device opened for reading..." << std::endl; PHIDP_PREPARSED_DATA preparsedData; HIDP_CAPS capabilities; HIDD_ATTRIBUTES attributes; BOOL hidPreparsedRes = HidD_GetPreparsedData(fileHandle, &preparsedData); if (hidPreparsedRes) { if (HidD_GetAttributes(fileHandle, &attributes)) { std::cout << "Product ID: " << attributes.ProductID << std::endl; std::cout << "Size: " << attributes.Size << std::endl; std::cout << "Vendor ID: " << attributes.VendorID << std::endl; std::cout << "Version number: " << attributes.VersionNumber << std::endl; if (HidP_GetCaps(preparsedData, &capabilities) == HIDP_STATUS_SUCCESS) { std::cout << "Caps: " << capabilities.NumberOutputValueCaps << std::endl; } else { std::cout << "Failed to return HID capabilities!" << std::endl; } } else { std::cout << "Failed to get HID attributes" << std::endl; } std::cout << getLastErrorAsString() << std::endl; } else { std::cout << "Failed to get preparsed data!" << std::endl; } HidD_FreePreparsedData(preparsedData); } else { std::cout << "Failed to open device for reading!" << std::endl; } CloseHandle(fileHandle); So now, it returns: Success. Device opened for reading... Product ID: 20833 Size: 12 Vendor ID: 1637 Version number: 2 Caps: 1 HIDP_CAPS structure has a lot of different values, the question is how to convert them to UPS values to check for power changes/UPS status? Thanks.
  • How to learn SQLite with Qt?

    Solved database sqlite
    7
    0 Votes
    7 Posts
    2k Views
    A
    A key is a single or combination of multiple fields in a table. Its is used to fetch or retrieve records/data-rows from data table according to the condition/requirement. Keys are also used to create relationship among different database tables or views. [https://www.welookups.com/sql/default.html ](https://www.welookups.com/sql/default.html )
  • 0 Votes
    3 Posts
    535 Views
    D
    @Christian-Ehrlicher Thank you.
  • Initialize QOpenGLWidget without showing ?

    Unsolved qopenglwidget
    4
    0 Votes
    4 Posts
    846 Views
    SGaistS
    What kind of data are these ?
  • g++: error: /lib64/libGL.so: No such file or directory

    Unsolved
    7
    0 Votes
    7 Posts
    2k Views
    WotanW
    Well, for me, I have created a symbolic link to my library: # ln -s /usr/lib/x86_64-linux-gnu/libGL.so /lib64/libGL.so I am not sure that this is the smartest way to solve it, but it worked ! Tell me, if it works for you or if you have found something else ...
  • g++: error: /lib64/libGL.so: No such file or directory

    Solved
    5
    0 Votes
    5 Posts
    3k Views
    WotanW
    OK, so finally to solve my problem, I have created a symbolic link to my library: # ln -s /usr/lib/x86_64-linux-gnu/libGL.so /lib64/libGL.so I am not sure that this is the smartest way to solve it, but it worked !
  • QTextDocument: overlay multiple items on the same cursor position

    Unsolved
    1
    0 Votes
    1 Posts
    152 Views
    No one has replied
  • For Each problem

    Solved
    4
    0 Votes
    4 Posts
    464 Views
    mrjjM
    Hi update. he needed a break; to exit loop once a match was found.
  • 0 Votes
    18 Posts
    4k Views
    mrjjM
    @Christian-Ehrlicher https://bugreports.qt.io/browse/QTBUG-73465 Please let me know if i need to change something.
  • How to trigger QMenuBar shortcuts from a child window

    Unsolved
    2
    0 Votes
    2 Posts
    569 Views
    mrjjM
    Hi I cant promise its the "right way" but fast test showed it did work fine. we use a QShortcut with setContext(Qt::ApplicationShortcut); to allow triggering the action even then the QOpenGLWindow has focus. // this function replaces the QKeySequence with a // QShortcut that can application wise be activated. void MainWindow::MakeGlobal( QAction *theAction ) { // get actions key QKeySequence keys = theAction->shortcut(); //make new QShortcut *shortcut = new QShortcut( keys, this); // flag it as a global one shortcut->setContext(Qt::ApplicationShortcut); // let global trigger the action QObject::connect(shortcut, &QShortcut::activated, theAction, &QAction::trigger); } // test use. void MainWindow::on_pushButton_2_released() { MakeGlobal(ui->actionfire); // replace QOpenGLWidget *w = new QOpenGLWidget(); w->show(); } having the QOpenGLWidget active and in front, still triggered the slot for the QMenu/action in Mainwindow. Hope it can work for your use case too. Note. if i call MakeGlobal(ui->actionfire); from MainWindow constructor i get a warning. "QAction::event: Ambiguous shortcut overload: Ctrl+F" (which is correct ! :) and it wont trigger. However, doing it just before showing other window, its does work (also for main window) as long as other window is open. I think for a full solution, you must store the QKeySequence pr action and and clear the QKeySequence on the action when you MakeGlobal ( to avoid Ambiguous shortcut ) and then when QOpenGLWindow closes, restore them back. else there might be side effects. Such as when you close other window again, then it stops working. However, this solution suffer one thing as i can see. While other Windows is open, mainwindow wont show the shortcut key on the menus. If that is not acceptable, you should just ignore this post. :) Disclaimer. just proof of concept code. needs more love to fully work.
  • Custom push-button with text and icon

    Unsolved
    8
    0 Votes
    8 Posts
    4k Views
    mrjjM
    @peter-70 ah, ok, its just not clicked you need. well if overlay concept works, then should be fine. I understand you cannot post full code. One should not take intellectual property lightly.
  • Implementing Thread Safe logging in my Qt Application

    Unsolved
    14
    0 Votes
    14 Posts
    3k Views
    A
    @aha_1980 Thanks. I'll give the qt5 installation one more try.
  • This topic is deleted!

    Unsolved
    8
    0 Votes
    8 Posts
    192 Views
  • Error in declaration within accessors

    Solved
    8
    0 Votes
    8 Posts
    808 Views
    T
    @aha_1980 said in Error in declaration within accessors: Thanks. The problem is, you get help here, but that will not help anyone later once the picture is no longer available. Sorry: Also, I'm having a hard time reading this on my phone right now. I will type next onwards.
  • QT creator failing to launch

    Unsolved
    3
    0 Votes
    3 Posts
    352 Views
    aha_1980A
    @taylopa and I am having the same problems with a failure to launch the IDE from both the search bar and terminal. And the answer is the same: not possible. Use a newer Ubuntu (or an older Creator), please
  • the mac app when deploy UI is different from the same mac app when debug UI

    Unsolved
    2
    0 Votes
    2 Posts
    274 Views
    K
    @Princein said in the mac app when deploy UI is different from the same mac app when debug UI: https://github.com/iOSPrincekin/Qt/blob/master/QA/8.png Are you setting the default style for you app before you do any styling yourself. The fusion style is a good one to use on any platform.
  • Text search in a Qt WebAssembly app running in the browser

    Unsolved webassembly browser roadmap
    1
    0 Votes
    1 Posts
    384 Views
    No one has replied
  • dylib issues with multiple Qt versions installed

    Unsolved
    4
    0 Votes
    4 Posts
    632 Views
    SGaistS
    You can use macdeployqt before starting it from the command line.
  • CMAKE_CXX_COMPILER incorrectly set to C Compiler in Qt Creator

    Unsolved
    2
    0 Votes
    2 Posts
    1k Views
    SGaistS
    Hi, Pretty intriguing... Can you provide a minimal compilable example that triggers this ? Also, did you already check the bug report system for something similar ?