hmm that is weird. the slider doesnt move either i gather?
than the connection isnt being made, or the slot isnt being called for some reason. If you are looking from the terminal than you should see the output from Qt that says cannot connect slots or whatever Qt says when it cant connect the slots. In that case it should give an error or warning. If it doesn't then it means the signal and slots are connected, but either the signal isn't emitted, or the slot is not called? which is weird.
I assume you are subclassing the UI, so maybe, just for the heck of it, try placing the connect again in the constructor of the subclass. Also make sure the slot is virtual, and not private.
You've prolly tried this, but in case you didnt, maybe try clean build?
Look @ the generated files and see if they are being generated correctly.
I don't know that's all I cant think of. Sorry.
I tried it and it works for me.
All I did was create a basic KDE app in KDevelop.
the kdbl.h header file:
|
Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#ifndef _KDBL_H_
#define _KDBL_H_
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <kmainwindow.h>
class KDoubleSpinBox;
/**
* @short Application Main Window
* @version 0.1
*/
class Kdbl : public KMainWindow
{
Q_OBJECT
public:
/**
* Default Constructor
*/
Kdbl();
/**
* Default Destructor
*/
virtual ~Kdbl();
public slots:
virtual void doubleChange(double v);
private:
KDoubleSpinBox* spin;
};
#endif // _KDBL_H_
|
and kdbl.cpp
|
Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#include "kdbl.h"
#include <qlabel.h>
#include <kmainwindow.h>
#include <klocale.h>
#include <knuminput.h>
#include <iostream>
Kdbl::Kdbl()
: KMainWindow( 0, "Kdbl" )
{
// set the shell's ui resource file
setXMLFile("kdblui.rc");
new QLabel( "Hello World", this, "hello label" );
spin = new KDoubleSpinBox( 0, 9.999, 0.001, 4.321, 3, this );
connect(spin, SIGNAL(valueChanged (double)), this, SLOT(doubleChange(double)));
}
Kdbl::~Kdbl()
{
}
void Kdbl::doubleChange(double v)
{
std::cout << "v: " << (int)(v * 10.0) << std::endl;
}
#include "kdbl.moc"
|
Good luck,
Latem