提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档
前言
提示:这里可以添加本文要记录的大概内容:
例如:随着人工智能的不断发展,机器学习这门技术也越来越重要,很多人都开启了学习机器学习,本文就介绍了机器学习的基础内容。
提示:以下是本篇文章正文内容,下面案例可供参考
一、pandas是什么?
示例:pandas 是基于NumPy 的一种工具,该工具是为了解决数据分析任务而创建的。
二、添加第二个界面
1. 建立第二个界面时,右击点击添加新建项—QT form
界面如下(示例):
添加好后,需要自己设置好对应的头文件和源文件。
2. 设置好两个界面,并实现相互跳转
son.h代码:
#ifndef SON_H
#define SON_H
#pragma execution_character_set("utf-8")
#include <QtWidgets/QMainWindow>
#include "ui_son.h"
#include <QPushButton>
class Son : public QMainWindow
{
Q_OBJECT
public:
Son(QWidget *parent = 0);
~Son();
void sendSlot();
private:
Ui::Form ui;
QPushButton b;
signals:
void son();
};
#endif // TWOINTERFACE_H
son.cpp代码:
#include "son.h"
Son::Son(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
b.setParent(this);
this->setWindowTitle("第二个界面");
b.setText("切换到主窗口");
b.setFixedSize(100, 50);
b.move(100, 50);
connect(&b, &QPushButton::clicked, this, &Son::sendSlot);
}
//发送槽
void Son::sendSlot()
{
emit son();
}
Son::~Son()
{
}
twointerface.h代码
#ifndef TWOINTERFACE_H
#define TWOINTERFACE_H
#pragma execution_character_set("utf-8")
#include <QtWidgets/QMainWindow>
#include "ui_twointerface.h"
#include <QPushButton>
#include "son.h"
class twoInterface : public QMainWindow
{
Q_OBJECT
public:
twoInterface(QWidget *parent = 0);
~twoInterface();
void changeWin();
void dealSlot();
private:
Ui::twoInterfaceClass ui;
QPushButton b3;
Son s;
};
#endif // TWOINTERFACE_H
twointerface.cpp代码:
#include "twointerface.h"
twoInterface::twoInterface(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
this->setWindowTitle("第一个界面");
b3.setParent(this);
b3.setText("切换到子窗口");
b3.setFixedSize(100, 50);
b3.move(100, 50);
//显示子窗口,主窗口隐藏
connect(&b3, &QPushButton::clicked, this, &twoInterface::changeWin);
//主窗口显示,子窗口隐藏
void(Son::*sonSignal)() = &Son::son;
connect(&s, sonSignal, this, &twoInterface::dealSlot);
}
void twoInterface::changeWin()
{
//子窗口显示,本窗口隐藏
s.show();
this->hide();
}
void twoInterface::dealSlot()
{
s.hide();
this->show();
}
twoInterface::~twoInterface()
{
}
总结
提示:这里对文章进行总结:
例如:以上就是今天要讲的内容,本文仅仅简单介绍了pandas的使用,而pandas提供了大量能使我们快速便捷地处理数据的函数和方法。