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


C++ QMenuBar::setMaximumHeight方法代码示例

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


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

示例1: icon

MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){

    QIcon icon(":/n.png");

    window=new Window();

    //this->setStyleSheet("background-color: grey");
    setWindowTitle("Prototipo 3.1" );

    QPixmap pixmap(15,15);
    pixmap.fill(QColor("red"));
    QIcon redIcon(pixmap);

    QAction *openAction = new QAction(redIcon, "Open", this);
        openAction->setShortcut(tr("CTRL+O"));
    QAction *saveAction = new QAction(icon, "Save As...", this);
        saveAction->setShortcut(tr("CTRL+S"));
    QAction *quitAction = new QAction(icon, "Exit", this);
        quitAction->setShortcut(tr("CTRL+Q"));
    QAction *undoAction = new QAction(icon, "Undo", this);
        undoAction->setShortcut(tr("CTRL+Z"));
    QAction *redoAction = new QAction(icon, "Redo", this);
        redoAction->setShortcut(tr("CTRL+Y"));
    QAction *settingAction = new QAction(icon, "Settings...", this);
        settingAction->setShortcut(tr("CTRL+S"));

    QAction *aboutAction = new QAction(icon, "About", this);
        aboutAction->setShortcut(tr("CTRL+à"));


    QWidget *centralWidget = new QWidget(this);
    QGridLayout *layout = new QGridLayout();

    QMenuBar *menubar = new QMenuBar();
    QMenu* menu1 = new QMenu("File");
    menu1->addAction(openAction);
    menu1->addAction(saveAction);
    menu1->addAction(quitAction);
    QMenu* menu2 = new QMenu("Edit");
    menu2->addAction(undoAction);
    menu2->addAction(redoAction);
    menu2->addAction(settingAction);
    QMenu* menu3 = new QMenu("?");
    menu3->addAction(aboutAction);
    menubar->addMenu(menu1);
    menubar->addMenu(menu2);
    menubar->addMenu(menu3);

    menubar->setMaximumHeight(25);

    layout->addWidget(menubar,0,0,1,5);


    layout->addWidget(window,1,0,3,0);

    QToolBar * toolbar_1 =new QToolBar("1");
    QToolBar * toolbar_2 =new QToolBar("2");

    QGroupBox *groupBox_1 = new QGroupBox(tr("Scene Information"));

        QLabel *label1 = new QLabel(tr("# Meshes:"));
        QLabel *label2 = new QLabel(tr("# Vertices"));
        QLabel *label3 = new QLabel(tr("# Lights"));
        QLabel *label4 = new QLabel(tr("# Cameras"));
        QLabel *label5 = new QLabel(tr(""));
        QVBoxLayout *vbox1 = new QVBoxLayout;
        vbox1->addWidget(label1);
        vbox1->addWidget(label2);
        vbox1->addWidget(label3);
        vbox1->addWidget(label4);
        vbox1->addWidget(label5);

        vbox1->addStretch(1);
        groupBox_1->setLayout(vbox1);

    QGroupBox *groupBox_2 = new QGroupBox(tr("Reshaping"));

        QSlider * x_reshaping = new QSlider (Qt::Horizontal);
        x_reshaping->setFocusPolicy (Qt::ClickFocus);
        QSlider * y_reshaping = new QSlider (Qt::Horizontal);
        QSlider * z_reshaping = new QSlider (Qt::Horizontal);
        QVBoxLayout *vbox2 = new QVBoxLayout;

        vbox2->addWidget(x_reshaping);
        vbox2->addWidget(y_reshaping);
        vbox2->addWidget(z_reshaping);
        vbox2->addStretch(1);
        groupBox_2->setLayout(vbox2);

    QGroupBox *groupBox_3 = new QGroupBox(tr("Translation"));

        QSlider * x_translation = new QSlider (Qt::Horizontal);
        QSlider * y_translation = new QSlider (Qt::Horizontal);
        QSlider * z_translation = new QSlider (Qt::Horizontal);

        QVBoxLayout *vbox3 = new QVBoxLayout;
        vbox3->addWidget(x_translation);
        vbox3->addWidget(y_translation);
        vbox3->addWidget(z_translation);
        vbox3->addStretch(1);
//.........这里部分代码省略.........
开发者ID:nurmen,项目名称:jenkins,代码行数:101,代码来源:mainwindow.cpp


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