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. Connect QSpinBox with QTimer
Qt 6.11 is out! See what's new in the release blog

Connect QSpinBox with QTimer

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 1.4k 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.
  • F Offline
    F Offline
    franad
    wrote on last edited by
    #1

    Hey everyone,
    I think my Problem is a pretty small one for most of you, but I don't get any solution yet, it's my first Qt Programm.

    What I want to do:
    In Qt Designer I added a QSpinBox. The user can choose a value between 1 and 10. This value should get connected to a QTimer, so that I get something like

    timer->start(Value of the QSpinBox)

    Any Tipps or Solution? Thanks a lot!

    Screenshot::Screenshot(QWidget *parent) :
        QMainWindow(parent),
        ui(new Ui::Screenshot)
    {
        ui->setupUi(this);
        
    
        timer = new QTimer(this);
        connect(timer, SIGNAL(timeout()), this, SLOT(timerSlot()));
    
        connect(ui->spinBox, SIGNAL(valueChanged(int value)), this, SLOT(spinBoxSlot(int value)));
    
    }
    
    Screenshot::~Screenshot()
    {
        delete ui;
    }
    void Screenshot::IntervallSpinBox()
    {
        timer->start(int value);
    }
    
    mrjjM 1 Reply Last reply
    0
    • F franad

      Hey everyone,
      I think my Problem is a pretty small one for most of you, but I don't get any solution yet, it's my first Qt Programm.

      What I want to do:
      In Qt Designer I added a QSpinBox. The user can choose a value between 1 and 10. This value should get connected to a QTimer, so that I get something like

      timer->start(Value of the QSpinBox)

      Any Tipps or Solution? Thanks a lot!

      Screenshot::Screenshot(QWidget *parent) :
          QMainWindow(parent),
          ui(new Ui::Screenshot)
      {
          ui->setupUi(this);
          
      
          timer = new QTimer(this);
          connect(timer, SIGNAL(timeout()), this, SLOT(timerSlot()));
      
          connect(ui->spinBox, SIGNAL(valueChanged(int value)), this, SLOT(spinBoxSlot(int value)));
      
      }
      
      Screenshot::~Screenshot()
      {
          delete ui;
      }
      void Screenshot::IntervallSpinBox()
      {
          timer->start(int value);
      }
      
      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi

      connect without using parameter name, just type
      connect(ui->spinBox, SIGNAL(valueChanged(int )), this, SLOT(spinBoxSlot(int )));
      
      and use the value in slot
      void Screenshot::IntervallSpinBox(int value)
      {
          timer->start(value);
      }
      
      1 Reply Last reply
      4
      • F Offline
        F Offline
        franad
        wrote on last edited by
        #3

        Thanks a lot! That helped me out!

        aha_1980A 1 Reply Last reply
        0
        • F franad

          Thanks a lot! That helped me out!

          aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on last edited by
          #4

          hi @franad,

          if your problem is solved, please mark this topic as such. Thanks!

          Qt has to stay free or it will die.

          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