如何做网站直播入口,和拓者设计吧类似的网站,做网站的收益,asp网站下载效果
在程序启动后#xff0c;有时不会进入到工作页面#xff0c;会进入到产品展示页面。 动画如下#xff1a; 首页展示 页面操作
当不点击时#xff0c;一秒自动刷新一次#xff1b;当点击时#xff0c;会自动跳转到对应页面#xff1b;点击上一页、下一页、及跳转页…效果
在程序启动后有时不会进入到工作页面会进入到产品展示页面。 动画如下 首页展示 页面操作
当不点击时一秒自动刷新一次当点击时会自动跳转到对应页面点击上一页、下一页、及跳转页数会自动跳转。
UI设计 示例
注释在代码中代码可运行。 .h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H#include QMainWindow#include QMap
#include QRadioButton
#include QButtonGroup
namespace Ui {
class MainWindow;
}class MainWindow : public QMainWindow
{Q_OBJECTpublic:explicit MainWindow(QWidget *parent nullptr);~MainWindow();private:Ui::MainWindow *ui;// 用于管理选择按钮QMapint, QRadioButton* m_mapRadios;// 加入组QButtonGroup* m_pBtnGroup;
};#endif // MAINWINDOW_H.cpp
#include mainwindow.h
#include ui_mainwindow.h#include QDebug
#include QLabel
#include QFont#include QTimerMainWindow::MainWindow(QWidget *parent) :QMainWindow(parent),ui(new Ui::MainWindow)
{ui-setupUi(this);ui-pushButton-setStyleSheet(QPushButton {background-color: #eeeeee; outline: none;});ui-pushButton_2-setStyleSheet(QPushButton {background-color: #eeeeee; outline: none;});m_pBtnGroup new QButtonGroup(this);ui-horizontalLayout-addStretch();// 循环创建按钮for (int var 0; var 5; var) {QRadioButton* pR new QRadioButton(QString::number(var1));m_mapRadios.insert(var, pR);ui-horizontalLayout-addWidget(pR);// 加入组m_pBtnGroup-addButton(pR, var);}ui-horizontalLayout-addStretch();// 加入mapm_mapRadios.value(m_mapRadios.keys().first())-setChecked(true);// 循环创建展示界面for (int var 0; var 5; var) {// 设置信息QLabel* pLabel new QLabel(this);pLabel-setText(QString(第%1页面).arg(var1));pLabel-resize(150, 100);QFont font pLabel-font();font.setPointSize(23);font.setBold(true);pLabel-setFont(font);pLabel-setStyleSheet(QLabel{color:#ff0000;});pLabel-move(width()/2, height()/2);ui-stackedWidget-insertWidget(ui-stackedWidget-count(), pLabel);}ui-stackedWidget-setCurrentIndex(0);// 根据点击按钮同步展示页面connect(m_pBtnGroup, static_castvoid (QButtonGroup::*)(int)(QButtonGroup::buttonClicked), this, [](int nId){ui-stackedWidget-setCurrentIndex(nId);});// 定时器QTimer* pTimer new QTimer(this);connect(pTimer, QTimer::timeout, this, [](){// 每一秒更新一次int nIndex ui-stackedWidget-currentIndex();if(nIndex 4){ui-stackedWidget-setCurrentIndex(nIndex1);m_mapRadios.value(nIndex1)-setChecked(true);}else{ui-stackedWidget-setCurrentIndex(0);m_mapRadios.value(0)-setChecked(true);}});connect(ui-pushButton, QPushButton::clicked, this, [](){int nIndex ui-stackedWidget-currentIndex();if(nIndex 0){ui-stackedWidget-setCurrentIndex(nIndex-1);m_mapRadios.value(nIndex-1)-setChecked(true);}});connect(ui-pushButton_2, QPushButton::clicked, this, [](){int nIndex ui-stackedWidget-currentIndex();if(nIndex 4){ui-stackedWidget-setCurrentIndex(nIndex1);m_mapRadios.value(nIndex1)-setChecked(true);}});pTimer-start(1000);}MainWindow::~MainWindow()
{delete ui;
}
结论
可将每页显示的改为产品或者介绍图实现业务。