QT5-control-QDial (Dial control), qt5-control-qdial dial
#ifndef MAINWINDOW_H#define MAINWINDOW_H#include <QMainWindow>#include <QDial>class MainWindow : public QMainWindow{ Q_OBJECTpublic: MainWindow(QWidget *parent = 0); ~MainWindow(); QDial* dl[10];public slots: void changedDate();};#endif // MAINWINDOW_H
# Include "mainwindow. h "# include <QtDebug> MainWindow: MainWindow (QWidget * parent): QMainWindow (parent) {this-> resize (400,400); this-> centralWidget (); int xpos = 30; for (int I = 0; I <3; I ++) {dl [I] = new QDial (this ); dl [I]-> setRange (0,100); dl [I]-> setGeometry (xpos, 30,100,100); xpos + = 110 ;} // display the scale dl [0]-> setNotchesVisible (true); connect (dl [0], SIGNAL (valueChanged (int), this, SLOT (changedDate ();} Main Window ::~ MainWindow () {} void MainWindow: changedDate () {qDebug () <dl [0]-> value ();}
#include "mainwindow.h"#include <QApplication>int main(int argc, char *argv[]){ QApplication a(argc, argv); MainWindow w; w.show(); return a.exec();}