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


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

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


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

示例1: workspaceWidgetActivated

void GCF::Components::MainWindow::addChildWidget(QWidget* parent, QWidget* child)
{
    if(!parent || !child)
        return;

    if(parent == d->workspace)
    {
        d->workspace->addTab(child, child->windowTitle());
        child->installEventFilter(this);
        child->setAutoFillBackground(true);
        emit workspaceWidgetActivated(d->workspace->currentWidget());
    }
    else
    {
        QList<QDockWidget*> dockWidgets = d->dockWidgetMap.values();
        QDockWidget* dw = qobject_cast<QDockWidget*>(parent);
        if(dw && dockWidgets.contains(dw))
        {
            QTabWidget* tw = qobject_cast<QTabWidget*>(dw->widget());
            tw->addTab(child, child->windowTitle());
            child->setAutoFillBackground(true);
            if(tw->count())
                dw->show();
            else
                dw->hide();
        }
    }
}
开发者ID:banduladh,项目名称:levelfour,代码行数:28,代码来源:MainWindow.cpp

示例2:

void GCF::Components::MainWindow::removeChildWidget(QWidget* parent, QWidget* child)
{
    if(!parent || !child)
        return;

    if(parent == d->workspace)
    {
        d->workspace->removeTab(d->workspace->indexOf(child));
        child->removeEventFilter(this);
    }
    else
    {
        QList<QDockWidget*> dockWidgets = d->dockWidgetMap.values();
        QDockWidget* dw = qobject_cast<QDockWidget*>(parent);
        if(dw && dockWidgets.contains(dw))
        {
            QTabWidget* tw = qobject_cast<QTabWidget*>(dw->widget());
            tw->removeTab(tw->indexOf(child));
            if(tw->count())
                dw->show();
            else
                dw->hide();
        }
    }
}
开发者ID:banduladh,项目名称:levelfour,代码行数:25,代码来源:MainWindow.cpp

示例3: addDockWindow

/**
 * Adds a new dock window to the main window and embeds the given \a widget.
 */
QDockWidget* DockWindowManager::addDockWindow(const char* name, QWidget* widget, Qt::DockWidgetArea pos)
{
    // creates the dock widget as container to embed this widget
    MainWindow* mw = getMainWindow();
    QDockWidget* dw = new QDockWidget(mw);
    // Note: By default all dock widgets are hidden but the user can show them manually in the view menu.
    // First, hide immediately the dock widget to avoid flickering, after setting up the dock widgets
    // MainWindow::loadLayoutSettings() is called to restore the layout.
    dw->hide();
    switch (pos) {
    case Qt::LeftDockWidgetArea:
    case Qt::RightDockWidgetArea:
    case Qt::TopDockWidgetArea:
    case Qt::BottomDockWidgetArea:
        mw->addDockWidget(pos, dw);
    default:
        break;
    }
    connect(dw, SIGNAL(destroyed(QObject*)),
            this, SLOT(onDockWidgetDestroyed(QObject*)));
    connect(widget, SIGNAL(destroyed(QObject*)),
            this, SLOT(onWidgetDestroyed(QObject*)));

    // add the widget to the dock widget
    widget->setParent(dw);
    dw->setWidget(widget);

    // set object name and window title needed for i18n stuff
    dw->setObjectName(QLatin1String(name));
    dw->setWindowTitle(QDockWidget::trUtf8(name));
    dw->setFeatures(QDockWidget::AllDockWidgetFeatures);

    d->_dockedWindows.push_back(dw);
    return dw;
}
开发者ID:3DPrinterGuy,项目名称:FreeCAD,代码行数:38,代码来源:DockWindowManager.cpp

示例4: addDockForWidget

/*!
    Keep track of dock widgets so they can be shown/hidden for different languages
*/
QDockWidget *DebuggerMainWindow::createDockWidget(const DebuggerLanguage &language,
    QWidget *widget)
{
    QDockWidget *dockWidget = addDockForWidget(widget);
    dockWidget->setObjectName(widget->objectName());
    addDockWidget(Qt::BottomDockWidgetArea, dockWidget);

    if (!(d->m_activeDebugLanguages & language))
        dockWidget->hide();

    QAction *toggleViewAction = dockWidget->toggleViewAction();
    Command *cmd = ActionManager::registerAction(toggleViewAction,
             Id("Debugger.").withSuffix(widget->objectName()));
    cmd->setAttribute(Command::CA_Hide);

    dockWidget->installEventFilter(&d->m_resizeEventFilter);

    connect(dockWidget->toggleViewAction(), &QAction::triggered,
            d, &DebuggerMainWindowPrivate::updateDockWidgetSettings);
    connect(dockWidget, &QDockWidget::topLevelChanged,
            d, &DebuggerMainWindowPrivate::updateDockWidgetSettings);
    connect(dockWidget, &QDockWidget::dockLocationChanged,
            d, &DebuggerMainWindowPrivate::updateDockWidgetSettings);

    return dockWidget;
}
开发者ID:KeeganRen,项目名称:qt-creator,代码行数:29,代码来源:debuggermainwindow.cpp

示例5: setupPanelView

void View::setupPanelView(PanelView* v)
{
    using namespace std;
    QDockWidget* dial = new QDockWidget {v->defaultPanelStatus().prettyName, this};
    dial->setWidget(v->getWidget());
    dial->toggleViewAction()->setShortcut(v->shortcut());
    emit insertActionIntoMenubar({MenuInterface::name(ToplevelMenuElement::ViewMenu) + "/" +
                                  MenuInterface::name(ViewMenuElement::Windows),
                                  dial->toggleViewAction()});

    // Note : this only has meaning at initialisation time.
    auto dock = v->defaultPanelStatus().dock;

    this->addDockWidget(dock, dial);
    if(dock == Qt::LeftDockWidgetArea)
    {
        m_leftWidgets.push_back({v, dial});
        if(m_leftWidgets.size() > 1)
        {
            // Find the one with the biggest priority
            auto it = max_element(begin(m_leftWidgets),
                                  end(m_leftWidgets),
                                  [] (const auto& lhs, const auto& rhs)
            { return lhs.first->defaultPanelStatus().priority < rhs.first->defaultPanelStatus().priority; });

            it->second->raise();
            if(dial != it->second)
            {
                tabifyDockWidget(dial, it->second);
            }
        }
    }
    else if(dock == Qt::RightDockWidgetArea)
    {
        m_rightWidgets.push_back({v, dial});

        if(m_rightWidgets.size() > 1)
        {
            // Find the one with the biggest priority
            auto it = max_element(begin(m_rightWidgets),
                                  end(m_rightWidgets),
                                  [] (const auto& lhs, const auto& rhs)
            { return lhs.first->defaultPanelStatus().priority < rhs.first->defaultPanelStatus().priority; });

            it->second->raise();
            if(dial != it->second)
            {
                tabifyDockWidget(dial, it->second);
            }
        }
    }

    if(!v->defaultPanelStatus().shown)
        dial->hide();
}
开发者ID:Sciss,项目名称:i-score,代码行数:55,代码来源:View.cpp

示例6: createDockWidget

QDockWidget* MainWindow::createDockWidget(KoDockFactoryBase* factory)
{
    QDockWidget* dockWidget = 0;

    if(!m_dockWidgetMap.contains(factory->id())) {
        dockWidget = factory->createDockWidget();

        // It is quite possible that a dock factory cannot create the dock; don't
        // do anything in that case.
        if(!dockWidget) return 0;
        m_dockWidgets.push_back(dockWidget);

        dockWidget->setObjectName(factory->id());
        dockWidget->setParent(this);

        if(dockWidget->widget() && dockWidget->widget()->layout())
            dockWidget->widget()->layout()->setContentsMargins(1, 1, 1, 1);

        Qt::DockWidgetArea side = Qt::RightDockWidgetArea;
        bool visible = true;

        switch(factory->defaultDockPosition()) {
        case KoDockFactoryBase::DockTornOff:
            dockWidget->setFloating(true); // position nicely?
            break;
        case KoDockFactoryBase::DockTop:
            side = Qt::TopDockWidgetArea; break;
        case KoDockFactoryBase::DockLeft:
            side = Qt::LeftDockWidgetArea; break;
        case KoDockFactoryBase::DockBottom:
            side = Qt::BottomDockWidgetArea; break;
        case KoDockFactoryBase::DockRight:
            side = Qt::RightDockWidgetArea; break;
        case KoDockFactoryBase::DockMinimized:
            visible = false; break;
        default:;
        }

        addDockWidget(side, dockWidget);
        if(dockWidget->features() & QDockWidget::DockWidgetClosable) {
            m_dockWidgetMenu->addAction(dockWidget->toggleViewAction());
            if(!visible)
                dockWidget->hide();
        }

        m_dockWidgetMap.insert(factory->id(), dockWidget);
    } else {
        dockWidget = m_dockWidgetMap[ factory->id()];
    }

    connect(dockWidget, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(forceDockTabFonts()));

    return dockWidget;
}
开发者ID:foren197316,项目名称:calligra,代码行数:54,代码来源:MainWindow.cpp

示例7: makeLayout

void InvMain::makeLayout()
{

    // create a docking window for several lists on the right side

    QDockWidget *dw = new QDockWidget(this);
    dw->setWindowTitle("Renderer Listbox ");
    /*qt3 dw->setFeatures(Qt::Horizontal);
   dw->setCloseMode(QDockWidget::Docked);
   dw->setResizeEnabled(true);*/

    listTabs = new QTabWidget(dw);
    listTabs->setMinimumWidth(250);

    /*colorListBox = new QListView(listTabs);
	  colorStringList = new QStringList();
      colorListModel = new QStringListModel(*colorStringList, NULL);
	  colorListBox->setModel(colorListModel);*/
    colorListWidget = new QListWidget(listTabs);
    colorListWidget->setViewMode(QListView::IconMode);

    treeWidget = new objTreeWidget(this, listTabs);
    treeWidget->show();

    listTabs->addTab(treeWidget, "Object Tree");
    listTabs->addTab(colorListWidget, "ColorMap List");

    dw->setWidget(listTabs);
    addDockWidget(Qt::RightDockWidgetArea, dw, Qt::Horizontal);

    // make a central widget window for the render area

    QWidget *main = new QWidget(this);
    main->setMinimumSize(720, 574); // will give PAL size images
    viewer = new InvViewer(main);
    setCentralWidget(main);

    // create the lower docking window for sequencer

    dw = new QDockWidget(this);
    addDockWidget(Qt::BottomDockWidgetArea, dw, Qt::Vertical);
    dw->setWindowTitle("Renderer Sequencer");
    // qt3 dw->setHorizontallyStretchable(true);
    // qt3 dw->setResizeEnabled(true);
    sequencer = new InvSequencer(dw);
    dw->setWidget(sequencer);
    dw->hide();

    // set the view all mode for the renderer
    viewer->viewAll();

    //connect( colorListBox->selectionModel(), SIGNAL(selectionChanged ( QItemSelection,QItemSelection )),
    //         this, SLOT(colorSelectionChanged ( QItemSelection,QItemSelection )) );
}
开发者ID:nixz,项目名称:covise,代码行数:54,代码来源:InvMain.cpp

示例8: QDockWidget

/**
Returns the pointer to the dock widget for the given dock area.

If dockwidget corresponding to the dock area is not found, new dockwidget for that
dock area is created.

\param area DockWidgetArea for which corresponding dockwidget is returned.

*/
QDockWidget* GCF::Components::MainWindow::dockWidget(Qt::DockWidgetArea area)
{
    QDockWidget* ret = 0;

    if(d->dockWidgetMap.contains(area))
        ret = d->dockWidgetMap[area];

    if(!ret)
    {
        // create the dock widget
        ret = new QDockWidget(this);
        ret->setAllowedAreas(area);
		ret->setFeatures(QDockWidget::NoDockWidgetFeatures);
		
		// This is to remove the title bar
		QWidget* titleWidget = new QWidget(this);
		ret->setTitleBarWidget( titleWidget );

        // place a tab widget on the dock widget
        QTabWidget* tabWidget = new QTabWidget(ret);
        ret->setWidget(tabWidget);

        // position the tabs in the right place.
        switch(area)
        {
        case Qt::LeftDockWidgetArea:
            tabWidget->setTabPosition(QTabWidget::North);
            break;
        case Qt::RightDockWidgetArea:
            tabWidget->setTabPosition(QTabWidget::North);
            break;
        case Qt::TopDockWidgetArea:
            tabWidget->setTabPosition(QTabWidget::North);
            // tabWidget->setFixedHeight(150);
            // ret->setFixedHeight(150);
            break;
        case Qt::BottomDockWidgetArea:
            tabWidget->setTabPosition(QTabWidget::North);
            // tabWidget->setFixedHeight(150);
            // ret->setFixedHeight(150);
            break;
        default:
            break;
        }
    }
	addDockWidget(area, ret);
    d->dockWidgetMap[area] = ret;
    ret->hide();
	

    return ret;
}
开发者ID:banduladh,项目名称:levelfour,代码行数:61,代码来源:MainWindow.cpp

示例9: Scene


//.........这里部分代码省略.........
          this, SLOT(contextMenuRequested(QPoint)));

  // The contextMenuPolicy of infoLabel is now the default one, so that one
  // can easily copy-paste its text.
  // connect(ui->infoLabel, SIGNAL(customContextMenuRequested(const QPoint & )),
  //         this, SLOT(showSceneContextMenu(const QPoint &)));

  connect(ui->actionRecenterScene, SIGNAL(triggered()),
          viewer, SLOT(update()));

  connect(ui->actionAntiAliasing, SIGNAL(toggled(bool)),
          viewer, SLOT(setAntiAliasing(bool)));

  connect(ui->actionDraw_two_sides, SIGNAL(toggled(bool)),
          viewer, SLOT(setTwoSides(bool)));

  // add the "About CGAL..." and "About demo..." entries
  this->addAboutCGAL();
  this->addAboutDemo(":/cgal/Polyhedron_3/about.html");

  // Connect the button "addButton" with actionLoad
  ui->addButton->setDefaultAction(ui->actionLoad);
  // Same with "removeButton" and "duplicateButton"
  ui->removeButton->setDefaultAction(ui->actionErase);
  ui->duplicateButton->setDefaultAction(ui->actionDuplicate);

  // Connect actionQuit (Ctrl+Q) and qApp->quit()
  connect(ui->actionQuit, SIGNAL(triggered()),
          this, SLOT(quit()));

  // Connect "Select all items"
  connect(ui->actionSelect_all_items, SIGNAL(triggered()),
          this, SLOT(selectAll()));

  // Recent files menu
  this->addRecentFiles(ui->menuFile, ui->actionQuit);
  connect(this, SIGNAL(openRecentFile(QString)),
	  this, SLOT(open(QString)));

  // Reset the "Operation menu"
  clearMenu(ui->menuOperations);

#ifdef QT_SCRIPT_LIB
  std::cerr << "Enable scripts.\n";
  script_engine = new QScriptEngine(this);
  qScriptRegisterMetaType<Scene_item*>(script_engine,
                                       myScene_itemToScriptValue,
                                       myScene_itemFromScriptValue);
#  ifdef QT_SCRIPTTOOLS_LIB
  QScriptEngineDebugger* debugger = new QScriptEngineDebugger(this);
  debugger->setObjectName("qt script debugger");
  QAction* debuggerMenuAction = 
    menuBar()->addMenu(debugger->createStandardMenu());
  debuggerMenuAction->setText(tr("Qt Script &debug"));
  for(unsigned int i = 0; i < 9; ++i)
  {
    QDockWidget* dock = new QDockWidget(debug_widgets_names[i], this);
    dock->setObjectName(debug_widgets_names[i]);
    dock->setWidget(debugger->widget(debug_widgets[i]));
    this->addDockWidget(Qt::BottomDockWidgetArea, dock);
    dock->hide();
  }
  debugger->setAutoShowStandardWindow(false);
  debugger->attachTo(script_engine);
#  endif // QT_SCRIPTTOOLS_LIB
  QScriptValue fun = script_engine->newFunction(myPrintFunction);
  script_engine->globalObject().setProperty("print", fun);
  
  //  evaluate_script("print('hello', 'world', 'from QtScript!')");
  QScriptValue mainWindowObjectValue = script_engine->newQObject(this);
  script_engine->globalObject().setProperty("main_window", mainWindowObjectValue);

  QScriptValue sceneObjectValue = script_engine->newQObject(scene);
  mainWindowObjectValue.setProperty("scene", sceneObjectValue);
  script_engine->globalObject().setProperty("scene", sceneObjectValue);

  QScriptValue viewerObjectValue = script_engine->newQObject(viewer);
  mainWindowObjectValue.setProperty("viewer", viewerObjectValue);
  script_engine->globalObject().setProperty("viewer", viewerObjectValue);

  QScriptValue cameraObjectValue = script_engine->newQObject(viewer->camera());
  viewerObjectValue.setProperty("camera", cameraObjectValue);
  script_engine->globalObject().setProperty("camera", cameraObjectValue);

  evaluate_script("var plugins = new Array();");
#  ifdef QT_SCRIPTTOOLS_LIB
  QScriptValue debuggerObjectValue = script_engine->newQObject(debugger);
  script_engine->globalObject().setProperty("debugger", debuggerObjectValue);
#  endif
#endif

  readSettings(); // Among other things, the column widths are stored.

  // Load plugins, and re-enable actions that need it.
  loadPlugins();

  // Setup the submenu of the View menu that can toggle the dockwidgets
  Q_FOREACH(QDockWidget* widget, findChildren<QDockWidget*>()) {
    ui->menuDockWindows->addAction(widget->toggleViewAction());
  }
开发者ID:codeneomatrix,项目名称:cgal,代码行数:101,代码来源:MainWindow.cpp

示例10: createDockWindows

void DGLMainWindow::createDockWindows() {
    // Create all dock windows.

    {
        QDockWidget *dock = new DGLTraceView(this, &m_controller);
        dock->setAllowedAreas(Qt::AllDockWidgetAreas);
        addDockWidget(Qt::BottomDockWidgetArea, dock);
        viewMenu->addAction(dock->toggleViewAction());
    }
    {
        QDockWidget *dock = new DGLTreeView(this, &m_controller);
        dock->setAllowedAreas(Qt::AllDockWidgetAreas);
        addDockWidget(Qt::LeftDockWidgetArea, dock);
        viewMenu->addAction(dock->toggleViewAction());
    }
    {
        QDockWidget *dock = new DGLStateView(this, &m_controller);
        dock->setMinimumSize(QSize(0, 0));
        dock->setAllowedAreas(Qt::AllDockWidgetAreas);
        addDockWidget(Qt::BottomDockWidgetArea, dock);
        viewMenu->addAction(dock->toggleViewAction());
    }
    {
        QDockWidget *dock = new DGLGPUView(this, &m_controller);
        dock->setMinimumSize(QSize(0, 0));
        dock->setAllowedAreas(Qt::AllDockWidgetAreas);
        addDockWidget(Qt::BottomDockWidgetArea, dock);
        viewMenu->addAction(dock->toggleViewAction());
    }
    QDockWidget *tabifyMaster;
    {
        QDockWidget *dock = new DGLTextureView(this, &m_controller);
        dock->setAllowedAreas(Qt::AllDockWidgetAreas);
        dock->setMinimumSize(QSize(600, 0));
        addDockWidget(Qt::RightDockWidgetArea, dock);
        viewMenu->addAction(dock->toggleViewAction());
        tabifyMaster = dock;
    }
    {
        QDockWidget *dock = new DGLBufferView(this, &m_controller);
        dock->setMinimumSize(QSize(600, 0));
        dock->setAllowedAreas(Qt::AllDockWidgetAreas);
        addDockWidget(Qt::RightDockWidgetArea, dock);
        viewMenu->addAction(dock->toggleViewAction());
        tabifyDockWidget(tabifyMaster, dock);
    }
    {
        QDockWidget *dock = new DGLFramebufferView(this, &m_controller);
        dock->setMinimumSize(QSize(600, 0));
        dock->setAllowedAreas(Qt::AllDockWidgetAreas);
        addDockWidget(Qt::RightDockWidgetArea, dock);
        viewMenu->addAction(dock->toggleViewAction());
        tabifyDockWidget(tabifyMaster, dock);
    }
    {
        QDockWidget *dock = new DGLFBOView(this, &m_controller);
        dock->setMinimumSize(QSize(600, 0));
        dock->setAllowedAreas(Qt::AllDockWidgetAreas);
        addDockWidget(Qt::RightDockWidgetArea, dock);
        viewMenu->addAction(dock->toggleViewAction());
        tabifyDockWidget(tabifyMaster, dock);
    }
    {
        QDockWidget *dock = new DGLRenderbufferView(this, &m_controller);
        dock->setMinimumSize(QSize(600, 0));
        dock->setAllowedAreas(Qt::AllDockWidgetAreas);
        addDockWidget(Qt::RightDockWidgetArea, dock);
        viewMenu->addAction(dock->toggleViewAction());
        tabifyDockWidget(tabifyMaster, dock);
    }
    {
        QDockWidget *dock = new DGLShaderView(this, &m_controller);
        dock->setMinimumSize(QSize(600, 0));
        dock->setAllowedAreas(Qt::AllDockWidgetAreas);
        addDockWidget(Qt::RightDockWidgetArea, dock);
        viewMenu->addAction(dock->toggleViewAction());
        tabifyDockWidget(tabifyMaster, dock);
    }
    {
        QDockWidget *dock = new DGLProgramView(this, &m_controller);
        dock->setMinimumSize(QSize(600, 0));
        dock->setAllowedAreas(Qt::AllDockWidgetAreas);
        addDockWidget(Qt::RightDockWidgetArea, dock);
        viewMenu->addAction(dock->toggleViewAction());
        tabifyDockWidget(tabifyMaster, dock);
    }
    {
        QDockWidget *dock = new DGLBackTraceView(this, &m_controller);
        dock->setMinimumSize(QSize(0, 0));
        dock->setAllowedAreas(Qt::AllDockWidgetAreas);
        addDockWidget(Qt::RightDockWidgetArea, dock);
        viewMenu->addAction(dock->toggleViewAction());
        tabifyDockWidget(tabifyMaster, dock);
        dock->hide();
    }
}
开发者ID:scygan,项目名称:debugler,代码行数:96,代码来源:dglmainwindow.cpp

示例11: createDockWidget

