C++ (Qt)class Myclass : public MainWindow {Q_OBJECT public slots: void mySlot(); };
C++ (Qt)void Myclass::mySlot(){QTime time_obj;ui->timeEdit->setTime(time_obj.currentTime());}
C++ (Qt)#ifndef MAINWINDOW_H#define MAINWINDOW_H #include <QMainWindow> namespace Ui { class MainWindow;} class MainWindow : public QMainWindow{ Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private: Ui::MainWindow *ui;};class Myclass : public MainWindow {Q_OBJECT public slots: void mySlot(); }; #endif // MAINWINDOW_H
C++ (Qt)#include "mainwindow.h"#include "ui_mainwindow.h"#include "QTime"#include "QTimer" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow){ ui->setupUi(this); // MyClass ddd;// QObject::connect(time_obj, SIGNAL( timeout() ),// ddd, SLOT(mySlot));} void Myclass::mySlot(){QTime time_obj;ui->timeEdit->setTime(time_obj.currentTime());} MainWindow::~MainWindow(){ delete ui;}
class Foo{ public: Foo(); protected: m_member;}class Boo : public Foo{ public: Boo();}