当前位置: 首页>>代码示例>>C++>>正文


C++ QTabWidget::setFixedHeight方法代码示例

本文整理汇总了C++中QTabWidget::setFixedHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ QTabWidget::setFixedHeight方法的具体用法?C++ QTabWidget::setFixedHeight怎么用?C++ QTabWidget::setFixedHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QTabWidget的用法示例。


在下文中一共展示了QTabWidget::setFixedHeight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: numTableIm

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    //ui->setupUi(this);

    setFixedHeight(768); //1024
    setFixedWidth(768);

    //Define page structure
    QWidget * page = new QWidget(this);
    page->setFixedWidth(this->width());
    page->setFixedHeight(this->height());
    page->setStyleSheet("background-color:white;");
    QVBoxLayout * pageLayout = new QVBoxLayout();


    //Define the fixed header
    QWidget * header = new QWidget(page);
    header->setFixedWidth(page->width());
    QGridLayout * headerLayout = new QGridLayout();
    headerLayout->setHorizontalSpacing(2);
    headerLayout->setVerticalSpacing(2);

    QLabel * numTable = new QLabel();
    QPixmap numTableIm(":/Images/images/NumTable.png");
   // numTable->setStyleSheet("margin-right: 5px");
    numTable->setPixmap(numTableIm);
    numTable->setFixedSize(numTableIm.rect().size());

    QLabel * banner = new QLabel(header);
    QPixmap bannerIm(":/Images/images/Banner.png");
    banner->setPixmap(bannerIm);
    banner->setFixedSize(bannerIm.rect().size());

    QPushButton * pain = new QPushButton("");
    QPixmap painIm(":/Images/images/Pain.png");
    QIcon painIcon(painIm);
    pain->setIcon(painIcon);
    pain->setIconSize(painIm.rect().size());
    pain->setFixedSize(painIm.rect().size());

    QPushButton * eau = new QPushButton("");
    QPixmap eauIm(":/Images/images/eau.png");
    QIcon eauIcon(eauIm);
    eau->setIcon(eauIcon);
    eau->setIconSize(eauIm.rect().size());
    eau->setFixedSize(eauIm.rect().size());

    QPushButton * serveur = new QPushButton("");
    QPixmap serveurIm(":/Images/images/Serveur.png");
    QIcon serveurIcon(serveurIm);
    serveur->setIcon(serveurIcon);
    serveur->setIconSize(serveurIm.rect().size());
    serveur->setFixedSize(serveurIm.rect().size());


    headerLayout->addWidget(numTable, 0, 0, 2, 0);
    headerLayout->addWidget(banner, 0, 1, 2, 1);
    headerLayout->addWidget(serveur,0, 2, 2, 2);
    headerLayout->addWidget(pain, 0, 3);
    headerLayout->addWidget(eau, 1, 3);
    header->setLayout(headerLayout);


    //Define the widget containing all the meals (Tabs)
    QTabWidget * repasFrame = new QTabWidget(page);

    //For one Meal, define the widget containing all the bands
    QWidget * area = new QWidget(repasFrame);
    QScrollArea * sArea = new QScrollArea(area);
    QPalette * palette = new QPalette();
    palette->setColor(QPalette::Background, Qt::white);
    sArea->setPalette(*palette);
    sArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    sArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    sArea->setFixedWidth(page->width() -20);
    sArea->setFixedHeight(page->height() - header->height() - 125);

    bands = new QWidget();
    bands->setFixedWidth(page->width() -25);
   // bands->setMinimumHeight(page->height() - header->height() - 125);
    bands->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Ignored);
    bandsLayout = new QVBoxLayout(bands);
    Headband* menus = HeadbandFactory::buildMenus(bands);
    bandList.append(menus);
    bandsLayout->addWidget(menus);
    usefulLabel = new QLabel();
    bandsLayout->addWidget(usefulLabel);
    bands->setLayout(bandsLayout);
    sArea->setWidget(bands);


    repasFrame->setFixedWidth(page->width());
    repasFrame->setFixedHeight(page->height() - header->height());
    repasFrame->addTab(area, "Repas 1");
    repasFrame->addTab(new QLabel(), "+");


    //Define the confirmation button
//.........这里部分代码省略.........
开发者ID:BenedicteGiraud,项目名称:ProjetINFSI351,代码行数:101,代码来源:mainwindow.cpp


注:本文中的QTabWidget::setFixedHeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。