Skip to content
  • 0 Votes
    1 Posts
    783 Views
    No one has replied
  • 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

  • 1 Votes
    2 Posts
    354 Views
    jsulmJ

    @lshiren Hi!
    It would be better to post this answer in the original thread instead of opening a new one.

  • 0 Votes
    7 Posts
    2k Views
    mrjjM

    @AdrianCruz
    hi
    Super :)
    just as a note
    To avoid getting possible NULLs in the list, i would suggest doing

    QGraphicsItem *item = qgraphicsitem_cast<QGraphicsItem*>(text); if (item) list.push_back(item);
  • 0 Votes
    7 Posts
    9k Views
    F

    @Ratzz
    Did you use a relative path. And I've solved another way thanks

  • 0 Votes
    3 Posts
    2k Views
    M

    @Olivier-Ronat Thanks for checking, Olivier. Sorry to detain you to do that when I found it was my own fault. However, I learned some things and got a little better at debugging in Qt Creator.

    I found the cause. I had a signal attached to the selectionModel of each row. Here's how I found out (note, I'm a newbie). On my Mac, I got the crash report and clicked a button to see what it was. This showed a callstack. I was able to see that it was complaining about setting text() from on_SelRow, and then I recalled that I had a signal connected on rows. So, I changed my code like so:

    ui->myTable->selectionModel()->disconnect(); ui->myTable->model()->removeRows(0,ui->myTable->rowCount());

    I was then able to remove rows without a crash. I just need to remember to add the signal back to the table when I add rows again.

    P.S.

    You may also be wondering why I was intercepting a selected row. The reason was because then I could show a box above the table that showed the item detail in an easier to read format than having to scroll horizontally in the table to see all the columns. I was doing it like so:

    connect(ui->myTable->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), this, SLOT(on_SelRow(QModelIndex,QModelIndex)));

    ...and then I had a class method like so:

    void MainWindow::on_SelRow(QModelIndex oCurrRow, QModelIndex oPrevRow) { QTableWidget *t = dynamic_cast<QTableWidget *>(QObject::sender()->parent()); int y = oCurrRow.row(); // do something with t (table) and y (row index) variables }
  • 0 Votes
    6 Posts
    2k Views
    J

    To be precise: click the gear, choose 'Edit' en put the string [Solved] in front of the title of your post

  • QVector remove behaviour

    Solved General and Desktop
    3
    1 Votes
    3 Posts
    5k Views
    mrjjM

    Hi

    When you insert pointers in Qvector, all it ever will delete is the pointer as it would be unsafe for it to delete the object pointed too as it is outside the vector.

    If you declare it as not pointer

    QVector<SellInfo>

    Then the SellInfo struct lives in the vector and will be deleted when QVec is.

    Deleting a SellInfo would never delete "box" as it will not call box destructor.
    (its a pointer)

    A good rule is that you bring into the world with new, should be removed with delete.

    But in Qt, many of the Wigets takes ownership of childs and you do not need to call delete on them.

  • 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")
    }
    }