Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Qt formulary in QGis

    General and Desktop
    2
    3
    1390
    Loading More Posts
    • 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.
    • L
      leahh last edited by

      Hello,
      I’m new to Qt so sorry if the question is basic!
      I did a formulary with qt designer, and after I change a little bit the code (the .h and the .cpp) because I want a formulary with two ComboBox relationated. I mean depending on the choice in the first ComboBox the choice list in the second one change.
      My formulary work in Qt, when I test it all is OK but when I try to use it in QGIS it doesn’t works: choice in the second ComboBox never appears. My columns in the QGIS table have the same name as the ComboBox.
      Can you help me?
      Thanks and sorry for my (terrible) English!

      Léa

      1 Reply Last reply Reply Quote 0
      • T
        tobias.hunger last edited by

        Do you have some code? Without code it is really hard to guess what might be going wrong.

        1 Reply Last reply Reply Quote 0
        • L
          leahh last edited by

          Ok,
          this is for example my .h
          @
          #include "mainwindow.h"
          #include "ui_mainwindow.h"

          MainWindow::MainWindow(QWidget *parent) :
          QMainWindow(parent),
          ui(new Ui::MainWindow)
          {
          ui->setupUi(this);
          connect(ui->comboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(changeLinkedComboBox(QString)));

          //init linkedComboBox avec la valeur A de comboBox
          changeLinkedComboBox(ui->comboBox->currentText());
          

          }

          MainWindow::~MainWindow()
          {
          delete ui;
          }

          void MainWindow::changeLinkedComboBox(QString text)
          {
          ui->linkedComb->clear();
          QStringList listItems;
          if (text == QString("A"))
          listItems << "a1" << "a2";
          else
          listItems << "b1" << "b2";

          ui->linkedComb->addItems(listItems);
          

          }

          @

          I thik QGIS only read the .ui and note the .h and .cpp at the same time right?

          Edit: please use @ tags around code sections; Andre

          1 Reply Last reply Reply Quote 0
          • First post
            Last post