Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.5k Posts
  • Calling KAuth action from another action problem.

    Unsolved
    2
    0 Votes
    2 Posts
    155 Views
    S
    Possible Causes: Missing Permissions: The actionName might not have the required permissions for execution. If the action requires elevated privileges (e.g., root permissions), it may fail if the helper is not running with appropriate privileges. Incorrect Helper Setup: The action.setHelperId(actionHelperId) part in both the caller and helper code needs to be aligned properly. If there is a mismatch in the helper ID or incorrect registration of the helper, the action might fail to execute correctly. Failure in the Helper: If the second-level action fails, it can propagate back to the first-level action and cause it to fail with error code 4. Specifically, the error could occur because the second-level action (kcm.policycomplexity.change) failed. Action Parameters: There may be an issue with the arguments being passed to the actions. You are passing an empty map action.setArguments({}), which might not be what the helper expects. Debugging Steps: Check Helper Permissions: Ensure the action test.helper.change and kcm.policycomplexity.change are properly set up in the polkit (PolicyKit) configuration, and that the appropriate permissions are granted for the user executing the application. Ensure Helper Registration: Verify that the helper (test.helper and kcm.policycomplexity) is correctly registered and accessible. In your case, make sure both helpers are properly registered using KAUTH_HELPER_MAIN. Verbose Logging in Helpers: Add more logging in the helpers to make sure that the second-level action (kcm.policycomplexity.change) is executing as expected. cpp Copy Edit KAuth::ActionReply Helper::change(const QVariantMap &args) { qInfo() << "2 lvl action start"; // Log the args to verify if correct arguments are passed qInfo() << "Arguments received:" << args; qInfo() << "2 lvl action end"; return KAuth::ActionReply::SuccessReply(); } Check Polkit Configuration: Ensure that polkit has the correct rules and that the actions are authorized for the user. You might need to modify the /etc/polkit-1/rules.d/ or /usr/share/polkit-1/actions/ files to allow these actions. Return Error Information: If the second-level action fails, ensure it returns a detailed error message using ActionReply::HelperErrorReply(): cpp Copy Edit if (!job->exec()) { qInfo() << "Error in second-level action"; return ActionReply::HelperErrorReply().setErrorDescription("Second-level action failed"); } Improve Error Handling in the Main Action Caller: Make sure you're capturing detailed error information from the first-level action. This can give insights into where the failure occurs: cpp Copy Edit if (!job->exec()) { qInfo() << "Error at 1st level action"; qInfo() << "Error string:" << job->errorString(); qInfo() << "Error description:" << job->errorText(); qInfo() << "Error code:" << job->error(); qInfo() << "Action name:" << job->action().name(); } What to Do Next: Check Polkit Permissions: Ensure the action and helper have the necessary permissions to execute. You can do this by checking the corresponding polkit rule files and ensuring the action is allowed for your user. Verify Arguments: If the helpers expect certain arguments, make sure you're passing them correctly. More Detailed Logging: Add additional logging in both the main action and helper to capture the flow and identify exactly where the failure occurs. Helper Execution: If you are using root privileges, ensure that the helper is properly set up to be executed with elevated privileges. Ensure Proper Action Execution: If the second-level action fails, the error is propagated back to the first-level action. Use ActionReply::HelperErrorReply() in case of errors in the second-level helper and make sure that the first-level action can catch and handle it.
  • the QWebEngineView signal of loadfinished is not very precise

    Unsolved
    4
    0 Votes
    4 Posts
    333 Views
    JonBJ
    @nicker-player I am afraid I used this years ago, I cannot find any source of mine using it and am hazy as to what I did how. For your case, is the page/HTML you are using in your QWebEngineView constructed by your code or is it an external URL? If it's the former, your own, you can put some JS into it to run on "document ready" JS/jQuery. If it's the latter, an external URL, I am not sure when you can use, say, runJavaScript to inject the JS code. Alternatively, I think you are now encouraged to use QWebChannel in QWebEnginePage to communicate "properly" with the JS and hence the DOM model. This did not yet exist when I did work years ago. An example in Python seems to be https://riverbankcomputing.com/pipermail/pyqt/2015-August/036346.html, there may be other/better ones. The important thing is that uses script.setInjectionPoint(QWebEngineScript.DocumentReady) to install the script to run on the page's "document ready". I am afraid I am not going to be able to give any more precise suggestions that the above.
  • 0 Votes
    3 Posts
    175 Views
    SGaistS
    @kuqipair hi, Taking aside the fact that widget items should be used with caution or rather avoided (for performance reason, etc.), why not switch to a secondary empty QListWidget rather than doing all of that ?
  • QProgressDialog does not take input unless the progress value changes

    Unsolved
    14
    1 Votes
    14 Posts
    972 Views
    S
    @JonB, thank you! It does not happen very often, but this I could write on company time. We need the documentation anyways.
  • QToolButton: weird padding behavior compared to QPushButton

    Unsolved
    7
    0 Votes
    7 Posts
    3k Views
    S
    Well, I face the same problem. Maybe I should subclass the QToolButton.
  • Dialogue vanishes when any button is pressed.

    Solved
    10
    0 Votes
    10 Posts
    453 Views
    Pl45m4P
    @Perdrix said in Dialogue vanishes when any button is pressed.: why would uic put those lines there??? I suspect that Add and Delete button were the buttons that come with a QDialog QtDesigner template... these are connected to the slots by default... to reject and to accept respectively. I think you used these two, renamed and re-designed them while modifying your UI file, while the connection persists. Similar to the "hidden" connect slots by name mechanic, which also might confuse you if one is not aware of that :)
  • How to use .ui file in a QT Custom Designer Widget project?

    Unsolved
    3
    0 Votes
    3 Posts
    183 Views
    Q
    Post content was flagged as spam by Akismet.com why???
  • View model for nested structure with list (QAbstractListModel, QAbstractItemModel)

    Unsolved
    3
    0 Votes
    3 Posts
    255 Views
    S
    Yes, in this case, you need a hierarchical model since a Lesson contains multiple Topics. The QAbstractListModel is not sufficient because it only supports a flat list. Instead, you should use QAbstractItemModel to represent the hierarchical data structure.
  • 0 Votes
    2 Posts
    610 Views
    J
    I've worked around the problem, by directly including the windows headers. Sadly i still have no good explanation for why this wasn't required in 6.5.3, and is required in 6.8.2
  • 0 Votes
    2 Posts
    172 Views
    SGaistS
    Hi and welcome to devnet, Which version of 5.15 are you using ? On which platform ? Based on the comment of the patch, it seems related to High DPI as week which has seen quite a lot of improvement so it might not be possible to backport all of the related work.
  • Menu not showing up in menuBar

    20
    0 Votes
    20 Posts
    29k Views
    enjoysmathE
    Well, there's no more window bar nor app icons on Windows 10
  • [QFileSystemModel] Data not updated after folder renaming

    Unsolved
    4
    0 Votes
    4 Posts
    283 Views
    N
    I'm trying to understand better what's happening: so I try to use directly the QFileSystemWatcher. Supposing the following scenario: Folder A --- Folder B now I add the path Folder A -> Folder B to a QFileSystemWatcher's instance; everything I change within Folder B is correctly notified thanks directoryChange() signal. Now I rename Folder B to Folder BB and I create another Folder B: Folder A --- Folder BB (previous Folder B) --- Folder B Supposing having this capture: connect(&fsWatcher, &QFileSystemWatcher::directoryChanged, this, [&](const lString& path) { std::cout << path; }); if I change something on Folder BB, the value printed is Folder B. This is quite reasonable, because at the beginning I added Folder B to QFileSystemWatcher's instance; however, cause signal notifiy a change just using the string Folder B, it seems that something changes on new Folder B; and this may broke the relation between Qt and real file system status.
  • (.json) file not found

    Solved
    4
    0 Votes
    4 Posts
    308 Views
    M
    ok guys thanks, I will just put the file in a physical location on my device
  • Icons don't appear in projects (Windows)

    Solved
    48
    0 Votes
    48 Posts
    16k Views
    enjoysmathE
    This is fucking ridiculous. How can I add an icon to my Qt Tools for VS project?
  • QFutureWatcher docs mismatch

    Solved
    3
    0 Votes
    3 Posts
    202 Views
    V
    @JonB Thanks a lot, closing.
  • Crash in Qt and unrelated to my code.

    Unsolved
    2
    0 Votes
    2 Posts
    190 Views
    Axel SpoerlA
    Sorry to say, but the issue is in your code, not in Qt. It occurs, when a model is called with a QModelIndex from another model. That can happen either, when there the wrong model is called, or when the index is mal-constructed. Please boil the problem down to a minmal, cmplilable reproducer. Just showing the App architecture is helpful but not sufficient. Please post the minimal reproducer here, using code tags.
  • 0 Votes
    2 Posts
    148 Views
    SGaistS
    Hi, Without knowing which Qt version, which OS, how you set things up, it's pretty much impossible to know what is going on.
  • how to build qmlplugindump with Qt 6.8.1

    Unsolved
    1
    0 Votes
    1 Posts
    93 Views
    No one has replied
  • 0 Votes
    5 Posts
    415 Views
    Tom assoT
    @jeremy_k - thanks for that clarification. I ended up defining runTest() as follows: INVOKABLE QList<QVector2D> TopoDataItem::runTest(void ) { QList<QVector2D> profile; // Add content to profile [...] return profile; } The QML invokes the method as follows: Button { text: qsTr('run test') onPressed: { var profile = topoDataItem.runTest(); // Do stuff with profile data [...] } } This seems to work with my application, without need to register additional stuff with the metatype system.
  • Invoking Qt Assistant

    Unsolved
    3
    0 Votes
    3 Posts
    190 Views
    PerdrixP
    Thanks - gives me something for the little grey cells to ponder.