老熟女激烈的高潮_日韩一级黄色录像_亚洲1区2区3区视频_精品少妇一区二区三区在线播放_国产欧美日产久久_午夜福利精品导航凹凸

重慶分公司,新征程啟航

為企業(yè)提供網(wǎng)站建設(shè)、域名注冊(cè)、服務(wù)器等服務(wù)

Qt學(xué)習(xí):QStackedWidget和手工代碼布局的程序?qū)嵗?/h1>

重要函數(shù): 
1.void setCurrentIndex(int); //用下標(biāo)顯示當(dāng)前頁(yè),.從0開始. 
2.int count(); //返回頁(yè)面的數(shù)量. 
3.void insertWidget(int, QWidget*); //在下標(biāo)為參數(shù)位置插入頁(yè). 
4.void addWidget(QWidget*); //加上頁(yè). 
5.void removeWidget(QWidget*); //刪除頁(yè).

創(chuàng)新互聯(lián)主營(yíng)永修網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營(yíng)網(wǎng)站建設(shè)方案,成都app軟件開發(fā),永修h5微信平臺(tái)小程序開發(fā)搭建,永修網(wǎng)站營(yíng)銷推廣歡迎永修等地區(qū)企業(yè)咨詢

信號(hào):

1.void currentChanged(int); //當(dāng)前頁(yè)面發(fā)生改變時(shí),發(fā)出信號(hào). 
2.void widgetRemoved(int); //頁(yè)面被刪除時(shí),發(fā)出信號(hào).


首先我們添加一個(gè)類,名字自定義,我這里叫MyPicture.不用Qt設(shè)計(jì)師進(jìn)行拖拽,而是進(jìn)行手工布局,因?yàn)楫?dāng)部件的量很多或者需要自動(dòng)生成的時(shí)候,手工布局顯得更加靈活.


以下是”MyPicture.cpp”下的代碼:

#include "MyPicture.h"MyPicture::MyPicture(QWidget *parent)
    : QWidget(parent)
{
    ui.setupUi(this);    //創(chuàng)建一個(gè)垂直布局.
    QVBoxLayout *vertLayout = new QVBoxLayout;    for (int i = 0; i < 5; ++i)
    {        //創(chuàng)建一個(gè)水平布局.
        QHBoxLayout *horiLayout = new QHBoxLayout;        for (int j = 0; j < 5; ++j)
        {
            QLabel *temp = new QLabel("z");
            temp->resize(100,100);            //也添加到vector容器里去,方便調(diào)用.
            this->labelArray.push_back(temp);            //把label對(duì)象添加到水平布局中去.
            horiLayout->addWidget(temp);
        }        //布局中可以添加布局.
        vertLayout->addLayout(horiLayout);
    }    //最后應(yīng)用垂直布局.
    this->setLayout(vertLayout);
}

MyPicture::~MyPicture()
{

}void MyPicture::setText(QString str)
{    for (int i = 0; i < 25; ++i)
    {        this->labelArray[i]->setText(str);
    }
}12345678910111213141516171819202122232425262728293031323334353637383940

以下是”MyPicture.h”的代碼:

#ifndef MYPICTURE_H#define MYPICTURE_H#include #include "ui_MyPicture.h"#include #include #include #include class MyPicture : public QWidget{
    Q_OBJECTpublic:
    MyPicture(QWidget *parent = 0);
    ~MyPicture();    void setText(QString);private:
    Ui::MyPicture ui;
    QVector labelArray;
};#endif // MYPICTURE_H1234567891011121314151617181920212223242526

然后在c.ui處,進(jìn)行拖拽,進(jìn)行如下布局和命名. 
Qt學(xué)習(xí): QStackedWidget和手工代碼布局的程序?qū)嵗?></p><hr  /><p>然后是”c.cpp”的代碼:</p><pre>#include setCurrentIndex(0); }void c::showSecondPageSlot() {     ui.stackedWidget->setCurrentIndex(1); }//初始化堆積頁(yè).void c::initStackedWidget() {    //先刪除系統(tǒng)自動(dòng)為你添加的兩個(gè)頁(yè)面.     ui.stackedWidget->removeWidget(ui.page);     ui.stackedWidget->removeWidget(ui.page_2);     MyPicture *temp = new MyPicture;     temp->setText(QString::fromLocal8Bit("哈哈"));     ui.stackedWidget->addWidget(temp);     MyPicture *i = new MyPicture;     i->setText(QString::fromLocal8Bit("嘻嘻"));     ui.stackedWidget->addWidget(i); }123456789101112131415161718192021222324252627282930313233343536373839404142


“c.h”的代碼:

#ifndef C_H#define C_H#include #include "ui_c.h"#include #include #include #include "MyPicture.h"class c : public QMainWindow{
    Q_OBJECTpublic:
    c(QWidget *parent = 0);
    ~c();    //初始化堆積頁(yè).
    void initStackedWidget();private slots:    void showSecondPageSlot();    void showFirstPageSlot();private:
    Ui::cClass ui;
};#endif // C_H12345678910111213141516171819202122232425262728293031

最后是”main.cpp”的代碼:

#include "c.h"#include #include "MyPicture.h"int main(int argc, char *argv[])
{
    QApplication a(argc, argv);    /*c w;
    w.show();*/

    MyPicture w;
    w.show();    return a.exec();
}

分享題目:Qt學(xué)習(xí):QStackedWidget和手工代碼布局的程序?qū)嵗?
本文網(wǎng)址:http://www.xueling.net.cn/article/gghiej.html

其他資訊

在線咨詢
服務(wù)熱線
服務(wù)熱線:028-86922220
TOP
主站蜘蛛池模板: 女女女女bbbb毛片免费视频 | 诱人的飞行韩剧在线观看完整免费 | 精品久久亚洲精品中文字幕 | 在线播放国产区 | 免费看一级黄色 | 免费高清黄色 | 国产视频手机在线观看 | 久久6热最新地址 | 亚瑟国产精品久久 | 丰满少妇人妻HD高清大乳 | 97一区二区三区 | 国产区一区二 | 国产裸拍裸体视频在线观看 | 最新高清无码专区在线视频 | 91无遮挡无码国产在线播放 | 2015www永久免费观看播放 | 国产亚洲va综合人人澡精品 | japan21xxxxhd日本妞 | www.99久| 久久综合久色欧美综合狠狠 | 亚洲一区二区日本 | 国产最好看的级SUV卡毛 | 狠狠躁18三区二区一区视频 | 国产特色特黄的视频免费观看 | a级高清免费毛片av在线 | 日韩av第一页| 影音先锋亚洲AV资源网站 | 亚洲精品97久久 | 激情中国色综合 | 热久久综合网 | 免费看一级片 | 免费在线观看www | 国产女合集小岁9三部 | 成人公开免费视频 | 成人在线播放网址 | 91视频专区 | 狠狠艹狠狠干 | 久久久久久成人毛片免费看 | 日本成本人片无码免费视频网站 | 中文字幕制服丝袜一区二区三区 | 午夜免费看|