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. Accept user input using Spinbox

Accept user input using Spinbox

Scheduled Pinned Locked Moved Mobile and Embedded
2 Posts 2 Posters 1.0k 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.
  • R Offline
    R Offline
    Ramon
    wrote on last edited by
    #1

    Hi,
    I'm developing an application which consists of a Spinbox, Push_button and lineEdit.

    The user has to enter an integer value between 3 and 50 using the Spinbox and press the Push_button. When the Push_button is pressed, QT calls a C code and passes to it as argument the value in Spinbox. Once the C code has run, the result gets displayed in lineEdit.

    Query:
    How should I configure Push_button so as to capture the value in Spinbox? Right clicking Spinbox > 'Go to slot' shows signals such as Valuechanged(int) and (string). Is that the way to go?

    Please help.

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      You need to connect the pushbutton clicked() signal with your slot

      @connect(button,SIGNAL(clicked()),&w,SLOT(myslot()));

      void MyWidget::myslot() {
      int val = spinBox->value().
      }@

      I suggest you read the signal and slots of pushbutton. Look at how to write slots.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      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