Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Code worked before, updated Qt and doesn't now :c [SOLVED]

Code worked before, updated Qt and doesn't now :c [SOLVED]

Scheduled Pinned Locked Moved Installation and Deployment
3 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.
  • M Offline
    M Offline
    mukiatro
    wrote on last edited by
    #1

    To give a bit of explanation:
    The program should link a spinbox and a slider so that as you change the value of one it would alter the value of the other; so at all times these would have the same value. This worked perfectly fine before but after updating it stopped working, here is my code:
    @#include <QApplication>
    #include <QHBoxLayout>
    #include <QSlider>
    #include <QSpinBox>

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

    QWidget *mainWindow = new QWidget;
    mainWindow->setWindowTitle("How many chicken wings?");
    
    QSpinBox *spinner = new QSpinBox;
    QSlider *slider = new QSlider(Qt::Horizontal);
    spinner->setRange(1,50);
    slider->setRange(1,50);
    QObject::connect(spinner, SIGNAL(valueChange(int)), slider, SLOT(setValue(int)));
    QObject::connect(slider, SIGNAL(valueChange(int)), spinner, SLOT(setValue(int)));
    spinner->setValue(10);
    
    QHBoxLayout *layout = new QHBoxLayout;
    layout->addWidget(slider);
    layout->addWidget(spinner);
    mainWindow->setLayout(layout);
    mainWindow->show();
    
    return a.exec(&#41;;
    

    }
    @

    Any help would be much appreciated.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      martonmiklos
      wrote on last edited by
      #2

      The QSpinBox SIGNAL is not valueChange(int), but valueChanged(int)

      After changing that it works fine with Qt 5.1.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mukiatro
        wrote on last edited by
        #3

        Oh wow, that was a simple mistake; thanks!

        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