Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
What I'm trying to do, is when on scroll area is moved, another scroll area moves by the same amount. Is this possible?
Thanks in advance
Yes you can do something like
connect(view1->horizontalScrollBar(), SIGNAL(valueChanged(int)), view2->horizontalScrollBar(), SLOT(setValue(int))); connect(view2->horizontalScrollBar(), SIGNAL(valueChanged(int)), view1->horizontalScrollBar(), SLOT(setValue(int)));
Hi, i've implemented that and I'm sure that will work. But i seem to have a problem when compiling. I have added this in my widget.cpp file and and gives me an error message saying 'No matching member function for call 'connect''.
its hard to guess on without the code.
Could be one of the parameters or that it's not inside a QObject based
Hi this is the code. I've noticed that when I don't use the 'ui->' in a connect it works. however, do have to use it... This is the code:
QWidget *widget = new QWidget(); QWidget *newwidget = new QWidget(); ui->scrollArea->setWidget(widget); ui->scrollArea_2->setWidget(newwidget); QPushButton *button = new QPushButton(); qDebug() << "Initialised widget to scroll area"; connect(ui->scrollArea->verticalScrollBar(), SIGNAL(valueChanged(int)), ui->scrollArea_2->verticalScrollBar(), SLOT(setValue(int)));
Its one of the sneaky ones.
you need to add
in top file file for it to know the type returned by
It does give a hit with "incomplete" type
but still sneaky :)
Thank you. I've now got a new problem that says the program ended unexpectedly, when i set a style sheet for anything in the widget.ui
Any ideas? Thanks
You right clik in the UI file and use Change stylesheet or what you do ?
I right click on the scroll area that I have added and then click change stylesheet.
Alfie Anil last edited by Alfie Anil
I've just got another problem. It says QObject::connect: No such signal QObject::valueChanged(int)
connect(ui->scrollArea->verticalScrollBar(), SIGNAL(valueChanged(int)), ui->scrollArea_2->verticalScrollBar(), SLOT(setValue(int)));
It compiles for me.
Try to do a build -> clean and