Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] qcombobox and clear()
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] qcombobox and clear()

Scheduled Pinned Locked Moved General and Desktop
27 Posts 10 Posters 39.0k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    andre
    wrote on last edited by
    #18

    QDevelop is not the same as QtCreator. And it is not a popup, it is part of the debug mode in that program.

    Try this, on the commandline:

    gdb path/to/your/executable

    let your application crash, and then, still on the gdb prompt:

    bt

    That should give you your stack/back trace.

    1 Reply Last reply
    0
    • X Offline
      X Offline
      xeroblast
      wrote on last edited by
      #19

      im sorry but the gdb /path/to/exe is not working. no program running..

      Reading symbols from /home/edril/Documents/Desktop Projects/EquiApps/bin/EquiApps...done.
      (gdb)

      cursor is always blinking..

      1 Reply Last reply
      0
      • X Offline
        X Offline
        xeroblast
        wrote on last edited by
        #20

        i found the problem...

        i disconnect first the signal in the dropdownProduct before using the clear().

        @
        void AddItemPurchaseOrderImpl::changeCategory(QString val)
        {
        disconnect(dropdownProduct, SIGNAL(currentIndexChanged(QString)), this, SLOT(changeProduct(QString)));
        bool firstrun = true;
        dropdownProduct->clear();
        if (val == "New Category") {
        dropdownCategory->setEditable(true);
        } else {
        dropdownCategory->setEditable(false);
        QSqlDatabase db = dbaseAddItemPO.dbConnect();
        QVector<QMap<QString, QString> > products;
        if (val == "Uncategorized") {
        products = dbaseAddItemPO.getData("SELECT id, product_name FROM products WHERE category_id IS NULL");
        } else {
        QVector<QMap<QString, QString> > category = dbaseAddItemPO.getData("SELECT id FROM category WHERE category_name='" + val + "'");
        products = dbaseAddItemPO.getData("SELECT id, product_name FROM products WHERE category_id='" + category[0].value("id") + "'");
        }
        if (products.size() != 0) {
        for (int i=0; i < products.size(); i++) {
        dropdownProduct->addItem(products[i].value("product_name"));
        if (firstrun) {
        QVector<QMap<QString, QString> > brands = dbaseAddItemPO.getData("SELECT brand_name FROM product_details WHERE products_id='" + products[i].value("id") + "'");
        if (brands.size() != 0) {
        for (int j=0; j < brands.size(); j++) {
        dropdownBrand->addItem(brands[i].value("brand_name"));
        }
        }
        firstrun = false;
        }
        }
        }
        dropdownProduct->addItem("New Product");
        db.close();
        }
        dbaseAddItemPO.dbRemove();
        connect(dropdownProduct, SIGNAL(currentIndexChanged(QString)), this, SLOT(changeProduct(QString)));
        }
        @

        and reconnect it at the end.
        thanx to all your replies..

        1 Reply Last reply
        1
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #21

          Glad that you found the problem, but I would really like to advice you to learn some basic debugging skills. Problems of finding why an application crashes are something every developer will have to diagnose, sooner or later. Getting and reading & understanding a backtrace is a basic tool to fix those.

          1 Reply Last reply
          0
          • F fcrochik

            I would venture a guess that the error is not on these lines of code.

            Most likely is something that you doing somewhere else while processing signals that get triggered by adding/removing items. For example you may have code to process when the selected item changes on the combo - clearing the combo and adding new items will probably trigger that.

            rohit713R Offline
            rohit713R Offline
            rohit713
            wrote on last edited by
            #22

            @fcrochik said in [SOLVED] qcombobox and clear():

            I would venture a guess that the error is not on these lines of code.

            Most likely is something that you doing somewhere else while processing signals that get triggered by adding/removing items. For example you may have code to process when the selected item changes on the combo - clearing the combo and adding new items will probably trigger that.

            Yes you are right. I also facing the same problem.

            mrjjM 1 Reply Last reply
            0
            • rohit713R rohit713

              @fcrochik said in [SOLVED] qcombobox and clear():

              I would venture a guess that the error is not on these lines of code.

              Most likely is something that you doing somewhere else while processing signals that get triggered by adding/removing items. For example you may have code to process when the selected item changes on the combo - clearing the combo and adding new items will probably trigger that.

              Yes you are right. I also facing the same problem.

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #23

              @rohit713
              The debugger is your friend in that case.

              rohit713R 1 Reply Last reply
              3
              • mrjjM mrjj

                @rohit713
                The debugger is your friend in that case.

                rohit713R Offline
                rohit713R Offline
                rohit713
                wrote on last edited by
                #24

                @mrjj
                Yes I disconnect the signal and after clearing the combobox I connect the signal again, now problem is solved by doing so.

                1 Reply Last reply
                2
                • F fcrochik

                  I would venture a guess that the error is not on these lines of code.

                  Most likely is something that you doing somewhere else while processing signals that get triggered by adding/removing items. For example you may have code to process when the selected item changes on the combo - clearing the combo and adding new items will probably trigger that.

                  B Offline
                  B Offline
                  BrainabilGH
                  wrote on last edited by
                  #25
                  This post is deleted!
                  1 Reply Last reply
                  0
                  • F fcrochik

                    I would venture a guess that the error is not on these lines of code.

                    Most likely is something that you doing somewhere else while processing signals that get triggered by adding/removing items. For example you may have code to process when the selected item changes on the combo - clearing the combo and adding new items will probably trigger that.

                    E Offline
                    E Offline
                    emad22552
                    wrote on last edited by
                    #26

                    @fcrochik thanks, you saved me!

                    1 Reply Last reply
                    0
                    • H Offline
                      H Offline
                      Higi
                      Banned
                      wrote on last edited by
                      #27
                      This post is deleted!
                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved