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


C++ QDockWidget::height方法代码示例

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


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

示例1: QMainWindow

Window::Window () : QMainWindow (NULL) {
    try {
        viewer = new GLViewer;
    } catch (GLViewer::Exception e) {
        cerr << e.getMessage () << endl;
        exit (1);
    }
    setCentralWidget (viewer);

#if DEBUG
    cout << "/ ! \\ Building in Debug mode. Performance will be impacted" << endl;
#else
    viewer->setBaseSize(500, 500);
#endif
    
    initControlWidget ();
    
    QDockWidget * controlDockWidget = new QDockWidget (this);
    
    controlDockWidget->setWidget (controlWidget);
    controlDockWidget->adjustSize ();
    addDockWidget (Qt::RightDockWidgetArea, controlDockWidget);
    controlDockWidget->setFloating(true);
    controlDockWidget->setFeatures (QDockWidget::AllDockWidgetFeatures);
    controlDockWidget->adjustSize();
    controlDockWidget->move(0, 0);
    
    QDockWidget * focalDockWidget = new QDockWidget (this);
    focalDockWidget->setWidget(focalWidget);
    focalDockWidget->adjustSize ();
    addDockWidget (Qt::LeftDockWidgetArea, focalDockWidget);
    focalDockWidget->setFloating(true);
    focalDockWidget->setFeatures (QDockWidget::AllDockWidgetFeatures);
    focalDockWidget->adjustSize();
    focalDockWidget->move(200, 0);

    QDockWidget* rayTracerDockWidget = new QDockWidget(this);
    rayTracerDockWidget->setWidget(rayTracerWidget);
    rayTracerDockWidget->adjustSize ();
    addDockWidget (Qt::TopDockWidgetArea, rayTracerDockWidget);
    rayTracerDockWidget->setFloating(true);
    rayTracerDockWidget->setFeatures (QDockWidget::AllDockWidgetFeatures);
    rayTracerDockWidget->adjustSize();

    // Move widgets around the raytracer
    
    QDesktopWidget desktop;
    QRect mainScreenSize = desktop.availableGeometry(desktop.primaryScreen());
    
    controlDockWidget->move(mainScreenSize.width() - 200, 0);
    rayTracerDockWidget->move(0, 0);
    focalDockWidget->move(0, mainScreenSize.height() - focalDockWidget->height());
    
    statusBar()->showMessage("");
}
开发者ID:jcaille,项目名称:Raymini,代码行数:55,代码来源:Window.cpp

示例2: QMainWindow

