-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwidget.cpp
102 lines (84 loc) · 2.96 KB
/
mainwidget.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#include "mainwidget.h"
#include "ui_mainwidget.h"
#include "utils/utils.h"
#define WIDGETPAGE_homePage 0 //首页
#define WIDGETPAGE_photoPage 1 //写真馆
#define WIDGETPAGE_beautyPage 2 //潮拍馆
MainWidget::MainWidget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::MainWidget)
{
ui->setupUi(this);
this->setWindowTitle(QString::fromUtf8("美之图(MMZZTT.COM)"));
this->initMainWidgetHead();
Utils::createPage22StackedWidget<HomePageForm>(WIDGETPAGE_homePage,m_homePageFrom,ui->stackedWidget);
}
MainWidget::~MainWidget()
{
delete ui;
}
void MainWidget::NavbuttonClick6()
{
NavButton *b = (NavButton *)sender();
#if DEBUG_FUNC
qDebug()<< Q_FUNC_INFO << __LINE__
<< "当前按下:" << b->text();
#endif
{
QString tt_sql = "当前按下[导航栏]中:";
tt_sql.append(b->text());
}
for (int i = 0; i < btns6.count(); i++) {
NavButton *btn = btns6.at(i);
btn->setChecked(b == btn);
// if(b == ui->AboutMe){
// emit sig_ClickedAboutMePage();
// }
// if(b == btn){
// if(i > ui->stackedWidget_OtherUI->count()) continue;
// ui->stackedWidget_OtherUI->setCurrentIndex(i);
// ui->stackedWidget_OtherUI->currentWidget()->setFocusPolicy(Qt::StrongFocus);
// }
}
}
void MainWidget::initMainWidgetHead()
{
#if DEBUG_FUNC
qDebug()<<Q_FUNC_INFO<<__LINE__;
#endif
QColor normalBgColor = QColor("#FFFFFF");
QColor hoverBgColor = QColor("#FFFFFF");
QColor checkBgColor = QColor("#FFFFFF");
QColor normalTextColor = QColor("#999");
QColor hoverTextColor = Qt::black;
QColor checkTextColor = QColor("#333");
//头部背景色
ui->widgetNav6->setStyleSheet("color:#292929; background-color: #FFFFFF;");
// 首页-写真馆-潮拍馆
btns6 <<ui->homePage <<ui->photoPage <<ui->beautyPage;
for (int i = 0; i < btns6.count(); i++) {
NavButton *btn = btns6.at(i);
btn->setPaddingLeft(20);
btn->setShowLine(false);
btn->setTextAlign(NavButton::TextAlign_Center);
btn->setLinePosition(NavButton::LinePosition_Bottom);
btn->setNormalBgColor(normalBgColor);
btn->setHoverBgColor(hoverBgColor);
btn->setCheckBgColor(checkBgColor);
btn->setNormalTextColor(normalTextColor);
btn->setHoverTextColor(hoverTextColor);
btn->setCheckTextColor(checkTextColor);
connect(btn, SIGNAL(clicked(bool)), this, SLOT(NavbuttonClick6()));
}
//设置整体圆角
ui->widgetNav6->setStyleSheet(".QWidget{background:#FFFFFF;border:1px solid #FFFFFF;border-radius:20px;}");
for(auto each_page : ui->stackedWidget->findChildren<QWidget*>()){
ui->stackedWidget->removeWidget(each_page);
each_page->deleteLater();
}
ui->label_title->setToolTip("宅男圣地美之图,满足你的所有幻想");
}
#include <QResizeEvent>
void MainWidget::resizeEvent(QResizeEvent *event)
{
}