Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How to take values from QComboBox which is in ui of another class into my mainwindow.cpp class?
Forum Updated to NodeBB v4.3 + New Features

How to take values from QComboBox which is in ui of another class into my mainwindow.cpp class?

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
3 Posts 2 Posters 750 Views
  • 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.
  • K Offline
    K Offline
    kishore_hemmady
    wrote on last edited by
    #1

    I have a button in mainwindow ui when clicked a new window with combobox opens.When user selects a option in the ui of this new window and presses OK i should get this value in mainwindow.cpp.How do I do this? please suggest

    jsulmJ 1 Reply Last reply
    0
    • K kishore_hemmady

      I have a button in mainwindow ui when clicked a new window with combobox opens.When user selects a option in the ui of this new window and presses OK i should get this value in mainwindow.cpp.How do I do this? please suggest

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @kishore_hemmady Simply add a getter method which returns the selected value, then call this getter in your main window:

      SomeDialog dialog(this);
      dialog.exec();
      auto value = dialog.selectedValue();
      

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      K 1 Reply Last reply
      1
      • jsulmJ jsulm

        @kishore_hemmady Simply add a getter method which returns the selected value, then call this getter in your main window:

        SomeDialog dialog(this);
        dialog.exec();
        auto value = dialog.selectedValue();
        
        K Offline
        K Offline
        kishore_hemmady
        wrote on last edited by
        #3

        @jsulm Thanks I'll try and let you know

        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