1 Star 2 Fork 5

zhengtianzuo/QtWidgetsExamples

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
QtStackedWidget.cpp 1.24 KB
一键复制 编辑 原始数据 按行查看 历史
zhengtianzuo 提交于 7年前 . readme
/*!
*@file QtStackedWidget.cpp
*@brief Qt堆栈窗体
*@version 1.0
*@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation
*@author zhengtianzuo
*/
#include "QtStackedWidget.h"
#include "ui_QtStackedWidget.h"
QtStackedWidget::QtStackedWidget(QWidget *parent) :
QDialog(parent),
ui(new Ui::QtStackedWidget)
{
ui->setupUi(this);
connect(ui->pushButtonPage1, &QPushButton::clicked, this, &QtStackedWidget::setCurrentIndex);
connect(ui->pushButtonPage2, &QPushButton::clicked, this, &QtStackedWidget::setCurrentIndex);
ui->stackedWidget->setCurrentIndex(0);
m_lpPropertyAni = new Cls_PropertyAni(this);
}
QtStackedWidget::~QtStackedWidget()
{
delete m_lpPropertyAni;
m_lpPropertyAni = nullptr;
delete ui;
}
void QtStackedWidget::setCurrentIndex()
{
QPushButton *btn = reinterpret_cast<QPushButton *>(sender());
if (btn == ui->pushButtonPage1 && ui->stackedWidget->currentIndex() != 0)
{
m_lpPropertyAni->Init(ui->stackedWidget, true);
ui->stackedWidget->setCurrentIndex(0);
}
else if (btn == ui->pushButtonPage2 && ui->stackedWidget->currentIndex() != 1)
{
m_lpPropertyAni->Init(ui->stackedWidget, false);
ui->stackedWidget->setCurrentIndex(1);
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/zhengtianzuo/QtWidgetsExamples.git
git@gitee.com:zhengtianzuo/QtWidgetsExamples.git
zhengtianzuo
QtWidgetsExamples
QtWidgetsExamples
master

搜索帮助