Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8876559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:14:27+00:00 2026-06-14T19:14:27+00:00

I’m working on Visual studio (c++) and I’m using Qt along with OpenCV. What

  • 0

I’m working on Visual studio (c++) and I’m using Qt along with OpenCV.
What I want to do is create a window where I can input several values that will be used in an algorithme later. These variables are double and int type.
I’ve looked at the Qt doc and on the internet but I didn’t find a proper way to do so. I’m also not looking for a dialog box to pop up and ask the user to input values, just a window with several fields to type my values and update them.
Any help would be appreciated, thanks

EDIT:
I’m now using a QDoubleSpinBox to input a double value and a button to update and print the value in a console.
I’ve created a class for my button to be able to use custom SLOTS in main.h :

class MyButton : public QWidget
{
    Q_OBJECT

public:
    MyButton();

public slots:
    void updateValue(QDoubleSpinBox* input);
};  

And this is the main.cpp:

#include "main.h"

#include <QtGui>

#include <iostream>

using namespace std;

double value;

MyButton::MyButton() : QWidget()
{
    QPushButton *update = new QPushButton("update",this);
    connect(update, SIGNAL(clicked()), this, SLOT(updateValue(QDoubleSpinBox)));
}

void MyButton::updateValue(QDoubleSpinBox *input)
{
    input->update();
    value = input->value(); 
    cout<<value;
}  

Now I’m not sure what to write in the ‘main’ function to use that to create the button. Here is my ‘main’ function so far:

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QWidget window;

    QDoubleSpinBox *input = new QDoubleSpinBox();
    input->setValue(5.00);

    QVBoxLayout *vbox1 = new QVBoxLayout;
    vbox1->addWidget(input);

    window.setLayout(vbox1);
    window.resize(800,600);
    window.show();
    window.setWindowTitle(QApplication::translate("toplevel", "Top-level widget"));
    return app.exec();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T19:14:28+00:00Added an answer on June 14, 2026 at 7:14 pm

    To solve your task you should know the following topics:
    1. which widgets can be used to get input from a user(most of them were already stated);
    2. SIGNALS & SLOTS in Qt (using them you can assign values which were provided to a widget to your variables).

    As that topics are rather volumable I advice you to refer to Qt documentation (use Qt assistant for example), as now you know for what information to search it will be easier for you to solve you task

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want to count how many characters a certain string has in PHP, but
I am reading a book about Javascript and jQuery and using one of the
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.