Window::Window(QWidget* parent) :
    QMainWindow(parent)
{
    setObjectName("ChatWindow");

    Settings::getInstance().load();
    connect(&Settings::getInstance(), &Settings::dataChanged, this, &Window::applySettings);

    QToolBar* toolbar = new QToolBar(this);
    toolbar->setIconSize(QSize(24, 24));
    toolbar->setFloatable(false);
    toolbar->setContextMenuPolicy(Qt::PreventContextMenu);
    addToolBar(toolbar);

    //QAction* refreshAction = toolbar->addAction(QIcon(":/icons/refresh.png"), "refresh");
    //connect(refreshAction, SIGNAL(triggered()), this, SLOT(refreshPlanets()));

    QDockWidget* inputDock = new QDockWidget(this);
    inputDock->setObjectName("Input dock");
    inputDock->setFeatures(QDockWidget::NoDockWidgetFeatures);
    inputDock->setTitleBarWidget(new QWidget(inputDock));
    inputDock->setContextMenuPolicy(Qt::PreventContextMenu);
    addDockWidget(Qt::BottomDockWidgetArea, inputDock);
    QWidget* inputDockWidget = new QWidget(inputDock);
    QHBoxLayout* inputDockWidgetLayout = new QHBoxLayout(inputDockWidget);
    nickLabel = new QLabel(inputDockWidget);
    nickLabel->hide();
    inputLine = new QLineEdit(inputDockWidget);

    connect(inputLine, &QLineEdit::returnPressed, this, &Window::sendMessage);
    inputDockWidgetLayout->addWidget(nickLabel);
    inputDockWidgetLayout->addWidget(inputLine);
    inputDockWidgetLayout->setContentsMargins(2, 2, 2, 6);
    inputDockWidget->setLayout(inputDockWidgetLayout);
    inputDock->setFixedHeight(inputDock->height());
    inputDock->setWidget(inputDockWidget);

    QDockWidget* tabDock = new QDockWidget(this);
    tabDock->setObjectName("Tab dock");
    tabDock->setFeatures(QDockWidget::NoDockWidgetFeatures);
    tabDock->setTitleBarWidget(new QWidget(tabDock));
    tabDock->setContextMenuPolicy(Qt::PreventContextMenu);
    addDockWidget(Qt::LeftDockWidgetArea, tabDock);
    setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
    setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
    tabTree = new TabTree(tabDock, 100);
    tabTree->setHeaderLabel("Chats");
    tabTree->setIndentation(8);
    tabTree->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    tabTree->setMinimumWidth(1);
    tabTree->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
    tabDock->setWidget(tabTree);
    tabTree->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(tabTree, &QTreeWidget::itemSelectionChanged, this, &Window::tabSelected);
    connect(tabTree, &QTreeWidget::customContextMenuRequested, this, &Window::showTabTreeContextMenu);

    QAction* connectAction = new QAction(QIcon(":/icons/connect.png"), "Connect", toolbar);
    QAction* disconnectAction = new QAction(QIcon(":/icons/disconnect.png"), "Disconnect", toolbar);
    QAction* settingsAction = toolbar->addAction(QIcon(":/icons/settings.png"), "Settings");
    connect(connectAction, &QAction::triggered, this, &Window::connectToServer);
    connect(disconnectAction, &QAction::triggered, this, &Window::disconnectFromServer);
    connect(settingsAction, &QAction::triggered, this, &Window::showSettingsDialog);
    toolbar->addActions(QList<QAction*>() << connectAction << disconnectAction << settingsAction);

    serverTab = new QTreeWidgetItem(tabTree, QStringList() << "IRC Server");
    tabTree->addTopLevelItem(serverTab);

    userDock = new QDockWidget(this);
    userDock->setObjectName("User dock");
    userDock->setFeatures(QDockWidget::NoDockWidgetFeatures);
    userDock->setTitleBarWidget(new QWidget(userDock));
    userDock->setContextMenuPolicy(Qt::PreventContextMenu);
    addDockWidget(Qt::RightDockWidgetArea, userDock);
    setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
    setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea);
    userTree = new UserTree(userDock, 100);
    userTree->setItemsExpandable(false);
    userTree->setIndentation(8);
    userTree->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    userTree->setMinimumWidth(1);
    userTree->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
    userDock->setWidget(userTree);
    connect(userTree, &UserTree::privateActionTriggered, this, &Window::startPrivate);

    topicDock = new QDockWidget(this);
    topicDock->setObjectName("Topic dock");
    topicDock->setFeatures(QDockWidget::NoDockWidgetFeatures);
    topicDock->setTitleBarWidget(new QWidget(topicDock));
    topicDock->setContextMenuPolicy(Qt::PreventContextMenu);
    addDockWidget(Qt::TopDockWidgetArea, topicDock);
    topicLine = new TopicLabel(topicDock);
    topicDock->setWidget(topicLine);

    QMainWindow* pagesWindow = new QMainWindow(0);
    pages = new QStackedWidget(pagesWindow);

    serverPage = new ServerPage(serverTab, tabTree);
    connect(serverPage, &ServerPage::connectActionTriggered,    this, &Window::connectToServer);
    connect(serverPage, &ServerPage::disconnectActionTriggered, this, &Window::disconnectFromServer);

//.........这里部分代码省略.........
开发者ID:nurupo,项目名称:nfk-lobby,代码行数:101,代码来源:chatwindow.cpp


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