QDockWidget* MainWindow::createDockWidget(KoDockFactoryBase* factory)
{
    QDockWidget* dockWidget = 0;

    if(!m_dockWidgetMap.contains(factory->id())) {
        dockWidget = factory->createDockWidget();

        // It is quite possible that a dock factory cannot create the dock; don't
        // do anything in that case.
        if(!dockWidget) return 0;
        m_dockWidgets.push_back(dockWidget);

        dockWidget->setObjectName(factory->id());
        dockWidget->setParent(this);

        if(dockWidget->widget() && dockWidget->widget()->layout())
            dockWidget->widget()->layout()->setContentsMargins(1, 1, 1, 1);

        Qt::DockWidgetArea side = Qt::RightDockWidgetArea;
        bool visible = true;

        switch(factory->defaultDockPosition()) {
        case KoDockFactoryBase::DockTornOff:
            dockWidget->setFloating(true); // position nicely?
            break;
        case KoDockFactoryBase::DockTop:
            side = Qt::TopDockWidgetArea; break;
        case KoDockFactoryBase::DockLeft:
            side = Qt::LeftDockWidgetArea; break;
        case KoDockFactoryBase::DockBottom:
            side = Qt::BottomDockWidgetArea; break;
        case KoDockFactoryBase::DockRight:
            side = Qt::RightDockWidgetArea; break;
        case KoDockFactoryBase::DockMinimized:
            visible = false; break;
        default:;
        }

        addDockWidget(side, dockWidget);
        if(dockWidget->features() & QDockWidget::DockWidgetClosable) {
            m_dockWidgetMenu->addAction(dockWidget->toggleViewAction());
            if(!visible)
                dockWidget->hide();
        }

        m_dockWidgetMap.insert(factory->id(), dockWidget);
    } else {
        dockWidget = m_dockWidgetMap[ factory->id()];
    }

    KConfigGroup group(KSharedConfig::openConfig(), "GUI");
    QFont dockWidgetFont  = QFontDatabase::systemFont(QFontDatabase::GeneralFont);
    qreal pointSize = group.readEntry("palettefontsize", dockWidgetFont.pointSize() * 0.75);
    pointSize = qMax(pointSize, QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont).pointSizeF());
    dockWidgetFont.setPointSizeF(pointSize);
#ifdef Q_WS_MAC
    dockWidget->setAttribute(Qt::WA_MacSmallSize, true);
#endif
    dockWidget->setFont(dockWidgetFont);

    connect(dockWidget, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(forceDockTabFonts()));

    return dockWidget;
}
开发者ID:TheTypoMaster,项目名称:calligra,代码行数:64,代码来源:MainWindow.cpp

示例12: visibilityChanged

void tst_QDockWidget::visibilityChanged()
{
    QMainWindow mw;
    QDockWidget dw;
    QSignalSpy spy(&dw, SIGNAL(visibilityChanged(bool)));

    mw.addDockWidget(Qt::LeftDockWidgetArea, &dw);
    mw.show();

    QCOMPARE(spy.count(), 1);
    QCOMPARE(spy.at(0).at(0).toBool(), true);
    spy.clear();

    dw.hide();
    QCOMPARE(spy.count(), 1);
    QCOMPARE(spy.at(0).at(0).toBool(), false);
    spy.clear();

    dw.hide();
    QCOMPARE(spy.count(), 0);

    dw.show();
    QCOMPARE(spy.count(), 1);
    QCOMPARE(spy.at(0).at(0).toBool(), true);
    spy.clear();

    dw.show();
    QCOMPARE(spy.count(), 0);

    QDockWidget dw2;
    mw.tabifyDockWidget(&dw, &dw2);
    dw2.show();
    dw2.raise();
    QCOMPARE(spy.count(), 1);
    QCOMPARE(spy.at(0).at(0).toBool(), false);
    spy.clear();

    dw2.hide();
    qApp->processEvents();
    QCOMPARE(spy.count(), 1);
    QCOMPARE(spy.at(0).at(0).toBool(), true);
    spy.clear();

    dw2.show();
    dw2.raise();
    qApp->processEvents();
    QCOMPARE(spy.count(), 1);
    QCOMPARE(spy.at(0).at(0).toBool(), false);
    spy.clear();

    dw.raise();
    QCOMPARE(spy.count(), 1);
    QCOMPARE(spy.at(0).at(0).toBool(), true);
    spy.clear();

    dw.raise();
    QCOMPARE(spy.count(), 0);

    dw2.raise();
    QCOMPARE(spy.count(), 1);
    QCOMPARE(spy.at(0).at(0).toBool(), false);
    spy.clear();

    dw2.raise();
    QCOMPARE(spy.count(), 0);

    mw.addDockWidget(Qt::RightDockWidgetArea, &dw2);
    QTest::qWait(200);
    QCOMPARE(spy.count(), 1);
    QCOMPARE(spy.at(0).at(0).toBool(), true);
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:71,代码来源:tst_qdockwidget.cpp


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