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. Qt formulary in QGis
Forum Updated to NodeBB v4.3 + New Features

Qt formulary in QGis

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.6k Views 1 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.
  • L Offline
    L Offline
    leahh
    wrote on last edited by
    #1

    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
    0
    • T Offline
      T Offline
      tobias.hunger
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • L Offline
        L Offline
        leahh
        wrote on last edited by
        #3

        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
        0

        • Login

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