thanks ChrisW67 ,
I am close to understand, but I am still a bit confused. After further reading, here's what I have got:
mainwindow.h
public slots:
void printInfoToStatusBar
(QString);
public slots:
void printInfoToStatusBar (QString);
To copy to clipboard, switch view to plain text mode
mainwindow.cpp
void MainWindow
::printInfoToStatusBar (QString msg
) {
statusBar()->showMessage(msg);
}
void MainWindow::printInfoToStatusBar (QString msg)
{
statusBar()->showMessage(msg);
}
To copy to clipboard, switch view to plain text mode
then indeed OtherWidget is the central widget of the main window
OtherWidget.h
{
public:
signals:
void sliderChanged(int value);
private:
.....
........other widgets....
};
class OtherWidget : public QWidget
{
public:
OtherWidget(QWidget *parent = 0);
signals:
void sliderChanged(int value);
private:
.....
........other widgets....
QSlider mySlider;
};
To copy to clipboard, switch view to plain text mode
OtherWidget.cpp
OtherWidget
::OtherWidget(QWidget *parent
){
connect(mySlider, SIGNAL(valueChanged(int)), this, SIGNAL(sliderChanged(int)));//connecting two SIGNALS, right?
}
void OtherWidget::sliderChanged(int)
{
//is this the place that I should reflect the slider signal to the mainwindow?how?
}
OtherWidget::OtherWidget(QWidget *parent)
: QWidget(parent)
{
mySlider = new QSlider(this);
connect(mySlider, SIGNAL(valueChanged(int)), this, SIGNAL(sliderChanged(int)));//connecting two SIGNALS, right?
}
void OtherWidget::sliderChanged(int)
{
//is this the place that I should reflect the slider signal to the mainwindow?how?
}
To copy to clipboard, switch view to plain text mode
PS: I haven't used Designer, just Creator.
Bookmarks