Skip to content
  • 0 Votes
    18 Posts
    734 Views
    S

    @StudentScripter said in Save Programm Settings internally + how to organize with folders?:

    QString filePath = "/path/to/your/settings.ini";

    If you want to use an ini file, please use QStandardPath with ConfigLocation and don't invent your own place where to put the ini file.

  • 0 Votes
    2 Posts
    221 Views
    R

    @Richard-Buchmann I guess I put this issue in the wrong place. I send a bug report there : https://bugreports.qt.io/browse/QTBUG-116681

  • 0 Votes
    4 Posts
    865 Views
    F

    I just gave a example.You should read what is binding loop.It clearly says you have a binding loop.
    settings.extendExportFile is bound to textfieldId.text
    textfieldId.text is bound to settings.extendExportFile
    Whenever settings.extendExportFile changes which trigger a signal to change textfieldId.text and in turn this trigger a signal to change settings.extendExportFile.This will be happening in a loop, which is known as binding loop.

  • 0 Votes
    1 Posts
    326 Views
    No one has replied
  • 0 Votes
    4 Posts
    399 Views
    Christian EhrlicherC

    When you don't want to let save it by Qt you have to read the font attributes one by one from your ini file and then construct it with the QFont ctor

  • 0 Votes
    9 Posts
    1k Views
    MohammadsmM

    @J-Hilk
    I managed the required behavior, somehow.

    By blanking the key value:

    stg.setValue("step_1", "")

    then scanning the keys, which have non-empty value, and skipping the empty ones.

    I'll file a bug, cause I think it's a needed method!
    By the way, thank you all

  • 0 Votes
    3 Posts
    1k Views
    aha_1980A

    @iwlf As @LeLev said, the pro.user cannot be shared and should not be checked into version control systems.

  • Managing Settings

    Unsolved QML and Qt Quick
    7
    0 Votes
    7 Posts
    2k Views
    L

    So, after some looking around and experimenting, this is what I got.

    The singleton is used to collect all settings. This is where a c++ backend will be used to actually store the settings an disk, probably using QSettings. Through this it will (probably) be possible to config the settings (format, path, file name, stuff like that).

    MySingleton.qml

    pragma Singleton import QtQuick 2.0 Item { // holding all settings as key-value pairs property var dataMap : ({}) // list to filter out all the inherited base properties property var filterObject : { "x":"", "y":"", "z":"", "width":"", "height":"",....... } }

    This element is the base for the settings elements. It's purpose is to sync to the singleton, writing the settings to the dataMap and, if they already exist, read on startup (the reading is missing atm). For this it will perform reading and writing on construction and destruction and (later) provide signals and slots for this.
    MySettings .qml

    import QtQuick 2.11 import QtQml 2.11 Item{ id:base Component.onCompleted: { console.log("Settings Created") for(var prop in this){ if(!MySingleton.filterObject.hasOwnProperty(prop) && typeof this[prop] !=="function" ) { MySingleton.dataMap[prop] = this[prop]; var component = Qt.createComponent("BidirecionalBinding.qml"); if (component.status === Component.Ready) { var binding = component.createObject(this, {"first": this, "second": MySingleton.dataMap, "firstProperty": prop, "secondProperty": prop} ); console.log() } } } } Component.onDestruction: { console.log("Destructing Settings") for(var prop in this){ if(!MySingleton.filterObject.hasOwnProperty(prop) && typeof this[prop] !=="function" ) console.log(prop + "(" + typeof this[prop] +"): " + this[prop]) } console.log(JSON.stringify(MySingleton.dataMap)) } }

    The BidirectionBinding uses two Binding elements to make one bidirectional binding. I tested it using two buttons and bound the labels, worked without problem. It's intention is to keep the map and the settings elements properties in sync.

    BidirectionBinding.qml

    import QtQuick 2.11 import QtQuick.Controls 2.4 import QtQml 2.11 Item { id:bidirectionalBinding property alias first: firstBinding.target property alias second: secondBinding.target property alias firstProperty: firstBinding.property property alias secondProperty: secondBinding.property property bool delayed: true property alias firstWhen: firstBinding.when property alias secondWhen: secondBinding.when property alias firstValue: firstBinding.value property alias secondValue: secondBinding.value Binding { id: firstBinding; when: true; delayed: bidirectionalBinding.delayed; value: second[secondProperty] } Binding { id: secondBinding; when: true; delayed: bidirectionalBinding.delayed; value: first[firstProperty] } }

    The last file it the main file. This is for testing and demonstation. Its just four buttons for printing and changing the values.

    main.qml

    import QtQuick 2.11 import QtQuick.Window 2.11 Window { id: window title: "Hello Settings" visible: true width: 280 height: 250 property MySettings settings: MySettings{ id: settings property alias windowTitle: window.title property alias rectWidth: rect.width } Rectangle { id: rect width: 80;height: 50;x: 50;y: 50;color: 'green' Text { text: "Set Title" anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter } MouseArea { anchors.fill: parent onClicked: window.title = "Hello New Title" } } Rectangle { width: 80;height: 50;x: 150;y: 50;color: 'green' Text { text: "Set Alias" anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter } MouseArea { anchors.fill: parent onClicked: settings.windowTitle = "Hello New Alias" } } Rectangle { width: 80;height: 50;x: 50;y: 150;color: 'green' Text { text: "Set Map" anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter } MouseArea { anchors.fill: parent onClicked: MySingleton.dataMap["windowTitle"] = "Hello New Setting" } } Rectangle { width: 80;height: 50;x: 150;y: 150;color: 'green' Text { text: "Print" anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter } MouseArea { anchors.fill: parent onClicked: { console.log(settings.windowTitle) console.log(JSON.stringify(MySingleton.dataMap)) console.log() } } } }

    Thats it so far. The advantage of this approach is, that it can be used like the Settings element from Qt. Also, it can easily be added to existing code later, the original code won't have to be changed (most likely).

    The problem right know, aside from missing things like the backend, are the bidirectional bindings. I get the error

    qrc:/BidirecionalBinding.qml:21: TypeError: Cannot read property 'rectWidth' of null
    qrc:/BidirecionalBinding.qml:21: TypeError: Cannot read property 'windowTitle' of null

    (line 21 is where the first Binding is declared)

    What do you think about this so far?

  • 0 Votes
    2 Posts
    2k Views
    mrjjM

    Hi
    Is that in the Installer this licenses shows or in Creator ?
    also did you read
    http://doc.qt.io/qt-5/androidgs.html

  • 0 Votes
    9 Posts
    9k Views
    M

    That's it @Eeli-K
    Thanks a lot

  • 0 Votes
    6 Posts
    8k Views
    SGaistS

    You're welcome !

    Since you have it working now, please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :)

  • 0 Votes
    9 Posts
    16k Views
    K

    @holzkohlengrill said:

    I am using Windows 7 and Ubuntu 16.04 .
    I am guessing the QtCreator.ini-file is the one which contains all the settings (please correct me if I am wrong).

    Most of the settings you are correct. However, you might want to check also the xmls in the subfolder.

    The problem here seems that absolute paths are used so it probably would crash Qt Creator if I just copy and paste it. Any ideas?

    Besides writing your own app, no.

    I just wonder why does not someone else have the same desire to export the IDE settings.

    Probably is the forum the wrong place. You may want to check on the development mailing list.

  • 0 Votes
    4 Posts
    1k Views
    SGaistS

    Hi,

    Looks like you are trying to use a Ui_otherPage without setting it up.

    Why not use the widget you created with it ?

  • 0 Votes
    4 Posts
    6k Views
    T

    alas no luck - so far still the only option is to use command line parameters to your own app - and yes every single embedded web engine sub-process will reuse the same parameters (no luck with different proxy per tab problem)
    e.g. if you try
    MyApp.exe --proxy-server=host:port
    and your app opens 10 tabs the same proxy it will be reused by every single tab/or browser/or sub-process/
    pretty much the same as setting global proxy (at application level)

    https://bugreports.qt.io/browse/QTBUG-59490

    BTW: if they implement the above they need to decide which has higher priority - global app level proxy or per web engine sub-process

  • 0 Votes
    4 Posts
    2k Views
    SGaistS

    Depending on what you want to keep between all PCs then you indeed need to use a similar setup.

  • 0 Votes
    3 Posts
    5k Views
    U

    @GoranShekerov
    Tried the above code to stop and remove the windows service while uninstalling from QT installer. But did not work

    function Controller()
    {
    installer.uninstallationStarted.connect(onUninstallationStarted);
    }

    onUninstallationStarted = function()
    {
    if (installer.isUninstaller()) {
    installer.performOperation("Execute", "@TargetDir@/platform/tools/Server/testServer.exe", "stop");
    console.log("Server stopped")
    installer.performOperation("Execute", "@TargetDir@/platform/tools/Server/testServer.exe", "remove");
    console.log("Server removed")
    }
    }

  • 0 Votes
    8 Posts
    4k Views
    mmirskyM

    For future reference, the bug I logged was marked as a duplicate.

    Here is the link to the original, QTBUG-43454.

  • 0 Votes
    4 Posts
    19k Views
    SGaistS

    So you already tested the Edit->Advanced possibilities ?